Crop/approximate contours

asked 2020-08-20 08:44:49 -0600

Bleach gravatar image

updated 2020-08-20 08:48:07 -0600

I have a contours like this: image description And I'm looking for a solution on how to cut the contours along the red line.

DoesOpenCV have a function for approximating contours that could do this?

I know that approxPolyDP not suitable for this.

Also I know that I can use for this opening morphological operation.

Also write if you know for sure that there is no such functionality in OpenCV, or you can advise the algorithm that can do it, or in general another library for work with contours.

Thanks.

edit retag flag offensive close merge delete

Comments

You can try taking a look into the Opening functionality (https://docs.opencv.org/trunk/d9/d61/...)

dbots94 gravatar imagedbots94 ( 2020-08-20 10:41:13 -0600 )edit

Thanks, but I look for contours (set of point) algo, not images.

Bleach gravatar imageBleach ( 2020-08-20 13:04:24 -0600 )edit

A few erodes followed by some dilates will coarsen the contour.

Der Luftmensch gravatar imageDer Luftmensch ( 2020-08-21 09:34:24 -0600 )edit

I can merely do on python by using mousevent and then draw and crop it. It will be easier to translated to c++

supra56 gravatar imagesupra56 ( 2020-08-21 21:00:12 -0600 )edit

@Der Luftmensch. Thanks. It named opening morphological operation. I mentioned about it. @supra56. Thanks, but no need. I'm looking for an algorithm to work with arrays of contour points.

Bleach gravatar imageBleach ( 2020-08-22 10:18:34 -0600 )edit