29 lines
638 B
C++
29 lines
638 B
C++
#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();
|
|
} |