14끝
This commit is contained in:
29
ch14/keypoints/main.cpp
Normal file
29
ch14/keypoints/main.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
#include "opencv2/opencv.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
int main() {
|
||||
Mat src = imread("../../resources/images/box_in_scene.png", IMREAD_GRAYSCALE);
|
||||
|
||||
Ptr<Feature2D> feature = ORB::create();
|
||||
|
||||
vector<KeyPoint> keypoints;
|
||||
feature->detect(src, keypoints);
|
||||
|
||||
Mat desc;
|
||||
feature->compute(src, keypoints, desc);
|
||||
|
||||
cout << "keypoints.size(): " << keypoints.size() << endl;
|
||||
cout << "desc.size(): " << desc.size() << endl;
|
||||
|
||||
Mat dst;
|
||||
drawKeypoints(src, keypoints, dst, Scalar::all(-1), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
|
||||
|
||||
imshow("src", src);
|
||||
imshow("dst", dst);
|
||||
|
||||
waitKey(0);
|
||||
destroyAllWindows();
|
||||
}
|
||||
Reference in New Issue
Block a user