Mga Pahina

Martes, Setyembre 1, 2015

Moment Invariants as a tool in pattern recognition and understanding images

An image moment can be thought of as a weighted average of intensities in image pixels[1]. Just like moments defined in mathematics, it gives us an idea on the shape of a set of points, so that when image moments are known, the corresponding information about the orientation, centroid, and area is also obtained.

For a given digital image $f(x,y)$, the 2D raw moment is defined as:
$$ m_{pq} = \sum_{x=0}^{M-1} \sum_{y=0}^{N-1} x^p y^q f(x,y) $$
where p and q are real valued integers. Alternatively, we can also get the central moments by using the following relation:
$$\mu_{pq} = \sum_{x=0}^{M-1}\sum_{y=0}^{N-1} (x-\overline{x})^p (y-\overline{y})^q f(x,y) $$
where
$$\overline{x} = \frac{m_{10}}{m_{00}} $$ $$\overline{y} = \frac{m_{01}}{m_{00}}$$
From here, we can obtain the normalized central moments by solving for $\eta_{pq}$ defined as
$$\eta_{pq} = \frac{\mu_{pq}}{\mu_{00}^\gamma}$$
for $$\gamma = \frac{p+q}{2} +1 $$ where $$p+q = 2,3...$$

Using Hu's Uniqueness theorem which states that if $f(x,y)$ is a continuous piecewise function and has nonzero values only on the finite part of xy-plane, all moments of different orders exists. It also follows that the moments $m_{pq}$ are uniquely determined from $f(x,y)$, and conversely, we can obtain $f(x,y)$ from the information in the moments $m_{pq}$[2].

In Hu's paper published back in 1962, he enumerated a set of seven moments that are invariant to translation, scale change, mirroring (within a minus sign) and rotation. In this activity, the goal is to calculate for these moments using the following set of images:
1. Grayscale Image
2. Synthetic Edge Image (synthetically generated)
3. Edge Image of a real object
We generate each of these images, and their corresponding rescaled and rotated versions. In total, we should have 9 images. The moments of each of these images are to be computed and are then eventually compared to one another.

We start by showing the following set of images that I generated:

Figure 1. Synthetic images (a) original (b) rotated and (c) scaled down, which are generated for analysis of Hu's invariant moments.


Figure 2. Edges of a real image for (a) original (b) rotated and (scaled down). The image of Bingbong from the movie Inside Out is obtained from google images [3]

Figure 3. Gray images of a cup (a) original (b) rotated and (c) scaled. Image is taken from google images

After generating the images, I applied the program which computes for the corresponding normalized central moments (all seven of Hu's invariant moments, $\phi_1$, $\phi_2$, $\phi_3$, $\phi_4$, $\phi_5$, $\phi_6$, $\phi_7$)

I got the following results:

Table 1. Hu’s invariant moments for real image edge
Moments
Original
Rotated
Rescaled (0.5x)
ϕ1
2.8469
2.8465
2.8469
ϕ2
4.0568
4.0559
4.0568
ϕ3
4.9024
4.8953
4.9024
ϕ4
4.6394
4.6449
4.6394
ϕ5
9.3788
9.3821
9.3788
ϕ6
5.9112
5.929
5.9112
ϕ7
8.3275
8.0973
8.3275


Table 2. Hu’s invariant moments for grayscale image
Moments
Original
Rotated
Rescaled (0.5x)
ϕ1
-6.8124
-6.8124
-6.8125
ϕ2
-21.6559
-21.6559
-21.6559
ϕ3
-26.54
-26.54
-26.54
ϕ4
-26.021
-26.021
-26.0213
ϕ5
-54.504
-54.504
-54.5046
ϕ6
-37.0249
-37.0249
-37.0252
ϕ7
-27.5753
-25.2761
-27.5758




Table 3. Hu’s invariant moments for synthetic image
Moments
Original
Rotated
Rescaled (0.5x)
ϕ1
2.1266
2.1196
2.1266
ϕ2
-11.698
-11.7406
-11.698
ϕ3
-7.8382
-7.8438
-7.8382
ϕ4
-7.7756
-7.6766
-7.7756
ϕ5
-17.3893
-16.7467
-17.3892
ϕ6
-16.1036
-14.7318
-16.1036
ϕ7
-8.8509
-6.5823
-8.8509
The tables above show the corresponding Hu's moments that are seen to be invariant to scaled and rotated images. Notice that for real image edge, the moments are positive, while the rest are negative. Although almost all of the computed  Hu's moments in each of the transformations are observed to be invariant with minimal difference in their values, the 6th and 7th moments differ a little for the rotated transformation.

Another related independent basis set is presented by Flusser, Suk and Zitová [3]. In this work, they identified only 6 invariants and identified which of the 7 Hu's moments is actually dependent.

The following table shows the Flusser-Suk moment invariants for the synthetic edge image.

Table 4. Flusser -Suk moment invariants for synthetic edge image.


[1] Image moment. Wikipedia. Retrieved September 1 2015.

[2] M.-K. Hu. Visual pattern recognition by moment invariants, IRE Trans. on Information Theory, 8(2):179-187, 1962.

[3] J. Flusser, T. Suk, B. Zitová. Moment and Moment Invariants in Pattern Recognition. John Wiley and Sons, 2009.


Walang komento:

Mag-post ng isang Komento