简体   繁体   中英

Python opencv 3 SIFT feature extraction

I want to change the following two commands which are written in opencv 2.3 .

fea_det=cv2.FeatureDetector_create("SIFT")
des_ext=cv2.DescriptorExtractor_create("SIFT")

In opencv 3, I know that there is a command which create SIFT, so

fea_det=cv2.xfeatures2d.SIFT_create()

But what should I use for des_ext ? I am asking that what is the equivalent code of " cv2.DescriptorExtractor_create("SIFT") " in opencv 3?

FeatureDetector_create and DescriptorExtractor_create since OpenCV 3 were moved to xfeatures2d subdirectory.

>>> sift = cv2.xfeatures2d.SIFT_create()
>>> (kps, descs) = sift.detectAndCompute(gray, None)
>>> print("# kps: {}, descriptors: {}".format(len(kps), descs.shape))
# kps: 274, descriptors: (274, 128)

Take a look for more information at this article .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM