1 | initial version |
though i think, you're on the wrong path with the purpose of it, there are ways to speed up feature matching
// 1. profile, don't guess !
int64 t0 = getTickCount();
some_operation(input, output);
int64 t1 = getTickCount();
double seconds = (t1-t0)/getTickFrequency();
cerr << "some_operation took: " << seconds << " seconds." << endl;
// 2. use detectAndCompute(), not single detect() and compute() calls.
// (it has to compute the features for the detection anyway, avoid wouble work)
OrbFeatureDetector detector; // no seperate extractor needed.
detector.detectAndCompute(image, Mat(), keypoints, descriptors);
// 3. restrict number of keypoints (if you can allow it, quality.)
// http://docs.opencv.org/2.4.13/modules/features2d/doc/feature_detection_and_description.html#orb-orb
// please also see the remarks on other optimizations there, scaleFactor, scoreType
OrbFeatureDetector detector(500); // 500 enough ? experiment.
// 4. work on smaller images:
pyrDown(image, image); // half size, 1/4 area to check.
detector.detectAndCompute(image, Mat(), keypoints, descriptors);