我找了许多做人体目标跟踪的dataset,但是大部分是图像序列,我把它做成了视频,方便操作。使用的OpenCV 2.4.9实现。
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<fstream>
#include<string>
using namespace cv;
using namespace std;
void main()
{
string filename;
ifstream inf("walking2.txt");
VideoWriter writer("walking2.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25.0, Size(384, 288));
Mat frame;
while (!inf.eof())
{
inf>>filename;
filename="F:\\OpenCVproject\\data\\benchmark cvpr2013\\Walking2\\img\\"+filename;
frame=imread(filename);
imshow("video", frame);
writer << frame;
if (cvWaitKey(20) == 27)
{
break;
}
}
}
函数原型:C++:
VideoWriter::
VideoWriter
(
const string&
filename
, int
fourcc
, double
fps
, Size
frameSize
, bool
isColor
=true
)
Parameters: |
|
---|