#include <iostream> // for standard I/O
#include <string> // for strings
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat)
#include <opencv2/highgui/highgui.hpp> // Video write
int main(int argc, char *argv[])
{
cv::Mat image_1 = cv::imread("1.jpg");
cv::Mat image_2 = cv::imread("2.jpg");cv::VideoWriter outVideo;
outVideo.open("XVID.avi", CV_FOURCC('X', 'V', 'I', 'D'), 30, image_1.size(), true);
if (outVideo.isOpened())
{
int64 time_1 = cv::getTickCount();
int index = 100;
while (index--)
{
outVideo << image_1;
outVideo << image_2;
}
int64 time_2 = cv::getTickCount();
std::cout << "time_2 - time_1 : " << (time_2 - time_1) / cv::getTickFrequency() << std::endl;
}
cout << "Finished writing" << endl;
system("pause");
return 0;
}
need opencv_ffmpeg2413.dll