小编buy*_*pps的帖子

OpenCV SimpleBlobDetector detector() 调用抛出 cv2.error:OpenCV 代码中的未知 C++ 异常?

我需要检测图像上的半圆,我找到了以下内容:

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)

图片: 点击

python ocr opencv object-detection

7
推荐指数
1
解决办法
8245
查看次数

标签 统计

object-detection ×1

ocr ×1

opencv ×1

python ×1