Understanding Moments Function in Opencv

When finding the center coordinates using moments in OpenCV,the point is found using

Point(moment[i].m10/moment[i].m00,moment[i].m01/moment[i].m00);

Can somebody please explain this bit to me?What do "m10","m00","m01" and "m00" mean??

2

1 Answer

Definition of moments in image processing is borrowed from physics. Assume that each pixel in image has weight that is equal to its intensity. Then the point you defined is centroid (a.k.a. center of mass) of image.

Assume that I(x,y) is the intensity of pixel (x,y) in image. Then m(i,j) is the sum for all possible x and y of: I(x,y) * (x^i) * (y^j).

Here you can read the documentation of moments used in OpenCV. They are called raw moments.

And here you can read a wiki article about all kinds of image moments (raw moments, central moments, scale/rotation invariant moments and so on). It is pretty good one and I recommend reading it.

6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest