How to find outlines in an image in OpenCV?

I need to find all the contours in the image. I know all findcontours () and drawContours (), but using the Canny edge detector, which I'm having problems with. To use search paths, you need to either use the canny edge definition or a threshold image. I canโ€™t create an image threshold because it will blur several edges (merging the edges). So I decided to use Canny Edge detection. However, when I use it instead of getting perfect edges, I get a lot of lines with spaces in them. This does not allow me to get good contours. For example, instead of getting the edges of a square, I get four separate lines separated by small gaps, resulting in 4 contours instead of one. I tried to expand, open, close, Gaussian blur and basically every morphological operator, but not one of them does this job. Some do not merge strings, while some merge strings with non-essential strings. So I was wondering if anyone has a solution on how I can get the actual outlines from Canny Edge detection, or if someone has no alternatives to get all outlines from the image?

+4
source share
1 answer

make a blob, then the outlines go with it. :)

http://code.google.com/p/cvblob/

+1
source

Source: https://habr.com/ru/post/1383106/


All Articles