void HammingMatchBatch::getResult(MatchList &good) const{ good.clear(); cv::DMatch _mtch; for ( int _i = 0; _i < this->result.rows; ++_i){ _mtch.queryIdx = this->result.at<int>(_i, 0); _mtch.trainIdx = this->result.at<int>(_i, 1); _mtch.distance = this->result.at<int>(_i, 2); if ( _mtch.queryIdx != -1 ) good.push_back(_mtch); } }
void fast_hammingnorm_matchserial(const cv::Mat &des1, const cv::Mat &des2, ListIdxCorrespondance &_list, const float ratio){ MatchList good; good.clear(); bool flipcorrespondence = false; if ( des1.rows <= des2.rows ){ _hammingmatchserial(des1, des2, good, ratio); } else { flipcorrespondence = true; _hammingmatchserial(des2, des1, good, ratio); } correspondance_list(good, _list, flipcorrespondence); }
void fast_hammingnorm_match_neighborhood(const cv::Mat& des1, const cv::Mat& des2, const cv::Mat& neighborhood, ListIdxCorrespondance& _list, const float ratio, const int parscore) { cv::setNumThreads(3); MatchList good; good.clear(); bool flipcorrespondence = false; if ( des1.rows <= des2.rows ){ HammingMatchBatch _hmtbb(des1, des2,neighborhood, ratio, parscore); cv::parallel_for_(cv::Range(0, des1.rows), _hmtbb, 3); _hmtbb.getResult(good); } else { flipcorrespondence = true; cv::Mat _neight=neighborhood.t(); HammingMatchBatch _hmtbb(des2, des1, _neight, ratio, parscore); cv::parallel_for_(cv::Range(0, des2.rows), _hmtbb, 3); _hmtbb.getResult(good); } correspondance_list(good, _list, flipcorrespondence); }
void fast_hammingnorm_match(const cv::Mat &des1, const cv::Mat&des2, ListIdxCorrespondance &_list, const float ratio, const int parscore){ // Fast Hamming Norm based test cv::setNumThreads(3); cv::Mat empty; MatchList good; good.clear(); bool flipcorrespondence = false; if ( des1.rows <= des2.rows ){ HammingMatchBatch _hmtbb(des1, des2, empty, ratio, parscore); cv::parallel_for_(cv::Range(0, des1.rows), _hmtbb, 3); _hmtbb.getResult(good); } else { flipcorrespondence = true; HammingMatchBatch _hmtbb(des2, des1, empty, ratio, parscore); cv::parallel_for_(cv::Range(0, des2.rows), _hmtbb, 3); _hmtbb.getResult(good); } correspondance_list(good, _list, flipcorrespondence); }