This commit is contained in:
USW
2025-05-21 12:11:58 +09:00
parent 9ca329482a
commit d65e1aeed5
13 changed files with 922 additions and 0 deletions

29
ch14/keypoints/main.cpp Normal file
View 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();
}