Esempio n. 1
0
        public void ProcessImageTest()
        {
            double[,] diag = Matrix.Magic(5);

            Bitmap input;

            new MatrixToImage().Convert(diag, out input);

            // Create a new Variance filter
            Variance filter = new Variance();

            // Apply the filter
            Bitmap output = filter.Apply(input);

            double[,] actual;

            new ImageToMatrix().Convert(output, out actual);

            string str = actual.ToString(CSharpMatrixFormatProvider.InvariantCulture);

            double[,] expected =
            {
                {                  0,                 0,                 0,                 0,                 0 },
                { 0.0941176470588235, 0.545098039215686, 0.396078431372549, 0.376470588235294, 0.192156862745098 },
                {  0.298039215686275, 0.376470588235294,  0.27843137254902, 0.211764705882353, 0.133333333333333 },
                {  0.317647058823529, 0.203921568627451,               0.2,  0.16078431372549, 0.109803921568627 },
                { 0.0509803921568627, 0.109803921568627,  0.16078431372549,               0.2, 0.203921568627451 }
            };

            Assert.IsTrue(expected.IsEqual(actual, 1e-6));
        }
Esempio n. 2
0
        public void VarianceTest1()
        {
            Bitmap   image    = Accord.Imaging.Image.Clone(Resources.lena512);
            Variance variance = new Variance();
            Bitmap   result   = variance.Apply(image);

            Assert.IsNotNull(result);
        }
Esempio n. 3
0
        public void VarianceTest1()
        {
            Bitmap   image    = Properties.Resources.lena512;
            Variance variance = new Variance();
            Bitmap   result   = variance.Apply(image);

            Assert.IsNotNull(result);
        }