行远-自迩

导航

Opencv 视频分解成图片<3>

 Mat frame;
 char outfine[400];
 VideoCapture cap;
 VideoWriter writer;
 cap.open("E:\\欣奕华\\项目\\OPENCV\\Video\\ComposeandDecompose\\hxy.mp4");
 if (!cap.isOpened())
  return;
 int totalFrame = cap.get(CAP_PROP_FRAME_COUNT);
 for (int i = 0; i < totalFrame; i++)
 {
  cap >> frame;
  if (frame.empty())
   break;
  sprintf_s(outfine, "E:\\欣奕华\\项目\\OPENCV\\Video\\ComposeandDecompose\\%d.jpg", i);
  imwrite(outfine, frame);
  imshow("video", frame);
  waitKey(30);
 }
 
 cap.release();
 destroyAllWindows()

posted on 2019-09-25 15:31  行远-自迩  阅读(172)  评论(0编辑  收藏  举报