Wur*_*rmD 4 python opencv orb visual-studio-code
ORB 演示代码位于https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_feature2d/py_orb/py_orb.html
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()
Run Code Online (Sandbox Code Playgroud)
在kp = orb.detect(img,None)
[WinError 10054] An existing connection was forcibly closed by the remote hostcv2.error: Unknown C++ exception from OpenCV code笔记:
kp = orb.detect(img,None)并在调试器中运行该行时,才会出现错误[WinError 10054] An existing connection was forcibly closed by the remote hostcv2.error: Unknown C++ exception from OpenCV code环境: Windows 10、Python 3.6、VSCode
有人有线索吗?
该教程已经过时了。
更新版本现在位于 OpenCV 网站本身:https ://docs.opencv.org/master/d1/d89/tutorial_py_orb.html
正如评论中提到的,其中指出初始化应该通过以下方式完成orb = cv.ORB_create():
import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('simple.jpg',0)
# Initiate ORB detector
orb = cv.ORB_create()
# 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 = cv.drawKeypoints(img, kp, None, color=(0,255,0), flags=0)
plt.imshow(img2), plt.show()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15666 次 |
| 最近记录: |