2017-08-08 166 views
0

我想改變下面兩個寫在opencv 2.3中的命令。Python opencv 3 SIFT特徵提取

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

OpenCV中3,我知道有是創建一個SIFT命令,所以

fea_det=cv2.xfeatures2d.SIFT_create() 

但我應該使用des_ext?我在問opencv 3中的「cv2.DescriptorExtractor_create("SIFT")」的等效代碼是什麼?

+1

首先[_google search_](https://www.google.com/search?q=opencv+3+sift+python&oq=opencv+3+sift+&aqs=chrome.0.0j69i60j69i57j0l3.3034j0j7&sourceid=chrome&ie=UTF- 8)。 SO並不是在搜索引擎網站上搜索這個文件的! –

回答

2

自OpenCV 3移至xfeatures2d子目錄後,FeatureDetector_create和DescriptorExtractor_create。

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

請在this article查看更多信息。

+0

如果答案對您有用,請將其標記爲正確 – Michael