内核在运行时死亡。探测器(openCV)

2024-04-20 12:18:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在通过Udemy学习openCV课程,遇到了内核即将崩溃的问题。我试着逐行消除,看看原因是什么,我发现当代码到达行时:keypoints=探测器(图像)它失败了。现在,我是一个业余爱好者,当谈到这类东西,但会感谢一些反馈,为什么这可能会发生。以下是我正在使用的代码:

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()```

Tags: ofthe代码imageimportsizeasnp