/** * OpenCV video recording tool. * * Based on CvBase, see which. * * @author vona **/ #include "cvbase.hpp" #include using namespace std; /** Extends base class to record all captured frames to a file. **/ class CvRecord : public CvBase { protected: /** The video writer. **/ CvVideoWriter *vw; /** Output filename. **/ const char *outfile; /** Output codec. **/ int fourcc; /** Output frames per second. **/ double outFPS; /** Adds command line help. **/ virtual void cmdHelpExt() { cout<<" where R is outfile [outFPS] [fourcc]"<width, frame->height)); if (vw == 0) cerr<<"W: error creating video writer"< ate+1) && !(istringstream(argv[ate+1])>>outFPS).fail()) ate++; //if there is yet another arg, and it is a string of four characters, parse //it as a fourcc fourcc = DEF_FOURCC; if (argc > ate+1) { char *s = argv[++ate]; if (strlen(s) == 4) fourcc = CV_FOURCC(s[0], s[1], s[2], s[3]); } cout<<"writing video to \""<>0*8)&0xff) <<(char)((fourcc>>1*8)&0xff) <<(char)((fourcc>>2*8)&0xff) <<(char)((fourcc>>3*8)&0xff) <<"), "<