Accord.Tests.Imaging.SauvolaTest.SauvolaTest3 C# (CSharp) Method

SauvolaTest3() private method

private SauvolaTest3 ( ) : void
return void
        public void SauvolaTest3()
        {
            double[,] diag = Matrix.Magic(5);

            Bitmap input;
            new MatrixToImage()
            {
                Format = PixelFormat.Format32bppRgb,
            }.Convert(diag, out input);

            Assert.AreEqual(PixelFormat.Format32bppRgb, input.PixelFormat);

            SauvolaThreshold filter = new SauvolaThreshold();

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

            Assert.AreEqual(PixelFormat.Format32bppRgb, output.PixelFormat);

            double[,] actual;

            for (int i = 0; i < 3; i++)
            {
                new ImageToMatrix()
                {
                    Channel = i
                }.Convert(output, out actual);

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

                double[,] expected = new double[,] 
                {
                    { 1, 1, 1, 1, 1 },
                    { 1, 1, 1, 1, 1 },
                    { 1, 1, 1, 1, 1 },
                    { 1, 1, 1, 1, 1 },
                    { 1, 1, 1, 1, 1 } 
                };

                Assert.IsTrue(expected.IsEqual(actual, 1e-6));
            }
        }