Reputation: 754
I'm using Python 3.7.1 and OpenCV 4.0.0
I'm just testing FAST algorithm with various configurations, and I have problems with the drawKeypoints
function. In fact, I copied OPenCV tutorial code, just to realize that the function needs a third argument, the output image. After that, everything was working, and I commited to the repo.
Later on, I had to format my pc, and reinstall everything. Now, whenever I try to run that code, it complains about module 'cv2' has no attribute 'drawKeypoints'
. Here is the most basic code I had running after the format.
import numpy as np
import cv2
import sys
img = cv2.imread(sys.argv[1], 0)
fast = cv2.FastFeatureDetector_create()
kp = fast.detect(img,None)
img2 = cv2.drawKeypoints(img, kp, None, color=(255,0,0))
cv2.imshow('Original',img)
cv2.imshow('Detected',img2)
cv2.waitKey(0)
cv2.destroyAllWindows()
I've been looking, and I have no clue about what could be wrong with this code.
Upvotes: 0
Views: 1560
Reputation: 11420
It looks related to this bug which has a solution in the git repository (sources), but not necessarily is updated in the installation using pip. It was merged on Dec 11 2018, so for the time of this question it was probably not updated.
Maybe getting an updated wheel could solve the problem or you can build it yourself from sources. Here you can also see how this is generated (the one from pip install) and also offers you the tool to build your own opencv wheel.
Upvotes: 1