#include<iostream>
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
Mat frame, gray;//定义原图像 灰度图像
Mat prev_frame, prev_gray;//表示前一帧的图像帧,前一帧的图像帧的灰度图
vector<Point2f> features;//shi-tomasi角点特征检测数据 存入到features
vector<Point2f> inPoints;//初始化特征数据 用于光流跟踪
vector<Point2f> fpts[2];//保存当前帧和前一帧的特征点数据的位置,表示前一帧fpts[0] 表示当前fpts[1]
vector<uchar> status;//特征点是否成功的标志位
vector<float> errors;//跟踪时区域误差和
void detectFratures(Mat &inFrame, Mat &inGray);
void drawFeature(Mat &inframe);
void lkTrackFeatures();
void drawTrackLines();
int main(){
//frame = imread("G:/learning/OPENCV/LK/LK/LK.mp4");
VideoCapture capture;
capture.open("G:/learning/OPENCV/LK/LK/LK.mp4");
if (!capture.isOpened()){
cout << "could not load video file!" << endl;
return -1;
}
namedWindow("Camera output",1);
while (capture.read(frame
基于LK光流的点特征跟踪
最新推荐文章于 2024-04-20 00:00:24 发布