Hu's set of invariant image moments.

In image processing, computer vision and related fields, an image moment is a certain particular weighted average (moment) of the image pixels' intensities, or a function of such moments, usually chosen to have some attractive property or interpretation.

Image moments are useful to describe objects after segmentation. Simple properties of the image which are found via image moments include area (or total intensity), its centroid, and information about its orientation.

Hu's set of invariant moments are invariant under translation, changes in scale, and also rotation. The first moment, I1, is analogous to the moment of inertia around the image's centroid, where the pixels' intensities are analogous to physical density. The last one, I7, is skew invariant, which enables it to distinguish mirror images of otherwise identical images.

References: Wikipedia contributors. "Image moment." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia. Available at http://en.wikipedia.org/wiki/Image_moment

상속: MomentsBase, IMoments
예제 #1
0
        public void ComputeTest2()
        {
            float[,] img1; new ImageToMatrix().Convert(Resources.tt1, out img1);
            float[,] img2; new ImageToMatrix().Convert(Resources.tt2, out img2);
            float[,] img3; new ImageToMatrix().Convert(Resources.tt3, out img3);
            float[,] img4; new ImageToMatrix().Convert(Resources.tt4, out img4);

            var hu1 = new HuMoments(img1);
            var hu2 = new HuMoments(img2);
            var hu3 = new HuMoments(img3);
            var hu4 = new HuMoments(img4);

            Assert.AreEqual(hu1.I1, hu2.I1, 0.015);
            Assert.AreEqual(hu1.I2, hu2.I2, 0.015);
            Assert.AreEqual(hu1.I3, hu2.I3, 1e-5);
            Assert.AreEqual(hu1.I4, hu2.I4, 1e-4);
            Assert.AreEqual(hu1.I5, hu2.I5, 1e-5);
            Assert.AreEqual(hu1.I6, hu2.I6, 1e-5);

            Assert.AreEqual(hu3.I1, hu4.I1, 1e-3);
            Assert.AreEqual(hu3.I2, hu4.I2, 1e-4);
            Assert.AreEqual(hu3.I3, hu4.I3, 1e-5);
            Assert.AreEqual(hu3.I4, hu4.I4, 1e-4);
            Assert.AreEqual(hu3.I5, hu4.I5, 1e-5);
            Assert.AreEqual(hu3.I6, hu4.I6, 1e-5);
        }
예제 #2
0
        public void ComputeTest()
        {
            var hu0 = new HuMoments(Resources.hu0);
            var hu1 = new HuMoments(Resources.hu1);

            Assert.AreEqual(hu0.I1 / hu1.I1, 1, 0.12);
            Assert.AreEqual(hu0.I2 / hu1.I2, 1, 0.5);
            Assert.AreEqual(hu0.I3 / hu1.I3, 1, 0.7);
        }
예제 #3
0
        public void ComputeTest()
        {
            var hu0 = new HuMoments(Accord.Imaging.Image.Clone(Resources.hu0));
            var hu1 = new HuMoments(Accord.Imaging.Image.Clone(Resources.hu1));

            Assert.AreEqual(hu0.I1 / hu1.I1, 1, 0.12);
            Assert.AreEqual(hu0.I2 / hu1.I2, 1, 0.5);
            Assert.AreEqual(hu0.I3 / hu1.I3, 1, 0.7);
        }