Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

drawContours error: (-215) npoints > 0 in function drawContours

here's my code

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
labelNum, labelImg, contours, GoCs = cv2.connectedComponentsWithStats(gray)

    for c in contours:
        x,y,w,h,size = c
        if size <= 100:
            cv2.drawContours(image, [c], 0, 0)

drawContours error: (-215) npoints > 0 in function drawContours

here's my code

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
labelNum, labelImg, contours, GoCs = cv2.connectedComponentsWithStats(gray)

    for c in contours:
        x,y,w,h,size = c
        if size <= 100:
            cv2.drawContours(image, [c], 0, 0)