20 std::string file_path =
"../../data/rgbd_dataset_freiburg2_desk/rgb.txt";
21 std::ifstream in(file_path);
22 std::string time_stamp, file_name;
25 std::cout <<
"Error opening file" << std::endl;
27 for (
int i = 0; i < 3; i++ )
29 std::string tmp1, tmp2, tmp3;
30 in >> tmp1 >> tmp2 >> tmp3;
34 Ptr<Feature2D> f2d = xfeatures2d::SIFT::create();
35 std::vector<KeyPoint> key_points;
39 TermCriteria tc(CV_TERMCRIT_ITER, 100, 0.001);
40 int dictionarySize = 100;
42 int flags = KMEANS_PP_CENTERS;
43 BOWKMeansTrainer bowTrainer(dictionarySize, tc, retries, flags);
51 in >> time_stamp >> file_name;
55 in >> time_stamp >> file_name;
56 std::string pre_path =
"../../data/rgbd_dataset_freiburg2_desk/";
57 file_name = pre_path+file_name;
58 img = imread(file_name);
59 f2d->detect(img, key_points);
60 f2d->compute(img, key_points, descriptor);
61 bowTrainer.add(descriptor);
65 dictionary = bowTrainer.cluster();