I am trying to find/calculate the contour area in the next image:
The goal is to delete all the dots you can see in image, so the blobs contoured with an area smaller than a value I give.
How can I set this ?
This is the code I used...
import cv2
im = cv2.imread('source.png')
imgray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(imgray,127,255,0)
image, contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
img = cv2.drawContours(im, contours, -1, (0,255,0), 1)
cv2.imshow('contour',img)
cv2.waitKey(0)
cv2.imwrite('contour.png',img)
...and this is the source image:
Thank you


