1 | initial version |
//-- create detector and descriptor --
// if you want it faster, take e.g. FAST or ORB
cv::Ptr<cv::FeatureDetector> detector = cv::FeatureDetector::create("HARRIS");
// if you want it faster take e.g. ORB or FREAK
cv::Ptr<cv::DescriptorExtractor> descriptor = cv::DescriptorExtractor::create("SIFT");
// detect keypoints
std::vector<cv::KeyPoint> keypoints1, keypoints2;
detector->detect(img1, keypoints1);
detector->detect(img2, keypoints2);
// extract features
cv::Mat desc1, desc2
descriptor->compute(img1, keypoints1, desc1);
descriptor->compute(img2, keypoints2, desc2);
// ... your code for matching and creating homography-matrix
2 | No.2 Revision |
//-- create detector and descriptor --
// if you want it faster, take e.g. FAST or ORB
cv::Ptr<cv::FeatureDetector> detector = cv::FeatureDetector::create("HARRIS");
// if you want it faster take e.g. ORB or FREAK
cv::Ptr<cv::DescriptorExtractor> descriptor = cv::DescriptorExtractor::create("SIFT");
// detect keypoints
std::vector<cv::KeyPoint> keypoints1, keypoints2;
detector->detect(img1, keypoints1);
detector->detect(img2, keypoints2);
// extract features
cv::Mat desc1, desc2
desc2;
descriptor->compute(img1, keypoints1, desc1);
descriptor->compute(img2, keypoints2, desc2);
// ... your code for matching and creating homography-matrix