2 * psychlops_widgets_Win32GL.cpp
3 * Psychlops Standard Library (Universal)
5 * Last Modified 2009/12/14 by Kenchi HOSOKAWA
6 * (C) 2009 Kenchi HOSOKAWA, Kazushi MARUYA and Takao SATO
10 #include <opencv2/core/core.hpp>
\r
11 #include <opencv2/highgui/highgui.hpp>
\r
12 #include "../../extension/standard/figure/psychlops_figure_standard.h"
\r
15 namespace Psychlops {
\r
17 Figures::Movie& Figures::Movie::save(std::string filename, const double t_fps, const FOURCC codec) {
\r
19 if(t_fps<=0.0) { fps = 60.0; } else { fps = t_fps; }
\r
22 std::cout << "Movie::save : in progress...";
\r
23 cv::Size size_of_frame(frames[0]->getWidth(), frames[0]->getHeight());
\r
29 loc = filename.find(".avi",0);
\r
30 if( loc != std::string::npos ) { fourcc = CV_FOURCC('M','J','P','G'); break; }
\r
31 loc = filename.find(".mov",0);
\r
32 if( loc != std::string::npos ) { fourcc = CV_FOURCC('M','J','P','G'); break; }
\r
33 loc = filename.find(".m4v",0);
\r
34 if( loc != std::string::npos ) { fourcc = CV_FOURCC('M','P','4','V'); break; }
\r
37 fourcc = CV_FOURCC('D','I','B',' ');
\r
40 fourcc = CV_FOURCC('H','F','Y','U');
\r
43 fourcc = CV_FOURCC('P','I','M','1');
\r
46 fourcc = CV_FOURCC('M','J','P','G');
\r
49 fourcc = CV_FOURCC('D','I','V','X');
\r
52 fourcc = CV_FOURCC('X','V','I','D');
\r
55 fourcc = CV_FOURCC('M','P','4','V');
\r
58 cv::VideoWriter writer(filename, fourcc, fps, size_of_frame);
\r
59 for(int i=0; i<frames.size(); i++)
\r
61 frames[i]->to(frame);
\r
65 std::cout << "Movie::save : The movie is empty.";
\r
71 } /* <- namespace Psycholops */
\r