Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv.findContours is connecting unconnected regions

Original image:

image description

Code:

contours, hierarchy = cv.findContours(blobs, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)
cv.drawContours(blobs, contours, -1, (0,255,0), 2)

Result:

image description

Why unconnected regions become part of the same contour, as in the example above? Is this the expected behaviour? What can I do to obtain separate contours for these regions?