Ask Your Question
0

function "drawKeypoints" do not work in openCV 4.0.1

asked 2019-01-12 12:11:19 -0500

kurt_alex gravatar image

I want to use the drawKeypoints function in openCV 4.0.1, but Python writes an error:

AttributeError: module 'cv2.cv2' has no attribute 'drawKeypoints'

Maybe the latest version of openCV uses a different function, tell me if you know. Yes, in extreme cases, you can use version 2.4 in which this function is present, but I would like to use the latest version

edit retag flag offensive close merge delete

Comments

1

No I don't think so doc is here

Show us your code

LBerger gravatar imageLBerger ( 2019-01-12 12:26:45 -0500 )edit

cv2.drawKeypoints but not cv2.cv2.drawKeypoints

supra56 gravatar imagesupra56 ( 2019-01-12 12:48:23 -0500 )edit

I use it "cv2.drawKeypoints" example:

blank = np.zeros((1, 1))
blobs = cv2.drawKeypoints(image, keypoints, blank, (0, 0, 255),
                          cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
number_of_blobs = len(keypoints)
text = "Total Number of Blobs: " + str(len(keypoints))
cv2.putText(blobs, text, (20, 550), cv2.FONT_HERSHEY_SIMPLEX, 1, (100, 0, 255), 2)

And I don't now why pycharm show me this: "AttributeError: module 'cv2.cv2' has no attribute 'drawKeypoints'"

kurt_alex gravatar imagekurt_alex ( 2019-01-12 14:17:58 -0500 )edit

OIC, that you are using pycham. I suggested you attempt example from LBerger in below. Use named parameter for pycharm.

supra56 gravatar imagesupra56 ( 2019-01-12 22:05:26 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-01-12 15:18:15 -0500

LBerger gravatar image

updated 2019-01-12 15:19:07 -0500

Ok I can reproduce your error . Use named parameter :

t= cv2.drawKeypoints(image,p, outImage=blank, color=(0, 0, 255),
                          flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-01-12 12:11:19 -0500

Seen: 110 times

Last updated: Jan 12