Ask Your Question
0

How to calculate the Affine Moment Invariants of a binary image

asked 2013-05-23 07:41:15 -0600

Heshan Sandeepa gravatar image

updated 2013-05-24 00:23:46 -0600

I have involved with OCR application. There i have selected image invariants moments as a feature for classification. It is mentioned that Affine Moment Invariants can be use to make the feature vector more rich and robust. I am trying to find a way to calculate Affine Moment Invariants, but still not able to do that. Does OpenCV provide a method for that ? if not can anyone give me a suggestion about how to do that ?

thank you

edit retag flag offensive close merge delete

Comments

I have a question please , we calculate the affine moment invariant for all the image or for each pixel ?

Jawaher Khemakhem gravatar imageJawaher Khemakhem ( 2013-05-29 14:42:53 -0600 )edit

here i have calculated for whole image, not for each pixel.

Heshan Sandeepa gravatar imageHeshan Sandeepa ( 2013-05-29 14:47:22 -0600 )edit

Can we calculate it for each pixel ?

Jawaher Khemakhem gravatar imageJawaher Khemakhem ( 2013-05-29 14:50:39 -0600 )edit

i am not sure about each pixel, but it can be calculate for each contour of a particular image.

Heshan Sandeepa gravatar imageHeshan Sandeepa ( 2013-05-29 14:59:51 -0600 )edit

thanks a lot , I feel a little bit confused about Affine Moment Invariants .

Jawaher Khemakhem gravatar imageJawaher Khemakhem ( 2013-05-29 15:02:04 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-05-29 13:11:41 -0600

Heshan Sandeepa gravatar image

i found some formulas, plz correct me , if i am wrong. And also comment here anything regarding to these formulas. I am using visual c++ and opencv in vs2010. i found formulas for first 4 affine invariant moments. .

lf_I1 = (im_moments->mu20 * im_moments->mu02 - pow(im_moments->mu11,2)) / pow(im_moments->m00,4);

lf_I2 = (-(pow(im_moments->mu30,2)) * (pow(im_moments->mu30,2)) + 6 * im_moments->mu30 im_moments->mu21 * im_moments->mu03 - 4*im_moments->mu30*(pow(im_moments->mu12,3))) / (pow(im_moments->m00,10));

lf_I3 = (im_moments->mu20 * im_moments->mu21 * im_moments->mu03 - im_moments->mu20 * pow(im_moments->mu12,2) - im_moments->mu11  * im_moments->mu30 * im_moments->mu03 + im_moments->mu11 * im_moments->mu21 * im_moments->mu12 + im_moments->mu02  * im_moments->mu30 * im_moments->mu12 - im_moments->mu02 * pow(im_moments->mu21,2)) / pow(im_moments->m00,7);

lf_I4 = (-pow(im_moments->mu20,3) * pow(im_moments->mu03,2) + 6 * pow(im_moments->mu20,2) * im_moments->mu11 * im_moments->mu12 * im_moments->mu03 -3 * pow(im_moments->mu20,2) * im_moments->mu02 * pow(im_moments->mu12,2) - 6 * im_moments->mu20 * pow(im_moments->mu11,2) * im_moments->mu21 * im_moments->mu03 - 6 * im_moments->mu20 * pow(im_moments->mu11,2) * pow(im_moments->mu12,2) + 12 * im_moments->mu20 * im_moments->mu11 * im_moments->mu02 * im_moments->mu21 * im_moments->mu12 - 3 * im_moments->mu20 * pow(im_moments->mu02,2) * pow(im_moments->mu21,2) + 2 * pow(im_moments->mu11,3) * im_moments->mu30 * im_moments->mu03 + 6 * pow(im_moments->mu11,3) * im_moments->mu21 * im_moments->mu12 - 6 * pow(im_moments->mu11,2) * im_moments->mu02 * im_moments->mu30 * im_moments->mu12 - 6 * pow(im_moments->mu11,2) * im_moments->mu02 * pow(im_moments->mu21,2) + 6 * im_moments->mu11 * pow(im_moments->mu02,2) * im_moments->mu30 * im_moments->mu21 - 1 * pow(im_moments->mu02,3) * pow(im_moments->mu30,2)) / pow(im_moments->m00,11);
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-05-23 07:41:15 -0600

Seen: 571 times

Last updated: May 29 '13