0

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
Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
Terra
  • 1
  • It's not clear what your actual question is? – ThrawnCA Jul 11 '19 at 23:30
  • The code says there is 33 contours but only give one area for all of them. I'm trying to obtain the unique area for each one through iteration or call functions. – Terra Jul 12 '19 at 16:36
  • I figured it out and just need to select and clip the smaller areas now. I love this community and thank you for all the support – Terra Jul 12 '19 at 17:40

0 Answers0