OpenCV无法绘制关键点

3

我尝试运行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) 的错误。最终它运行良好,但我想知道为什么只有这种方式可以运行而不是官方页面上所述的方式。

敬礼。


请阅读此处的内容"当有人回答我的问题时我该怎么做?" - thewaywewere
1个回答

1
这是 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,需要返回。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接