c++字袋集群数组大小问题

c++ Bag Of Words Clustered Array Size Issue

本文关键字:问题 数组 c++      更新时间:2023-10-16

我正在尝试创建一个Bag Of Words程序,使用ORB作为我的detectorextractorBruteForce作为matcher

一切都很顺利。

但我担心的是,当我尝试对描述符数组进行聚类时,它会从中缩小

[32 x several thousand odd]

[32 x 1]

我也不太明白32是从哪里来的,这些程序目前只读取14张图像。

代码:

cout << " -- All Other Images Features Array Size: " << allImgFeaturesUnclustered.size();
BOWKMeansTrainer allImgBowTrainer(dictionarySize, termCrit, retries, flags);
Mat allImgDictionary = allImgBowTrainer.cluster(allImgFeaturesUnclustered);
BOWImgDescriptorExtractor allImgBowImgDesExtr(extractor,matcher);
allImgBowImgDesExtr.setVocabulary(allImgDictionary);
cout << " -- All Images Dictionary Size: " << allImgDictionary.size();

在最上面一行,当保留为原始大小时,对于所有图像中的所有描述符,Array显示为[32 x 6969]

在底线,在它们被集群后,阵列显示为[32 x 1]

我已经做了这只是一个图像,它仍然从[32 x 458][32 x 1]

这是对的吗?在过去的2-3周里,我一直在自学c++和OpenCV,所以如果这是正常的,我很抱歉。

在您的案例中,32似乎既是ORB的特征大小,也是dictionary size的特征大小。因此,如果您的特征大小是64,字典大小是16,那么您将看到[64 x 458][16 x 1]

请看一下这个。