Hi guys,
i'm trying to implement my Bag of words with my own descriptor. I already did the kmeans part and it works perfectly. Now my question is which function in open CV I have to use to build the histogram and complete the training part of the code.
Consider that I used this code to compute the vocabulary:
Mat ComputeDictionary (Mat& features, const int K) {
int retries = 3;
int flags = KMEANS_PP_CENTERS;
Mat bestlabels, centers;
// K-Means function call
kmeans(features, K, bestlabels, TermCriteria( TermCriteria::EPS+TermCriteria::COUNT,100,0.001), retries, flags, centers);
return centers;
}
Consider that my "features" matrix is a matrix with "number of samples * number of descriptors per sample " rows and "descriptor dimension" columns.
Now, I don't know how to proceed (I know the theory but I don't now how to implement it in c++)...could you please help me?