SimpleBlobDetector 无法识别更明显的圆圈
SimpleBlobDetector not recognizing the more obvious circles
我正在使用具有以下指定参数的 SimpleBlobDetector:
# Parameters
params = cv2.SimpleBlobDetector_Params()
params.filterByArea = True
params.minArea = 1500
params.filterByCircularity = True
params.minCircularity = 0.5
params.filterByConvexity = True
params.minConvexity = 0.9
params.filterByInertia = True
params.minInertiaRatio = 0.7
params.minDistBetweenBlobs = 10
params.filterByColor = False
# Create a detector with the parameters
detector = cv2.SimpleBlobDetector(params)
keypoints = detector.detect(dilated)
im_with_keypoints = cv2.drawKeypoints(dilated, keypoints, np.array([]), (0, 0, 255),cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
# Display result
cv2.imshow("Keypoints", im_with_keypoints)
这将产生以下结果。如您所见,未检测到某些 'cleaner' 圆,而检测到边缘较粗糙的其他圆。请问可能是什么问题?
如果你添加
params.maxArea = 10000
你得到这张图片:
所以我假设有一个默认的最大值,而你超过了它。
我正在使用具有以下指定参数的 SimpleBlobDetector:
# Parameters
params = cv2.SimpleBlobDetector_Params()
params.filterByArea = True
params.minArea = 1500
params.filterByCircularity = True
params.minCircularity = 0.5
params.filterByConvexity = True
params.minConvexity = 0.9
params.filterByInertia = True
params.minInertiaRatio = 0.7
params.minDistBetweenBlobs = 10
params.filterByColor = False
# Create a detector with the parameters
detector = cv2.SimpleBlobDetector(params)
keypoints = detector.detect(dilated)
im_with_keypoints = cv2.drawKeypoints(dilated, keypoints, np.array([]), (0, 0, 255),cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
# Display result
cv2.imshow("Keypoints", im_with_keypoints)
这将产生以下结果。如您所见,未检测到某些 'cleaner' 圆,而检测到边缘较粗糙的其他圆。请问可能是什么问题?
如果你添加
params.maxArea = 10000
你得到这张图片:
所以我假设有一个默认的最大值,而你超过了它。