标签:opencv sift descriptorextractor
OpenCV入门 - 提取SIFT特征向量#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/nonfree/features2d.hpp> // #include <iostream> using namespace cv; using namespace std; int main(int argc, const char *argv[]){ const cv::Mat input = cv::imread("input.jpg", 0);// load as grayscale cv::Mat descriptors; Ptr<DescriptorExtractor> extractor = DescriptorExtractor::create("SIFT"); cv::SiftFeatureDetector detector; vector<cv::KeyPoint> keypoints; detector.detect(input, keypoints); extractor->compute(input, keypoints, descriptors); cout << descriptors.rows << ":" << descriptors.cols << endl; // too many bits //cout << descriptors << endl; return 0; }
通过结果可以看到共有266个关键点,可以输出来看看。
参考:
1.opencv 2.4.10 reference
标签:opencv sift descriptorextractor
原文地址:http://blog.csdn.net/vonzhoufz/article/details/45647053