<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>mrpt::vision::CVideoFileWriter Class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> > <b>C++ reference</b> </div> <div align="right"> <a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a> </div> <!-- Generated by Doxygen 1.7.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <div class="left"> <form id="FSearchBox" action="search.php" method="get"> <img id="MSearchSelect" src="search/mag.png" alt=""/> <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"/> </form> </div><div class="right"></div> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacemrpt.html">mrpt</a> </li> <li class="navelem"><a class="el" href="namespacemrpt_1_1vision.html">vision</a> </li> <li class="navelem"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html">CVideoFileWriter</a> </li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="#pri-attribs">Private Attributes</a> </div> <div class="headertitle"> <div class="title">mrpt::vision::CVideoFileWriter Class Reference<div class="ingroups"><a class="el" href="group__mrpt__vision__grp.html">[mrpt-vision]</a></div></div> </div> </div> <div class="contents"> <!-- doxytag: class="mrpt::vision::CVideoFileWriter" --><hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><p>An output stream which takes a sequence of images and writes a video file in any of a given of compatible formats. </p> <p>The output file is open when calling "open", and it's closed at destructor or after calling "close".</p> <p>Example of usage:</p> <div class="fragment"><pre class="fragment"> <a class="code" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a64154af53d3554d8defbdc81038a93f7" title="Default constructor, which does not open any file.">CVideoFileWriter</a> vid; vid.open(<span class="stringliteral">"test.avi"</span>,<span class="stringliteral">"MJPG"</span>,15,TPixelCoord(320,200)); CImage img(320,200); vid << img; vid.close; </pre></div><p>There are two methods for adding frames to the video:</p> <ul> <li>The operator <<: Which will raise an exception on any error.</li> <li>The method writeImage, which does not raise any exception on errors.</li> </ul> <dl class="note"><dt><b>Note:</b></dt><dd>This class is a wrapper for OpenCV's CvVideoWriter. </dd></dl> </div> <p><code>#include <<a class="el" href="_c_video_file_writer_8h_source.html">mrpt/vision/CVideoFileWriter.h</a>></code></p> <p><a href="classmrpt_1_1vision_1_1_c_video_file_writer-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a64154af53d3554d8defbdc81038a93f7">CVideoFileWriter</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor, which does not open any file. <a href="#a64154af53d3554d8defbdc81038a93f7"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a23875179db102f94720fe55a24e25106">~CVideoFileWriter</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#a23875179db102f94720fe55a24e25106"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a246907c3d662d4c49c5b4463b4558ef9">open</a> (const <a class="el" href="classstd_1_1string.html">std::string</a> &out_file, double fps, const <a class="el" href="namespacemrpt_1_1utils.html#aad714637162eda7b78d3d4c520e9a379">mrpt::vision::TImageSize</a> &frameSize, const <a class="el" href="classstd_1_1string.html">std::string</a> &fourcc=<a class="el" href="classstd_1_1string.html">std::string</a>(""), bool isColor=true)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Open a file for writing the video. <a href="#a246907c3d662d4c49c5b4463b4558ef9"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#adde11a4e90aa484fda76efc43c541500">close</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Finish the file writing and close the file output. <a href="#adde11a4e90aa484fda76efc43c541500"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a3e04fa1d97577f669d6607feade90ac3">isOpen</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return true if already successfully open with <a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a246907c3d662d4c49c5b4463b4558ef9" title="Open a file for writing the video.">open()</a> and not closed yet. <a href="#a3e04fa1d97577f669d6607feade90ac3"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html">CVideoFileWriter</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#ab2df7c98d902b2b27c42efe284e23f71">operator<<</a> (const <a class="el" href="classmrpt_1_1utils_1_1_c_image.html">mrpt::utils::CImage</a> &img) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Write image to the video file. <a href="#ab2df7c98d902b2b27c42efe284e23f71"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a0762e8cabd102f2feec921ecb56e666e">writeImage</a> (const <a class="el" href="classmrpt_1_1utils_1_1_c_image.html">mrpt::utils::CImage</a> &img) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Write image to the video file (method function, alternative to the operator <<). <a href="#a0762e8cabd102f2feec921ecb56e666e"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="pri-attribs"></a> Private Attributes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacemrpt_1_1utils.html#ac3912bceb5e2a4662830ec51584d134b">mrpt::utils::void_ptr_noncopy</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a11c5356e32299fe42aec35d4274ba047">m_video</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">A pointer to CvVideoWriter. <a href="#a11c5356e32299fe42aec35d4274ba047"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacemrpt_1_1utils.html#aad714637162eda7b78d3d4c520e9a379">mrpt::vision::TImageSize</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a04f71b33b64980b314c2e07a76d6be97">m_img_size</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">A copy of the video size. <a href="#a04f71b33b64980b314c2e07a76d6be97"></a><br/></td></tr> </table> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a64154af53d3554d8defbdc81038a93f7"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::CVideoFileWriter" ref="a64154af53d3554d8defbdc81038a93f7" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">mrpt::vision::CVideoFileWriter::CVideoFileWriter </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Default constructor, which does not open any file. </p> </div> </div> <a class="anchor" id="a23875179db102f94720fe55a24e25106"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::~CVideoFileWriter" ref="a23875179db102f94720fe55a24e25106" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual mrpt::vision::CVideoFileWriter::~CVideoFileWriter </td> <td>(</td> <td class="paramname"></td><td>)</td> <td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Destructor. </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="adde11a4e90aa484fda76efc43c541500"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::close" ref="adde11a4e90aa484fda76efc43c541500" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void mrpt::vision::CVideoFileWriter::close </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Finish the file writing and close the file output. </p> </div> </div> <a class="anchor" id="a3e04fa1d97577f669d6607feade90ac3"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::isOpen" ref="a3e04fa1d97577f669d6607feade90ac3" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool mrpt::vision::CVideoFileWriter::isOpen </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Return true if already successfully open with <a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a246907c3d662d4c49c5b4463b4558ef9" title="Open a file for writing the video.">open()</a> and not closed yet. </p> </div> </div> <a class="anchor" id="a246907c3d662d4c49c5b4463b4558ef9"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::open" ref="a246907c3d662d4c49c5b4463b4558ef9" args="(const std::string &out_file, double fps, const mrpt::vision::TImageSize &frameSize, const std::string &fourcc=std::string(""), bool isColor=true)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool mrpt::vision::CVideoFileWriter::open </td> <td>(</td> <td class="paramtype">const <a class="el" href="classstd_1_1string.html">std::string</a> & </td> <td class="paramname"><em>out_file</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>fps</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="namespacemrpt_1_1utils.html#aad714637162eda7b78d3d4c520e9a379">mrpt::vision::TImageSize</a> & </td> <td class="paramname"><em>frameSize</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classstd_1_1string.html">std::string</a> & </td> <td class="paramname"><em>fourcc</em> = <code><a class="el" href="classstd_1_1string.html">std::string</a>("")</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>isColor</em> = <code>true</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Open a file for writing the video. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">out_file</td><td>The video file to create for output. </td></tr> <tr><td class="paramname">fourcc</td><td>The video codec, as a string. See notes below. fps The video FPS (frames per seconds). </td></tr> <tr><td class="paramname">frameSize</td><td>The size of the video frames. All subsequent images must be of this size. </td></tr> <tr><td class="paramname">isColor</td><td>Set to false to create a grayscale video.</td></tr> </table> </dd> </dl> <dl class="note"><dt><b>Note:</b></dt><dd>If fourcc is left as an empty string a default codec will be seleceted (e.g. "IYUV"). </dd> <dd> Other valid values for "fourcc" are: "PIM1" -> MPEG1, "MJPG" -> Motion JPEG, "XVID", etc...</dd></dl> <dl class="return"><dt><b>Returns:</b></dt><dd>false on any error, true on success. </dd></dl> </div> </div> <a class="anchor" id="ab2df7c98d902b2b27c42efe284e23f71"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::operator<<" ref="ab2df7c98d902b2b27c42efe284e23f71" args="(const mrpt::utils::CImage &img) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html">CVideoFileWriter</a>& mrpt::vision::CVideoFileWriter::operator<< </td> <td>(</td> <td class="paramtype">const <a class="el" href="classmrpt_1_1utils_1_1_c_image.html">mrpt::utils::CImage</a> & </td> <td class="paramname"><em>img</em></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Write image to the video file. </p> <dl><dt><b>Exceptions:</b></dt><dd> <table class="exception"> <tr><td class="paramname"><a class="el" href="classstd_1_1exception.html" title="STL class.">std::exception</a></td><td>On any error </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a0762e8cabd102f2feec921ecb56e666e"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::writeImage" ref="a0762e8cabd102f2feec921ecb56e666e" args="(const mrpt::utils::CImage &img) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool mrpt::vision::CVideoFileWriter::writeImage </td> <td>(</td> <td class="paramtype">const <a class="el" href="classmrpt_1_1utils_1_1_c_image.html">mrpt::utils::CImage</a> & </td> <td class="paramname"><em>img</em></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Write image to the video file (method function, alternative to the operator <<). </p> <dl class="return"><dt><b>Returns:</b></dt><dd>false on any error </dd></dl> </div> </div> <hr/><h2>Member Data Documentation</h2> <a class="anchor" id="a04f71b33b64980b314c2e07a76d6be97"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::m_img_size" ref="a04f71b33b64980b314c2e07a76d6be97" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="namespacemrpt_1_1utils.html#aad714637162eda7b78d3d4c520e9a379">mrpt::vision::TImageSize</a> <a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a04f71b33b64980b314c2e07a76d6be97">mrpt::vision::CVideoFileWriter::m_img_size</a><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>A copy of the video size. </p> <p>Definition at line <a class="el" href="_c_video_file_writer_8h_source.html#l00064">64</a> of file <a class="el" href="_c_video_file_writer_8h_source.html">CVideoFileWriter.h</a>.</p> </div> </div> <a class="anchor" id="a11c5356e32299fe42aec35d4274ba047"></a><!-- doxytag: member="mrpt::vision::CVideoFileWriter::m_video" ref="a11c5356e32299fe42aec35d4274ba047" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="namespacemrpt_1_1utils.html#ac3912bceb5e2a4662830ec51584d134b">mrpt::utils::void_ptr_noncopy</a> <a class="el" href="classmrpt_1_1vision_1_1_c_video_file_writer.html#a11c5356e32299fe42aec35d4274ba047">mrpt::vision::CVideoFileWriter::m_video</a><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>A pointer to CvVideoWriter. </p> <p>Definition at line <a class="el" href="_c_video_file_writer_8h_source.html#l00063">63</a> of file <a class="el" href="_c_video_file_writer_8h_source.html">CVideoFileWriter.h</a>.</p> </div> </div> </div> <br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.5</a> for MRPT 0.9.5 SVN: at Sun Sep 25 17:20:18 UTC 2011</td><td></td> <td width="100"> </td> <td width="150"> </td></tr> </table> </body></html>