【发布时间】:2021-10-28 01:51:27
【问题描述】:
我需要检测图像上的半圆,并为此找到以下内容:
import cv2
import numpy as np
def get_circle(img_path):
im = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
detector = cv2.SimpleBlobDetector()
keypoints = detector.detect(im)
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)
但是当我尝试运行它时出现以下错误:
Traceback (most recent call last):
File "D:\giveaway_bot\main.py", line 16, in <module>
get_circle("blob.png")
File "D:\giveaway_bot\main.py", line 11, in get_circle
keypoints = detector.detect(im)
cv2.error: Unknown C++ exception from OpenCV code
图片: click
【问题讨论】:
-
我认为Hough circles 也会找到半圆。
标签: python ocr object-detection opencv-python