mirror of
https://gitcode.com/gh_mirrors/es/esp32-opencv.git
synced 2025-08-15 11:10:24 +08:00
initial commit
This commit is contained in:
@ -0,0 +1,46 @@
|
||||
#include <iostream>
|
||||
#include "opencv2/core.hpp"
|
||||
#ifdef HAVE_OPENCV_XFEATURES2D
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/features2d.hpp"
|
||||
#include "opencv2/xfeatures2d.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace cv::xfeatures2d;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
CommandLineParser parser( argc, argv, "{@input | box.png | input image}" );
|
||||
Mat src = imread( samples::findFile( parser.get<String>( "@input" ) ), IMREAD_GRAYSCALE );
|
||||
if ( src.empty() )
|
||||
{
|
||||
cout << "Could not open or find the image!\n" << endl;
|
||||
cout << "Usage: " << argv[0] << " <Input image>" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-- Step 1: Detect the keypoints using SURF Detector
|
||||
int minHessian = 400;
|
||||
Ptr<SURF> detector = SURF::create( minHessian );
|
||||
std::vector<KeyPoint> keypoints;
|
||||
detector->detect( src, keypoints );
|
||||
|
||||
//-- Draw keypoints
|
||||
Mat img_keypoints;
|
||||
drawKeypoints( src, keypoints, img_keypoints );
|
||||
|
||||
//-- Show detected (drawn) keypoints
|
||||
imshow("SURF Keypoints", img_keypoints );
|
||||
|
||||
waitKey();
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int main()
|
||||
{
|
||||
std::cout << "This tutorial code needs the xfeatures2d contrib module to be run." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user