Some of the functions in opencv3.x are changed:
1. SIFT: can use Help (cv2.xfeatures2d) query
2.drawKeypoints: Also use the Help () method to query
Opencv3 version Sift,surf and other unstable algorithmic functions are placed in the contrib version of opencv3.x. The module https://www.lfd.uci.edu/~gohlke/pythonlibs/
#Python 3.6.2 | Anacondaimport cv2 Import numpy as NP #read image img = cv2.imread (R ' test.jpg ', Cv2. Imread_color) Gray = Cv2.cvtcolor (img,cv2. Color_bgr2gray) cv2.imshow (' Origin ', img); #SIFT detector = cv2.xfeatures2d.SIFT_create () keypoints = Detector.detect (gray,none) cv2.drawkeypoints ( GRAY,KEYPOINTS,IMG) #img = cv2.drawkeypoints (gray,keypoints,flags = Cv2. draw_matches_flags_draw_rich_keypoints) cv2.imshow (' Test ', IMG); Cv2.waitkey (0) cv2.destroyallwindows ()
Sift image feature extraction python3.6 + opencv3.3 code