Ask Your Question

SIFT descriptors with Harris corner detector

asked 2013-04-14 14:09:53 -0500

mikecmpbll gravatar image

Hi, I'm attempting to do the following:

  • Find Harris corners in two images
  • Extract SIFT descriptors for those keypoints
  • Match keypoints
  • Calculate homography using RANSAC
  • Apply the homography to the second image, so that if the two images were on top of one another, their features would be aligned.

I'm struggling on the 2nd point, how can I use cornerHarris() and produce descriptors in order to calculate a homography? I don't necessarily have to use Harris corners or SIFT, but I've read that it's fast. I'm basically just trying to align the images as best I can.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-14 14:18:28 -0500

Guanta gravatar image

updated 2013-04-14 14:19:03 -0500

//-- 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
edit flag offensive delete link more


I'll give this a go this evening, it seems simple!

mikecmpbll gravatar imagemikecmpbll ( 2013-04-15 06:24:36 -0500 )edit

But Harris do not return keypoints.

mike_nit gravatar imagemike_nit ( 2018-08-28 02:03:31 -0500 )edit

Question Tools


Asked: 2013-04-14 14:09:53 -0500

Seen: 3,694 times

Last updated: Apr 14 '13