VideoWriter put("output.mpg", CV_FOURCC('M','P','E','G'), 30, S);if(!put.isOpened()){cout << "File could not be created for writing. Check permissions" << endl;return -1;}
这里 的 S 是size ,视频尺寸, 用 frame.size()即可.
30 是FPS, 一般都用30帧了, 当然也有60的
下面的代码应该在一个while里面 , 条件自己添加把~
这里的意思是只要不是空帧, 就把它写入.
存好的视频就在工程文件夹的debug里面
// Check if the video is overif(frame.empty()){cout << "Video over" << endl;break;}put << frame;
,在时光的激流中,我们总会长大。