MRPT logo

mrpt::vision::CVideoFileWriter Class Reference

An output stream which takes a sequence of images and writes a video file in any of a given of compatible formats. More...

#include <mrpt/vision/CVideoFileWriter.h>

List of all members.

Public Member Functions

 CVideoFileWriter ()
 Default constructor, which does not open any file.
virtual ~CVideoFileWriter ()
 Destructor.
bool open (const std::string &out_file, double fps, const mrpt::vision::TImageSize &frameSize, const std::string &fourcc=std::string(""), bool isColor=true)
 Open a file for writing the video.
void close ()
 Finish the file writing and close the file output.
const CVideoFileWriteroperator<< (const mrpt::utils::CImage &img) const
 Write image to the video file.
bool writeImage (const mrpt::utils::CImage &img) const
 Write image to the video file (method function, alternative to the operator <<).

Private Attributes

mrpt::utils::void_ptr_noncopy m_video
 A pointer to CvVideoWriter.
mrpt::vision::TImageSize m_img_size
 A copy of the video size.


Detailed Description

An output stream which takes a sequence of images and writes a video file in any of a given of compatible formats.

The output file is open when calling "open", and it's closed at destructor or after calling "close".

Example of usage:

    CVideoFileWriter  vid;
    vid.open("test.avi","MJPG",15,TPixelCoord(320,200));
    CImage  img(320,200);
    vid << img;
    vid.close;

There are two methods for adding frames to the video:

Note:
This class is a wrapper for OpenCV's CvVideoWriter.

Definition at line 59 of file CVideoFileWriter.h.


Constructor & Destructor Documentation

mrpt::vision::CVideoFileWriter::CVideoFileWriter (  ) 

Default constructor, which does not open any file.

virtual mrpt::vision::CVideoFileWriter::~CVideoFileWriter (  )  [virtual]

Destructor.


Member Function Documentation

void mrpt::vision::CVideoFileWriter::close (  ) 

Finish the file writing and close the file output.

bool mrpt::vision::CVideoFileWriter::open ( const std::string &  out_file,
double  fps,
const mrpt::vision::TImageSize frameSize,
const std::string &  fourcc = std::string(""),
bool  isColor = true 
)

Open a file for writing the video.

Parameters:
out_file The video file to create for output.
fourcc The video codec, as a string. See notes below. fps The video FPS (frames per seconds).
frameSize The size of the video frames. All subsequent images must be of this size.
isColor Set to false to create a grayscale video.
Note:
If fourcc is left as an empty string a default codec will be seleceted (e.g. "IYUV").

Other valid values for "fourcc" are: "PIM1" -> MPEG1, "MJPG" -> Motion JPEG, "XVID", etc...

Returns:
false on any error, true on success.

const CVideoFileWriter& mrpt::vision::CVideoFileWriter::operator<< ( const mrpt::utils::CImage img  )  const

Write image to the video file.

Exceptions:
std::exception On any error

bool mrpt::vision::CVideoFileWriter::writeImage ( const mrpt::utils::CImage img  )  const

Write image to the video file (method function, alternative to the operator <<).

Returns:
false on any error


Member Data Documentation

A copy of the video size.

Definition at line 63 of file CVideoFileWriter.h.

A pointer to CvVideoWriter.

Definition at line 62 of file CVideoFileWriter.h.




Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:27:43 EDT 2009