【发布时间】:2021-05-13 21:36:16
【问题描述】:
https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_feature2d/py_orb/py_orb.html上的 ORB 演示代码
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread('simple.jpg',0)
# Initiate STAR detector
orb = cv2.ORB()
# find the keypoints with ORB
kp = orb.detect(img,None)
# compute the descriptors with ORB
kp, des = orb.compute(img, kp)
# draw only keypoints location,not size and orientation
img2 = cv2.drawKeypoints(img,kp,color=(0,255,0), flags=0)
plt.imshow(img2),plt.show()
kp = orb.detect(img,None)
- 在 Python3.6 中出现
[WinError 10054] An existing connection was forcibly closed by the remote host错误 - 在 Python3.8 中出现
cv2.error: Unknown C++ exception from OpenCV code错误
注意:
- 在 Python 3.6 中,在终端中运行或在调试器中运行,只会退出脚本而不会出错。只有在调试器中停在
kp = orb.detect(img,None)并在调试器中运行该行时才会出现错误[WinError 10054] An existing connection was forcibly closed by the remote host - 在 Python 3.8 中,在终端或调试器中运行会出现错误
cv2.error: Unknown C++ exception from OpenCV code
环境:Windows 10、Python 3.6、VSCode
有人知道吗?
【问题讨论】:
-
当我使用 ORB 时,我使用 cv2.ORB_create() 启动它
标签: python opencv visual-studio-code orb