Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Member Functions | Private Attributes
mrpt::vision::CVideoFileWriter Class Reference

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:

vid.open("test.avi",15,TPixelCoord(320,200), "MJPG");
CImage img(320,200);
vid << img;
vid.close;
CVideoFileWriter()
Default constructor, which does not open any file.

There are two methods for adding frames to the video:

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

Definition at line 41 of file CVideoFileWriter.h.

#include <mrpt/vision/CVideoFileWriter.h>

Public Member Functions

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

Private Attributes

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

Constructor & Destructor Documentation

◆ CVideoFileWriter()

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

Default constructor, which does not open any file.

◆ ~CVideoFileWriter()

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

Destructor.

Member Function Documentation

◆ close()

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

Finish the file writing and close the file output.

◆ isOpen()

bool mrpt::vision::CVideoFileWriter::isOpen ( ) const

Return true if already successfully open with open() and not closed yet.

◆ open()

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

Open a file for writing the video.

Parameters
out_fileThe video file to create for output.
fourccThe video codec, as a string. See notes below. \paam fps The video FPS (frames per seconds).
frameSizeThe size of the video frames. All subsequent images must be of this size.
isColorSet 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.

◆ operator<<()

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

Write image to the video file.

Exceptions
std::exceptionOn any error

◆ writeImage()

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

◆ m_img_size

mrpt::utils::TImageSize mrpt::vision::CVideoFileWriter::m_img_size
private

A copy of the video size.

Definition at line 45 of file CVideoFileWriter.h.

◆ m_video

mrpt::utils::void_ptr_noncopy mrpt::vision::CVideoFileWriter::m_video
private

A pointer to CvVideoWriter.

Definition at line 44 of file CVideoFileWriter.h.




Page generated by Doxygen 1.9.2 for MRPT 1.4.0 SVN: at Mon Sep 20 00:21:41 UTC 2021