Use the moment_invariant function for computing the seven invariant spatial moments for an image.
Invariant moments are features of an image that are unchanged under translation, rotation, or scaling of the image, and are very useful in pattern-recognition problems.
1. Define a simple image matrix, and then use the WRITEBMP function to save the image to a file.
(image_matrix.bmp)
2. Calculate the moments up to the second order, or the image center of mass.
3. Compute the central moments up to the third order.
4. Compute the normalized moments.
5. Calculate the first moment invariant.
6. Call the moment_invariant function and compare the results.
Geometric Transforms
1. Use the READ_IMAGE function to read in an image.
(flower.bmp)
2. Use the translate, rotate, and zoom functions to perform three types of geometric transforms on the image: translation, rotation, and scaling.
(flower_t.bmp)
(flower_r.bmp)
(flower_z.bmp)
3. Apply moment_invariant to the images and calculate the results.
The invariant moments are unchanged.
The above results are in reasonable agreement with the invariants computed from the original image. The small errors are due to zero-padding and pixel interpolation that take place in the transformations.
4. Change the transformation values and compare the moment invariants to the original ones.
The above results are also in reasonable agreement with the invariants computed from the original image.