I try to find objects on image by MSER-detection from OpenCV. But function cvExtractMSER
return not contours, but set of points (CvSeq
), that create figure:
(1, 4), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3), (4, 4), ...
But I needs only points of contour:
(1, 4), (8, 4), (8, 1), (4, 1)
How I can find this contour?
I think, that simplest (but not fastest) way is:
findContours
for find contours on new imageOne of the options in findContours() is to pass a parameter that will remove all points except end points on a straight horizontal, vertical, or diagonal line. If you create an image and draw the points you've listed, then findContours() can do the rest of the work for you.
CV_CHAIN_APPROX_SIMPLE compresses horizontal, vertical, and diagonal segments and leaves only their end points. For example, an up-right rectangular contour is encoded with 4 points.
http://opencv.itseez.com/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=findcontours#findcontours
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With