Drawing an outline based on outside contour

asked 2016-10-03 03:29:51 -0600

inac gravatar image

updated 2016-10-09 18:11:30 -0600

How does one draw an outline based on the outside edge of a contour?

I've tried drawContours, but that seems to only draw the contours on an existing image - but how does one simply extract the outside contours and draw only the contour onto a new mat/image?

edit retag flag offensive close merge delete


How about taking a decent look at documentation and clicking drawContours ... next time, please read the FAQ before posting ...

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-03 08:39:55 -0600 )edit

I've tried drawContour but it seems to only draw the contour around the image. i'm trying to draw just the outside contour - also updated question. thanks for pointing out that it's not clear - i am not very good at asking questions sometimes

inac gravatar imageinac ( 2016-10-09 18:08:51 -0600 )edit

@inac if only the contour around the image is drawn, then it means you have a border which should be removed. This issue has been discussed many times before... it is due to findContours detecting the largest contour

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-10 03:34:18 -0600 )edit