简单的斑点检测器

Simple Blob Detector

我正在尝试将 cv2.SimpleBlobDetector() 与此代码一起使用:

import cv2
import numpy as np

im = cv2.imread("owmla.png", cv2.IMREAD_GRAYSCALE)
detector = cv2.SimpleBlobDetector()
keypoints = detector.detect()
im_with_keypoints = cv2.drawKeypoints(im, keypoints, np.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
cv2.imshow("Keypoints", im_with_keypoints)
cv2.waitKey(0)

但是当我 运行 它时我得到错误:
来自 OpenCV 代码的未知 C++ 异常

尝试更改:

cv2.SimpleBlobDetector()cv2.SimpleBlobDetector_create()

并且不要忘记将 im 喂给

keypoints = detector.detect(im)

另见: How to fix cv2.error: Unknown C++ exception from OpenCV code?