buy*_*pps 7 python ocr opencv object-detection
我需要检测图像上的半圆,我找到了以下内容:
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)
Run Code Online (Sandbox Code Playgroud)
但是当我尝试运行它时出现以下错误:
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
Run Code Online (Sandbox Code Playgroud)
图片: 点击
| 归档时间: |
|
| 查看次数: |
8245 次 |
| 最近记录: |