void GetAlignedPointsFromMatch(const Features& leftFeatures, const Features& rightFeatures, const Matching& matches, Features& alignedLeft, Features& alignedRight, vector<int>& leftBackReference, vector<int>& rightBackReference) { alignedLeft .keyPoints.clear(); alignedRight.keyPoints.clear(); alignedLeft .descriptors = cv::Mat(); alignedRight.descriptors = cv::Mat(); for (unsigned int i=0; i<matches.size(); i++) { alignedLeft .keyPoints .push_back(leftFeatures.keyPoints [matches[i].queryIdx]); alignedLeft .descriptors.push_back(leftFeatures.descriptors.row (matches[i].queryIdx)); alignedRight.keyPoints .push_back(rightFeatures.keyPoints [matches[i].trainIdx]); alignedRight.descriptors.push_back(rightFeatures.descriptors.row(matches[i].trainIdx)); leftBackReference .push_back(matches[i].queryIdx); rightBackReference.push_back(matches[i].trainIdx); } KeyPointsToPoints(alignedLeft.keyPoints, alignedLeft.points); KeyPointsToPoints(alignedRight.keyPoints, alignedRight.points); }
void Features::extract(const cv::DescriptorExtractor& extract, const cv::Mat& img) { extract.compute(img, kpts_, descriptors_); KeyPointsToPoints(kpts_, pts_); // matcher_->add(vector<Mat>(1,descriptors_)); // matcher_->train(); }