4.8

4.8 | 5 ratings Rate this file 133 Downloads (last 30 days) File Size: 31.9 KB File ID: #38900
image thumbnail

Zernike Moments

by Amir Tahmasbi

 

05 Nov 2012 (Updated 31 May 2013)

MATLAB Code for the Fast Calculation of Zernike Moments of order n and repetition m on NxN images.

| Watch this File

File Information
Description

This submission includes 3 mfiles and 6 image files:

1- Zernike_main.m (The main script that takes care of everything)
2- Zernikmoment.m (Calculates the Zernike moments for an NxN ROI)
3- radialpoly.m (Calculates the radial polynomials which are prerequisites for calculating Zernike moments)
4- Six .png files to test the code.

When you run the Zernike_main.m, it will calculate the Zernike moments of order n=4 and repetition m=2 for the input images. Since the first row images are just the rotated versions of a unique object (oval), the magnitudes of the Zernike moments for these three images are the same. In addition, the differences between the phases of the moments are proportional to the rotation angles of the images. Expectedly, the Zernike moments of two different shapes (e.g. oval and rectangle) are totally different. The reason of this behavior is the ability of Zernike moments in describing the shape of objects.

Required Products MATLAB
MATLAB release MATLAB 7.11 (R2010b)
Tags for This File  
Everyone's Tags
image processing(3), mathematics, physics, signal processing
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
02 Jul 2013 Shriniwas Chavan

Sir I am using zernike moment for handwritten character recognition, I have applied zernike moment in terms of geometric moment, but it is upto 3 and 4 order, i want to extend the code can your files can extend it or extract zernike moment

16 Jun 2013 Reyadh

Hi Amir
thanks for replay
I know what you say
now almost I have identification for some plamprints
I used high zernike order
and better database
also i maked unit disk for pic
I will make some addition and see what happen
Thanks you

13 Jun 2013 Amir Tahmasbi

Hi Reyadh,

In principle, the Zernike moments can be extracted from any shape. However, in your case, there could be a variety of potential issues. First of all, you need to make sure the objects (palm prints) are of equal size within the ROI. If not, you need to equalize the size of your objects in all ROIs.

The other thing is that the palm prints are more complicated object than simple shapes, e.g. oval and circle. Thus, you might need to extract a set of higher order Zernike moments. You can then use these moments to classify the palm prints of different people more reliably.

FYI, the magnitude of the Zernike moments of two similar shapes might be slightly vary due to the pixelation and noise. But the difference should be insignificant.

Cheers

08 Jun 2013 Reyadh  
08 Jun 2013 Reyadh

hello Tamanna
I used your zernike to find zernike moment for palmprint
but there are some problem
when use for that A=0,Theta=0
I make some changed to the code
I replaced p = logical(not(p));
to p=im2double(p);
and it is work after that with palmprint and your pics nad values equal with yours
but the problem the values does not equal for same person palmprint
any help?
thanks

04 May 2013 Amir Tahmasbi

Hi Tareq

Thanks! The input arguments "m" and "n" are scalars. This means that if you would like to extract say 32 moments, you need to have a "for loop" in which you change "n" and "m", and call the Zernikemoment(p, n, m). Depending on your application you can either change "n" from y to 32+y or use different combinations of "m" and "n". For more information, see Table 1 in page 731 of this article:

http://www.utdallas.edu/~a.tahmasbi/publications/Zernike_CBM_2011.pdf

Hope this helps.

30 Apr 2013 Frb  
30 Apr 2013 Tareq

nice job,,, one question, if we say 32 moments so i expect when I call [ZOH AOH PhiOH] = Zernikmoment(p,n,m);

the ZOH to be an array of 32 ? or what 32 moments mean here ?

15 Apr 2013 Amir Tahmasbi

Hi Tamanna,

The Zernike moments are rotation-invariant, no question on it! So, if you use the sample pictures included in the package, you will see this feature.

The reason that you are getting different results for the abs of Zernike moments is explained as follows. The MATLAB function "imrotate" does not preserve the size of an object in the ROI. Please note that the ROI size will be the same but the original image will be shrank in the new ROI. Thus, you are changing the object size that alters the abs of the Zernike moments. Hope this helps.

Regards,
Amir

10 Apr 2013 tamanna

hey..can u please help me to identify that how this code is invariant to rotation..

because if i apply 'imrotate' with 30 or 45 degree on an image, then the result is different.

02 Apr 2013 Amir Tahmasbi

Hi Anandh,

Yes, that is correct. By changing 'n' you can change the order of the Zernike moments to generate a set of say 32 features. However, you should keep in mind that also the variable 'm' (i.e. the repetition of moments) plays an important rule in the behavior of the moments. Hence, 'm' should be selected adaptively by changing 'n'. To find a suitable repetition for your proposed order, please see:

http://www.utdallas.edu/~a.tahmasbi/publications/Zernike_CBM_2011.pdf

Hope this helps! Let me know if you have any other concerns.

Regards,
Amir

02 Apr 2013 Anandh

Hi Amir,

Am new to this Zernike Moments. I tried to understand your code. I have few doubts. How to find 32 order features for a given image? Is it by varying the number 'n'? Please reply.

21 Dec 2012 Cobi Biton  
15 Nov 2012 Amir Tahmasbi

Thanks guys! Chris: I refer you to one of our papers in which we normalize the ROIs before extracting the Zernike moments (i.e. we remove the dependency of Zernike moments on the translation and scaling of object in the preprocessing step). Here it is:

http://www.utdallas.edu/~a.tahmasbi/publications/Zernike_CBM_2011.pdf

Another way is to use the Zernike moment invariants explained nicely here:

http://www.sciencedirect.com/science/article/pii/S0031320302003539

14 Nov 2012 Chris

Good job!And, how is the zernike moment invariants

06 Nov 2012 Fatemeh Saki

Nice job!! Thank you so much.

Updates
02 Jan 2013

Removed several minor mistakes in the description of the file.

21 Jan 2013

Rephrased the summary for clarity.

31 May 2013

Added more sample shapes with different rotation angles.

Contact us