Ask Your Question

Revision history [back]

Compute moments for set of polygons

Hello

I am newbie to opencv. I want to identify the pattern inside a bounding box.

So to explain it clearly 1. I get a set of polygons from an API. 2. Now these polygons together will form a shape 3. I got to know that moments are used as pattern descriptors. So I used cv::Moments API to compute the same 4. Inputs to cv:Moments constructor is vector<point2f> points. For eg: a. I got 4 closed polygons from the API b. I iterate through the polygon vector and and for each polygon all its vertices are pushed to the vector<point2f> c Finally this point vector is passed to the cv::Moment constructor.

What I would like to know is whether this approach is correct.

All the examples that I see for moments are related to image and its moment computation, wherein here i am not dealing with images but raw polygons.

Also are Hu moments supposed to be used with only images and not vector data.

Request to guide me on the same.