第一次调试时,由于需要配置字符PDB,会需要比较长的一段时间,下次就不需要等待了。
效果:
#include"opencv2/highgui/highgui.hpp" #include"opencv2/imgproc/imgproc.hpp" int main(int argc, char** argv) { cv::namedWindow("Example2", cv::WINDOW_NORMAL); cv::resizeWindow("Example2",300,240);//改变视频窗口大小 cv::VideoCapture cap; cap.open( "E:\\F\\iceSeaWare\\1.flv" ); if (!cap.isOpened())//如果视频不能正常打开则返回 return; cv::Mat frame; for (;;) { cap >> frame; if (frame.empty())break;//如果读出的画面帧为空,则停止 cv::imshow("Example2", frame); cv::waitKey(33);//每帧停留33毫秒 } return 0; }
效果: