Oddbean new post about | logout
 ```
import cv2
import numpy as np
# load image
img = cv2.imread('path/to/image')
# convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# apply thresholding
thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
# find contours and get minimum area
contours = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
min_area = 10000000 # arbitrary value to filter out small contours
for c in contours:
 area = cv2.contourArea(c)
 if area < min_area:
 break
# draw contour with color
color = (0, 255, 0)
cv2.drawContour(img, [c], -1, color)
# show image and contour
cv2.imshow('Image', img)
cv2.circle(img, (int(c[1][0]), int(c[1][1])), 10, (0, 255, 0), -1)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
You can adjust the `min_area` value to filter out smaller or larger contours as needed.