#include "opencv2\highgui\highgui.hpp"
#include "opencv2\imgproc\imgproc.hpp"
#include <iostream>
#include <iomanip>
const std::string fileName = "C:\\FUJun\\data\\ar\\abc.avi";
const std::string dstFolder = "C:\\FUJun\\data\\ar\\abc\\";
const int newWidth = 860;
const int newHeight = 540;
int main(int argc, char* argv[])
{
cv::VideoCapture cap(fileName);
if (!cap.isOpened()){
std::cout << "!!! Failed to open file: " << fileName << std::endl;
return -1;
}
cv::Size size(newWidth,newHeight);
cv::Mat dst;
cv::Mat frame;
for(int i=0;;i++){
if (!cap.read(frame))
break;
cv::resize(frame,dst,size);
cv::imshow("window", dst);
std::ostringstream ostr;
ostr << dstFolder << std::setfill('0') << std::setw(4) << i <<".jpg";
cv::imwrite(ostr.str(),dst);
char key = cvWaitKey(10);
if (key == 27) // ESC
break;
}
return 0;
}
#include "opencv2\imgproc\imgproc.hpp"
#include <iostream>
#include <iomanip>
const std::string fileName = "C:\\FUJun\\data\\ar\\abc.avi";
const std::string dstFolder = "C:\\FUJun\\data\\ar\\abc\\";
const int newWidth = 860;
const int newHeight = 540;
int main(int argc, char* argv[])
{
cv::VideoCapture cap(fileName);
if (!cap.isOpened()){
std::cout << "!!! Failed to open file: " << fileName << std::endl;
return -1;
}
cv::Size size(newWidth,newHeight);
cv::Mat dst;
cv::Mat frame;
for(int i=0;;i++){
if (!cap.read(frame))
break;
cv::resize(frame,dst,size);
cv::imshow("window", dst);
std::ostringstream ostr;
ostr << dstFolder << std::setfill('0') << std::setw(4) << i <<".jpg";
cv::imwrite(ostr.str(),dst);
char key = cvWaitKey(10);
if (key == 27) // ESC
break;
}
return 0;
}











