1. 程式人生 > >opencv3.1 ORB特徵點提取

opencv3.1 ORB特徵點提取

#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; }