Closing a contour curve in OpenCV

前端 未结 2 1736
無奈伤痛
無奈伤痛 2020-12-31 08:45

I\'m using OpenCV (Canny + findCountours) to find external contours of objects. The curve drawn is typically almost, but not entirely, closed. I\'d like to close it - to f

2条回答
  •  太阳男子
    2020-12-31 09:26

    A little late, but I just had to deal with this myself. If you perform an opening operation (erosion followed by dilation) prior to the Canny edge detection, the edges you detect should be more continuous, resulting in better contours. This method appears to be fairly robust. I mentioned this in another post and posted a code sample as part of a recent question.

提交回复
热议问题