Accord.Tests.Imaging.ToolsTest.HomographyTestF C# (CSharp) Method

HomographyTestF() private method

private HomographyTestF ( ) : void
return void
        public void HomographyTestF()
        {
            PointF[] x1 = 
            {
                new PointF(0, 0),
                new PointF(1, 0),
                new PointF(0, 1),
                new PointF(1, 1),
            };

            PointF[] x2 = 
            {
                new PointF(0, 0),
                new PointF(1, 0),
                new PointF(0, 1),
                new PointF(1, 1),
            };

            float[,] expected = Matrix.Identity(3).ToSingle();

            float[,] actual = (float[,])Tools.Homography(x1, x2);

            for (int i = 0; i < 3; i++)
                for (int j = 0; j < 3; j++)
                    actual[i, j] /= actual[2, 2];


            Assert.IsTrue(Matrix.IsEqual(expected, actual, 1e-5f));


            x1 = new PointF[]
            {
                new PointF(2, 0),
                new PointF(1, 0),
                new PointF(5, 1),
                new PointF(1, 1),
                new PointF(7, 1),
                new PointF(1, 2),
                new PointF(1, 1),
            };

            x2 = new PointF[]
            {
                new PointF(9, 1),
                new PointF(1, 5),
                new PointF(9, 1),
                new PointF(1, 7),
                new PointF(2, 7),
                new PointF(6, 5),
                new PointF(1, 7),
            };

            expected = new float[,]
            {
                { 0.2225f, -3.1727f,  1.8023f },
                { 0.3648f, -1.7149f, -0.2173f },
                { 0.0607f, -0.4562f,  0.1229f },
            };

            expected = (float[,])(new MatrixH(expected));

            actual = (float[,])Tools.Homography(x1, x2);

            Assert.IsTrue(Matrix.IsEqual(expected, actual, 0.01f));

        }