4.22222

4.2 | 9 ratings Rate this file 115 Downloads (last 30 days) File Size: 31.9 KB File ID: #38900
image thumbnail

Zernike Moments

by

 

05 Nov 2012 (Updated )

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   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (29)
01 Jun 2014 fathi  
21 Apr 2014 fateme

Thank you

27 Nov 2013 Dimitris Tsolakidis

Hello Amir. Thank you for your code. I have used your code to calculate zernike moments from an image, but i'm having problem reconstruct the image from it's moments. Could you provide me some help please?

19 Sep 2013 mariem farhat

Another question:

1. your code assume that the image is square; and if it wasn't?

2. I don't understand Product = p(x,y).*Vnm? why not Product = p.*Vnm;

19 Sep 2013 mariem farhat

Thank you for the code.
But why in the image mapping you use (2.*X-N-1) and not (2.*X-N)?

Thank you!

19 Sep 2013 mariem farhat  
21 Aug 2013 MUTHU RAM

Actually want to find the global features with zernike moments of the image but dono how to proceed with it??

20 Aug 2013 MUTHU RAM

can Any one say how to find the Zernike moments for rgb image...Thanks in advance

09 Aug 2013 dana Wang

Hi Tahmasbi,
Thank you for your code. can u please hepl me to modify your code substituding p(x/a+x1,y/a+x2) to p(x,y),where p(x,y) is original image, x1 and x2 are the centroid of p(x,y),x1=m10/m00,x2=m01/m00,a=sqrt(β/m00),β is a predetermined value. In fact, this is doing scale and translation normalization. Thank you very much.

23 Jul 2013 Amir Tahmasbi

Hi Mitra,

1- It mainly depends on your application and you need some experience to pick the appropriate order (n) and repetition (m) for your moments. However, the rule of thumb is that the lower orders provide less information (details) but are more robust to noise. Higher orders, on the other hand, provide more information about the details of the object but are more sensitive to the measurement noise. An efficient way is to calculate the Zernike moments for a variety of m and n values. You may then apply a feature selection algorithm and remove the correlated features (moments). You can finally use a group of say 20 moments, which are reasonably uncorrelated, to pass to your classifier.

2- I think with appropriate preprocessing steps, the Zernike moments should be useful for Farsi digit recognition.

Regards,
Amir

18 Jul 2013 mitra Isaei

oh, excuse me. I understand my answer.
but I have other questions:
1.How do I understand What values are appropriate for Assignment to n and m?
I'm using zernike moment for handwritten farsi digits recognition.
2. Are features that obtain from Zernike moments, useful for classification in handwritten farsi digits recognition?

18 Jul 2013 mitra Isaei

hi sir
your code calculates one Zernike moment and its magnitude. how to change this code to calculate more Zernike moments.
thanks

11 Jul 2013 Amir Tahmasbi

Hi Shriniwas,

Yes, the code is capable of calculating the Zernike moments of any order and repetition. All you need to do is change m (repetition) and n (order). The default ones are n=4 and m=2. Hope this helps.

Cheers,
Amir

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 Al-Zubaidi

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