我尝试在 openCV
页面中运行为 ORB
显示的示例代码。首先我得弄清楚cv2.ORB()
的问题(改成cv2.ORB_create()
,这个错误之后,出现了这个:
Traceback (most recent call last):
File "orb.py", line 17, in <module>
img2 =cv2.drawKeypoints(img,kp,color=(0,255,0), flags=0)
TypeError: Required argument 'outImage' (pos 3) not found
在做了很多博客和手册中显示的事情之后,我决定将 img
添加到此函数 img2 =cv2.drawKeypoints(img,kp,img,color=(0,255, 0), flags=0)
因为 pos (3)
错误。它终于运行良好,但我想知道为什么只这样运行,而不是官方页面所说的方式。
BR.
最佳答案
这是 cv2.drawKeypoints()
函数的语法,至少对于 OpenCV 3.x
是这样。
如果在 import cv2
之后执行 help(cv2.drawKeypoints)
,您将得到下面的内容,这是不言自明的。
Help on built-in function drawKeypoints:
drawKeypoints(...)
drawKeypoints(image, keypoints, outImage[, color[, flags]]) -> outImage
pos(3)
是要返回的输出图像 outImage
。
关于python - OpenCV 无法绘制关键点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44169826/