1 | initial version |
maybe you could look at opencv's bag of words implementation
you could do it like this:
Mat histogram(1, num_clusters, CV_32F, 0.0f);
// * extract brisk features from your image, then
// * match them to your kmedian clusters
for (each match)
histogram(matched_cluster_id) += 1;
normalize(histogram, histogram);
2 | No.2 Revision |
maybe you could look at opencv's bag of words implementation
you could do it like this:
// this will be one row of your traindata.
Mat histogram(1, num_clusters, CV_32F, 0.0f);
// * extract brisk features from your image, then
// * match them to your kmedian clusters
for (each match)
histogram(matched_cluster_id) += 1;
normalize(histogram, histogram);