Opencv 稀疏光流法跟踪详细教程
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <math.h>
#include <stdio.h>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <chrono>
#include <fstream>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include "opencv2/calib3d/calib3d.hpp"
#include <cctype>
#include <string.h>
#include <time.h>
#include <windows.h>
#include <cstdio>
#include<windows.h>
#include"glew.h"
#include<GL/GL.h>
#include<GL/GLU.h>
//#include <sl/Camera.hpp>
using namespace std;
using namespace cv;
Mat frame,gray;
Mat pre_frame, pre_gray;
//通过容器将角点特征数据保存起来
vector<Point2f>features;
//定义两个容器将特征点保存起来
//初始化特征数据
vector<Point2f>inPoints;
//保存两帧的特征点,一个是前一帧,一个是当前帧
vector<Point2f>fpts[2];
//calcOpticalFlowPyrLK这个函数里面的一个追踪成功标志位和追踪区域误差
vector<uchar>status;
vector<float>errors;
//特征点检测---角点检测
void detectFeatures(Mat &inframe, Mat &ingray);
//将角点检测的结果绘制出来
void drawFeature(