#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
using namespace cv;
using namespace std;
int main(int argc, char **argv) {
VideoCapture cap(0);
Ptr<ORB> orb = ORB::create();
vector<KeyPoint> keypoints;
Mat descriptors;
Mat src;
if(!cap.isOpened())
{
cout << "video is not open!" << endl;
}
while(cap.isOpened())
{cap >> src;
Mat gray_src;
cvtColor(src,gray_src,CV_BGR2GRAY);
orb->detectAndCompute(gray_src, Mat(),keypoints, descriptors);
Mat feature_points;
drawKeypoints(gray_src,keypoints,feature_points,Scalar::all(-1));
imshow("feature",feature_points);
if(waitKey(30) == 's')
{
imwrite("get_points.png",src);
}
}
return 0;
}
opencv3.1 ORB特征点提取
最新推荐文章于 2024-09-14 16:03:03 发布