sift_test.cpp
1 | #include <opencv2/nonfree/features2d.hpp> |
---|---|
2 | #include <opencv2/features2d/features2d.hpp> |
3 | #include <opencv2/highgui/highgui.hpp> |
4 | #include <iostream> |
5 | |
6 | using namespace cv; |
7 | using namespace std; |
8 | |
9 | int main(int argc, char **argv){ |
10 | if(argc < 2){ |
11 | cout << "Usage: " << argv[0] << " image" << endl; |
12 | exit(0);
|
13 | } |
14 | |
15 | Mat image = imread(argv[1]);
|
16 | |
17 | SiftFeatureDetector detector(100);
|
18 | std::vector<KeyPoint> keypoints; |
19 | |
20 | detector.detect(image, keypoints); |
21 | |
22 | cout << "k size= " << keypoints.size() << endl;
|
23 | |
24 | for(size_t i = 0; i < keypoints.size(); i++){ |
25 | cout << "k response " << keypoints.at(i).response << endl;
|
26 | } |
27 | |
28 | exit(0);
|
29 | } |