Folders multiple pictures together referred to as video _c ++
The same folder all the pictures into avi.
Picture naming requirements
0000.jpg,0001.jpg,0002.jpg。。。。
Generation video name save.avi.
void img2avi(char* address)
{
assert(address != NULL);
char buf[128];
int nums = 1;
sprintf(buf, "%s/%04d.jpg", address, nums);
cv::Mat frame = cv::imread(buf);
while(frame.data == NULL)
{
nums++;
printf("num = %d\n", nums);
sprintf(buf, "%s/%04d.jpg", address, nums);
frame = cv::imread(buf);
}
cv::VideoWriter save;
save.open("save.avi", CV_FOURCC('M','P','4','2'), 25.0, frame.size(), true);
save << frame;
nums++;
while(frame.data != NULL)
{
sprintf(buf, "%s/%04d.jpg", address, nums++);
frame = cv::imread(buf);
save << frame;
}
save.release();
printf("save over!\n");
}