一、知识点
在quickopencv.h头文件中添加函数
在quickdemo.cpp中实现函数
void QuickDemo::video_demo(Mat &image)
{
VideoCapture capture("C:/Users/85741/Desktop/vcworkspace/opencv_tutorial_data-master/images/01.mp4");
int frame_width = capture.get(CAP_PROP_FRAME_WIDTH);
int frame_height = capture.get(CAP_PROP_FRAME_HEIGHT);
int count = capture.get(CAP_PROP_FRAME_COUNT);
double fps = capture.get(CAP_PROP_FPS);
std::cout << "frame width:" << frame_width << std::endl;
std::cout << "frame height:" << frame_width << std::endl;
std::cout << "FPS:" << frame_width << std::endl;
std::cout << "Number of Frames:" << frame_width << std::endl;
VideoWriter writer("C:/Users/85741/Desktop/vcworkspace/test.mp4",capture.get(CAP_PROP_FOURCC),fps,Size(frame_width,frame_height));
Mat frame;
while (true) {
capture.read(frame);
// flip(frame, frame, -1);
if (frame.empty()) {
break;
}
imshow("frame",frame);
colorSpace_Demo(frame);
writer.write(frame);
int c = waitKey(1);
if (c == 27) {//退出
break;
}
}
//release
capture.release();
writer.release();
}