【问题标题】:Kernel dies when running .detector (openCV)运行 .detector (openCV) 时内核死机
【发布时间】:2021-03-14 01:32:34
【问题描述】:

我目前正在通过 Udemy 学习 openCV 课程,但遇到了内核死机的问题。我尝试逐行消除以查看可能的原因,我发现当代码到达该行时:keypoints =detector.detect(image) 它失败了。现在,当谈到这类事情时,我有点像一个业余爱好者,但希望得到一些关于为什么会发生这种情况的反馈。这是我正在使用的代码:

import cv2
import numpy as np;

# Read image
image = cv2.imread("images/Sunflowers.jpg")

# Set up the detector with default parameters.
detector = cv2.SimpleBlobDetector()

# Detect blobs.
keypoints = detector.detect(image)

# Draw detected blobs as red circles.
# cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS ensures the size of
# the circle corresponds to the size of blob
blank = np.zeros((1,1)) 
blobs = cv2.drawKeypoints(image, keypoints, blank, (0,255,255),
                                      cv2.DRAW_MATCHES_FLAGS_DEFAULT)

# Show keypoints
cv2.imshow("Blobs", blobs)
cv2.waitKey(0)
cv2.destroyAllWindows()```

【问题讨论】:

标签: python opencv kernel


【解决方案1】:

请替换:
detector = cv2.SimpleBlobDetector()
与:
detector = cv2.SimpleBlobDetector_create()

【讨论】:

  • 谢谢!这样一个被低估的答案。伟大的工作。
猜你喜欢
  • 1970-01-01
  • 2015-12-10
  • 1970-01-01
  • 1970-01-01
  • 2018-08-04
  • 2019-03-02
  • 2022-01-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多