#前言
起初是用的python跑了光流法和差分法的代码,后来换用c++。
vs code配置c/c++环境比较麻烦,就换用了vs studio。
在vs studio中配置opencv环境:
VS配置永久OpenCV(小萌轻松操作):超细致_矮矮的小胖子的博客-优快云博客_vs配置opencv
#LK金字塔算法的C语言代码
参考链接:opencv3/C++光流点追踪_阿卡蒂奥的博客-优快云博客
但是这个原代码我跑着有点问题,修改了一部分,如下:
#include<opencv2/opencv.hpp>
using namespace cv;
//光流跟踪
Mat frame, gray, pr_frame, pr_gray;
std::vector<Point2f> inPoints;
std::vector<Point2f> fpts[2];
void trackFeature();
int main()
{
VideoCapture capture;
capture.open(0);
if (!captur