Print histogram values for image in BOW
Hi.
I'm working on Bag of words program. I have extracted descriptors for each image via SiftFeatureDetector
and SiftDescriptorExtractor
into BOWKMeansTrainer
as follows:
featureDetector->detect(image, keypoints);
descriptorExtractor->compute(image, keypoints, descriptors);
bowTrainer.add(descriptors);
and runs BOWKMeansTrainer::cluster()
and BOWImgDescriptorExtractor::setVocabulary()
after. Then I want to see how does the histograms computed via BOWImgDescriptorExtractor
looks like for some of the images (reduced code):
bowDE->compute(image, keypoints, histogram);
for (int i = 0; i < histogram.cols; i++)
cout << histogram.at<unsigned>(0, i) << ",";
Result looks like:
{[0,997286537,988897929,1001720295,0,0,1014063753,0, ...]}
(rows=1, cols=count_of_visual_words) So there are either zeros or really huge numbers. Maybe I didn't understand something. How can I correctly print histogram values for given image?