目标是检测大圆圈内的小圆圈。
目前我所做的是将图像转换为灰度并应用阈值(cv2.THRESH_OTSU),从而生成此图像

在此之后,我使用我在 stackoverflow 上找到的椭圆形内核使用 findcontours 应用 Morph open 过滤掉了大对象
有人可以指导我通过正确的路径做什么以及我在哪里出错。
下面是我一直在处理的附加代码
import cv2
import numpy as np
# Load image, grayscale, Otsu's threshold
image = cv2.imread('01.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
#cv2.imwrite('thresh.jpg', thresh)
# Filter out large non-connecting objects
cnts = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = cnts[0] if len(cnts) == 2 else cnts[1]
for c in cnts:
area = cv2.contourArea(c)
#print(area)
if area < 200 and area > 0:
cv2.drawContours(thresh,[c],0,0,-1) …Run Code Online (Sandbox Code Playgroud) python opencv image-processing computer-vision opencv-contour