I'm trying to find the filled area of a contour mask. It just produces the same value for the 33 contours.
This is after thresholding a grayscale image to 0 and 255:
contours, hier = cv.findContours(green, cv.RETR_LIST, cv.CHAIN_APPROX_TC89_L1)
cv.drawContours(img_contours, contours, -1, (0,255,0), cv.FILLED)
cv.imwrite(filepath + imgname + '_green' + '_countours3' + imgtyp, img_contours)
contours, hier = cv.findContours(green, cv.RETR_LIST,cv.CHAIN_APPROX_TC89_L1)
cv.drawContours(img_contours, contours, -1, (0,255,0), cv.FILLED)
cv.imwrite(filepath + imgname + '_green' + '_countours3' + imgtyp, img_contours)
for contour in contours:
area = cv.contourArea(cnt)
print (area)
result:
33
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5
392.5