OpenCV can't draw keypoints

落花浮王杯 提交于 2021-01-28 04:02:34

问题


I tried to run the example code shown for ORB in the openCV page. First I had to figure out the problem of cv2.ORB() (changed to cv2.ORB_create(), the after this error, appeared this:

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

After doing a lot of things shown in blogs and manuals, I decided to add img to this function img2 =cv2.drawKeypoints(img,kp,img,color=(0,255,0), flags=0) because of the error in pos (3). It finally worked good, but I'd like to know why only runs like this and no the way the official page states.

BR.


回答1:


It's the syntax of the cv2.drawKeypoints() function, at least for OpenCV 3.x.

If you execute help(cv2.drawKeypoints) after import cv2, you will get below which is self-explanatory.

Help on built-in function drawKeypoints:

drawKeypoints(...)
    drawKeypoints(image, keypoints, outImage[, color[, flags]]) -> outImage

The pos(3) is the output image, outImage, to be returned.



来源:https://stackoverflow.com/questions/44169826/opencv-cant-draw-keypoints

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!