opencv实现简单光流跟踪

#include "highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/video/tracking.hpp"  
#include   

using namespace cv;
using namespace std;

Mat image1, image2;
vector point1, point2, pointCopy;
vector status;
vector err;

int main(void)
{
	VideoCapture cap;
	Mat frame, frame2;
	cap.open(0);
	cap >> frame;
	Mat image1Gray, image2Gray;
	cvtColor(frame, image1Gray, CV_RGB2GRAY);
	goodFeaturesToTrack(image1Gray, point1, 100, 0.01, 10, Mat());
	pointCopy = point1;
	for (int i = 0; i> frame2;
		cvtColor(frame2, image2Gray, CV_RGB2GRAY);
		calcOpticalFlowPyrLK(image1Gray, image2Gray, point1, point2, status, err, Size(20, 20), 3); //LK金字塔       
		for (int i = 0; i

你可能感兴趣的:(图像处理)