Skip to content

Instantly share code, notes, and snippets.

@kellegous
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save kellegous/0afdea5efb150048e0cc to your computer and use it in GitHub Desktop.

Select an option

Save kellegous/0afdea5efb150048e0cc to your computer and use it in GitHub Desktop.
read-features.cc
bool ReadFeatureDescriptors(const std::string& path,
std::vector<cv::KeyPoint>& keypoints,
cv::Mat& descriptors) {
cv::Mat img = cv::imread(path.c_str(), CV_LOAD_IMAGE_GRAYSCALE);
if (!img.data) {
return false;
}
cv::SurfFeatureDetector detector;
cv::SurfDescriptorExtractor extractor;
detector.detect(img, keypoints);
extractor.compute(img, keypoints, descriptors);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment