简体   繁体   English

Python opencv 3 SIFT功能提取

[英]Python opencv 3 SIFT feature extraction

I want to change the following two commands which are written in opencv 2.3 . 我想更改以下两个在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 在opencv 3中,我知道有一个创建SIFT的命令,因此

fea_det=cv2.xfeatures2d.SIFT_create()

But what should I use for des_ext ? 但是我应该对des_ext使用什么? I am asking that what is the equivalent code of " cv2.DescriptorExtractor_create("SIFT") " in opencv 3? 我在问opencv 3中“ cv2.DescriptorExtractor_create("SIFT") “的等效代码是什么?

FeatureDetector_create and DescriptorExtractor_create since OpenCV 3 were moved to xfeatures2d subdirectory. 从OpenCV 3开始,FeatureDetector_create和DescriptorExtractor_create已移动到xfeatures2d子目录。

>>> 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 . 本文中查找更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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