简体   繁体   English

带单词袋的ORB FeatureDetector

[英]ORB FeatureDetector with Bag Of Words

BOWImgDescriptorExtractor has to receive 32F so SURF or SIFT have to be used for the DescriptorExtractor , but for the FeatureDetector surely that can be any you wish, right? BOWImgDescriptorExtractor必须接收32F,因此必须将SURFSIFT用于DescriptorExtractor ,但是对于FeatureDetector ,可以肯定是您想要的,对吗?

I just need some clarification here, I've only ever seen people say that "You can't use ORB with Bow " but when detecting the features, why would it matter which you use? 我在这里只需要澄清一下,我只见过有人说“您不能将ORBBow一起使用”,但是当检测到这些功能时,为什么使用哪个重要呢?

I wouldn't think it's matter. 我认为没关系。 You can use arbitrary methods for feature point detection (ie ORB, FAST, SIFT, SURF, etc.). 您可以使用任意方法进行特征点检测(例如,ORB,FAST,SIFT,SURF等)。

The problem may come from the next step, from feature point description, for the reasons stated by Guanta in their answer here : 该问题可能来自下一步,即功能点描述,这是因为Guanta在其此处的回答中指出的原因:

The link you posted, gives one possibilty to solve the issue of binary descriptors by simple conversion to float (CV_32F) and relies on the fact that OpenCV's k-means algorithm can only deal with CV_32F and uses L2-distance for comparison. 您发布的链接为通过简单转换为浮点(CV_32F)来解决二进制描述符的问题提供了一种可能性,并依赖于OpenCV的k均值算法只能处理CV_32F并使用L2距离进行比较这一事实。 Thus, the binary descriptors may however also cluster in a wrong way (since actually you want to have a Hamming distance measure)! 因此,二进制描述符也可能以错误的方式聚类(因为实际上您想使用汉明距离度量)!

That's why it's recommended to use of SIFT/SURF descriptors. 这就是为什么建议使用SIFT / SURF描述符的原因。 But apart from it, you can mix the different kind of feature point detectors with different kind of descriptors. 但是除此之外,您可以将不同种类的特征点检测器与不同种类的描述符混合使用。

Roughly, the pseudo-code associated with your title's question would be : 大致来说,与标题问题相关的伪代码为:

# Construct vocabulary
bow_trainer = cv2.BOWKMeansTrainer(50)
bow_trainer.add(np.float32(descriptors))
vocab = bow_trainer.cluster().astype(descriptor.dtype)

# Create an object for computing global image BoW descriptors
bow_descr = cv2.BOWImgDescriptorExtractor(ORBdetector, CV2.BFMatcher(CV.NORM_HAMMING))
bow_descr.setVocabulary(vocab)

# Load an image, find keypoints, compute global image descriptor
img = cv2.imread("PathtoImage", ...)
keypoints = detector.detect(img,None)
description = bow_descr.compute(img, kps)

# Visualization
plt.figure( ...)

# Distance calculation (assuming you have two histograms, stored each in the "description" variable)
dist = 1 - cv2.compareHist(pic1.description, pic2.description, cv2.HISTCMP_CORREL)

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

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