群集(Mat)功能花费的时间太长(opencv)

时间:2020-06-26 14:22:53

标签: c++ opencv

我正在尝试使用BOWKMeansTrainer类制作字典:我有63张图像用于不同大小的训练,但平均大小约为700x900像素。函数cluster(...)实际上要花费很多时间,已经运行了5个小时。您认为我还要等多少?有没有办法使其更快?

TermCriteria tc(1, 100, 0.001); //term criteria type, 100 iterations with 0.001 accuracy
int retries = 1;
int flags = KMEANS_PP_CENTERS;
printf("Kmeans Clustering descriptors \n");
BOWKMeansTrainer bowTrainer(dictSize, tc, retries, flags); //create a Trainer
Mat myDictionary = bowTrainer.cluster(newFeatures); //start clustering
printf("dictionary rows = %d  cols = %d\n", myDictionary.rows, myDictionary.cols);
FileStorage fs("myDictionary.yml", FileStorage::WRITE); //store dictionary in a file
fs << "vocabulary" << myDictionary;
fs.release();

0 个答案:

没有答案