Ask Your Question

Revision history [back]

This question was answered by Rotem on stackoverflow, view it here

I needed to invert my image to black background white foreground so that area could count the white pixels.

_, src_thresh = cv.threshold(src_gray, 0, 255, cv.THRESH_BINARY_INV + cv.THRESH_OTSU)
contours, _ = cv.findContours(src_thresh, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)