public void ApplyTest()
        {
            Bitmap img1 = Properties.Resources.image2;


            MatrixH homography = new MatrixH(1, 0, 32,
                                              0, 1, 0,
                                              0, 0);

            ProjectiveTransform transform = new ProjectiveTransform(homography);
            transform.FillColor = Color.Red;
            Bitmap actual = transform.Apply(img1);

            ImageBox.Show(actual, PictureBoxSizeMode.Zoom);

            Assert.AreEqual(64, actual.Size.Width);
            Assert.AreEqual(32, actual.Size.Height);



            homography = new MatrixH(2, 0, 0,
                                     0, 2, 0,
                                     0, 0);

            transform = new ProjectiveTransform(homography);
            transform.FillColor = Color.Red;
            actual = transform.Apply(img1);

            ImageBox.Show(actual, PictureBoxSizeMode.Zoom);

            Assert.AreEqual(32, actual.Size.Width);
            Assert.AreEqual(32, actual.Size.Height);



            homography = new MatrixH(2, 0, 32,
                                     0, 0.5f, 32,
                                     0, 0);

            transform = new ProjectiveTransform(homography);
            transform.FillColor = Color.Red;
            actual = transform.Apply(img1);

            ImageBox.Show(actual, PictureBoxSizeMode.Zoom);

            Assert.AreEqual(32 / 2 + 32, actual.Size.Width);
            Assert.AreEqual(32 / 0.5 + 32, actual.Size.Height);



            homography = new MatrixH(1, 0, -32,
                                     0, 1,   0,
                                     0, 0);

            transform = new ProjectiveTransform(homography);
            transform.FillColor = Color.Red;
            actual = transform.Apply(img1);

            ImageBox.Show(actual, PictureBoxSizeMode.Zoom);

            Assert.AreEqual(64, actual.Size.Width);
            Assert.AreEqual(32, actual.Size.Height);
        }
Esempio n. 2
0
        public void ApplyTest()
        {
            Bitmap img1 = Properties.Resources.image2;


            MatrixH homography = new MatrixH(1, 0, 32,
                                             0, 1, 0,
                                             0, 0);

            ProjectiveTransform transform = new ProjectiveTransform(homography);

            transform.FillColor = Color.Red;
            Bitmap actual = transform.Apply(img1);

            ImageBox.Show(actual, PictureBoxSizeMode.Zoom);

            Assert.AreEqual(64, actual.Size.Width);
            Assert.AreEqual(32, actual.Size.Height);



            homography = new MatrixH(2, 0, 0,
                                     0, 2, 0,
                                     0, 0);

            transform           = new ProjectiveTransform(homography);
            transform.FillColor = Color.Red;
            actual = transform.Apply(img1);

            ImageBox.Show(actual, PictureBoxSizeMode.Zoom);

            Assert.AreEqual(32, actual.Size.Width);
            Assert.AreEqual(32, actual.Size.Height);



            homography = new MatrixH(2, 0, 32,
                                     0, 0.5f, 32,
                                     0, 0);

            transform           = new ProjectiveTransform(homography);
            transform.FillColor = Color.Red;
            actual = transform.Apply(img1);

            ImageBox.Show(actual, PictureBoxSizeMode.Zoom);

            Assert.AreEqual(32 / 2 + 32, actual.Size.Width);
            Assert.AreEqual(32 / 0.5 + 32, actual.Size.Height);



            homography = new MatrixH(1, 0, -32,
                                     0, 1, 0,
                                     0, 0);

            transform           = new ProjectiveTransform(homography);
            transform.FillColor = Color.Red;
            actual = transform.Apply(img1);

            ImageBox.Show(actual, PictureBoxSizeMode.Zoom);

            Assert.AreEqual(64, actual.Size.Width);
            Assert.AreEqual(32, actual.Size.Height);
        }