findContours of vector<Point>

asked 2013-08-05 07:57:36 -0500

banonran gravatar image

updated 2013-08-05 08:02:34 -0500

Hello everyone,

I used MSER to get the regions of interest. The mser function in OpenCV provides the vector<vector<Point>> as output. The vector<Point> contains all points that belong to one entire region. I would like to find the contour of each region by using the function findContours(). This function requires Mat as input argument. My first attempt was to create a Mat with zero-values, than go through all points of one particular region and set the value of Mat at the corresponding coordinates to max value (255). After the points of one region were set in Mat, the findContours was run. However, the process of all regions in this way, take long time. Is there another way to find contours of each region? Smth like findContours(Mat(vector<Point>) does not work for me. Because Mat(vector<Point>) returns Mat with 2 channels. Thank you in advance.

edit retag flag offensive close merge delete

Comments

So you want to scan through each contour ?

Haris gravatar imageHaris ( 2013-08-05 08:01:59 -0500 )edit

Yes. Because I can not handle all regions at once. For example, to add all regions in one image and find contours in one image. Because some regions may overlap each other, Therefore, I can lose some information. So I need to go through each region separately.

banonran gravatar imagebanonran ( 2013-08-05 08:04:17 -0500 )edit