mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 02:16:34 +08:00
Merge pull request #279 from buzziam/master
Fix for Itseez/opencv_contrib/issues/278 - core dump in the case of no match(...) results.
This commit is contained in:
@@ -111,8 +111,21 @@ int main(int argc, char** argv)
|
|||||||
cout << endl << "PPF Elapsed Time " <<
|
cout << endl << "PPF Elapsed Time " <<
|
||||||
(tick2-tick1)/cv::getTickFrequency() << " sec" << endl;
|
(tick2-tick1)/cv::getTickFrequency() << " sec" << endl;
|
||||||
|
|
||||||
// Get only first N results
|
//check results size from match call above
|
||||||
int N = 2;
|
size_t results_size = results.size();
|
||||||
|
cout << "Number of matching poses: " << results_size;
|
||||||
|
if (results_size == 0) {
|
||||||
|
cout << endl << "No matching poses found. Exiting." << endl;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get only first N results - but adjust to results size if num of results are less than that specified by N
|
||||||
|
size_t N = 2;
|
||||||
|
if (results_size < N) {
|
||||||
|
cout << endl << "Reducing matching poses to be reported (as specified in code): "
|
||||||
|
<< N << " to the number of matches found: " << results_size << endl;
|
||||||
|
N = results_size;
|
||||||
|
}
|
||||||
vector<Pose3DPtr> resultsSub(results.begin(),results.begin()+N);
|
vector<Pose3DPtr> resultsSub(results.begin(),results.begin()+N);
|
||||||
|
|
||||||
// Create an instance of ICP
|
// Create an instance of ICP
|
||||||
|
Reference in New Issue
Block a user