opencv-python: Problem with cv2.drawKeypoints in version 4.0.0.21
system windows 10 msvc 2017 python 3.6.6
Hi,
It seems that some users have got some problem with drawKeypoints (http://answers.opencv.org/question/206950/function-drawkeypoints-do-not-work-in-opencv-401/ and http://answers.opencv.org/question/207758/drawkeypoints-bug/) using this code
import cv2
import numpy as np
def draw_keypoints(vis, keypoints, color = (0, 255, 255)):
for kp in keypoints:
x, y = kp.pt
cv2.circle(vis, (int(x), int(y), 2, color))
input_image = cv2.imread('lena.jpg')
if input_image is None:
print("check file path")
exit()
gray_image = cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)
orb = cv2.ORB_create()
keypoints = orb.detect(gray_image, None)
keypoints, descriptor = orb.compute(gray_image, keypoints)
t= cv2.drawKeypoints(input_image, keypoints, outImage=input_image, color=(0,255,0),
flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
cv2.imshow('ORB keypoints', input_image)
cv2.waitKey()
Error is AttributeError: module ‘cv2.cv2’ has no attribute ‘drawKeypoints’
If i use my own version opencv-python there is no problem. Something is wrong but what ?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (5 by maintainers)
Thanks for your work on
opencv-python
.I encounter the same issue.
In the meantime, I have worked around the issue by editing my code: I have replaced each call to
drawKeypoints()
with several calls todrawMarker()
.For instance, in the tutorial:
with:
This seems to be a bug in the binding generators in the upstream? You will have to wait that I have time to make a release for version 4.0.1 as it seems that the bug was fixed between 4.0.0 and 4.0.1 releases.
This issue should be fixed in 4.0.1 but unfortunately I cannot release 4.0.1 before macOS build issues have been solved.
Below code worked for me after modifying drawKeypoints as suggested by @woctezuma Thanks 👍
Hi, Is there any rough ETA on releasing 4.01 with the fix to this drawKeypoints issue? Like a week, a month, six months? Thanks for any guidance.
@wipix sorry, that’s my fault - I built the opencv-python packages on the RPi but I’ve been too swamped to finish 4.x recently. I’ll try and get the builders working on this next week but if you can’t wait that long you’ll just have to build it from source for now.
Do you know when 4.0.1 might be released? Thanks