15 #include <mrpt/3rdparty/do_opencv_includes.h> 41 const std::string& out_file,
double fps,
52 cc = CV_FOURCC_DEFAULT;
54 else if (fourcc.size() == 4)
56 cc = CV_FOURCC(fourcc[0], fourcc[1], fourcc[2], fourcc[3]);
60 std::cerr <<
"[CVideoFileWriter::open] fourcc string must be four " 61 "character length or empty for default." 69 out_file, cc, fps, cv::Size(frameSize.
x, frameSize.
y), isColor);
72 std::cerr <<
"[CVideoFileWriter::open] ERROR: MRPT was compiled without " 107 if (!
m_video.get())
return false;
113 "[CVideoFileWriter::writeImage] Error: video frame " 114 "size is %ix%i but image is %ux%u",
bool writeImage(const mrpt::img::CImage &img)
Write image to the video file (method function, alternative to the operator <<).
const CVideoFileWriter & operator<<(const mrpt::img::CImage &img)
Write image to the video file.
std::string std::string format(std::string_view fmt, ARGS &&... args)
void close()
Finish the file writing and close the file output.
spimpl::impl_ptr< T > pimpl
cv::Mat & asCvMatRef()
Get a reference to the internal cv::Mat, which can be resized, etc.
size_t getHeight() const override
Returns the height of the image in pixels.
bool open(const std::string &out_file, double fps, const mrpt::img::TImageSize &frameSize, const std::string &fourcc=std::string(""), bool isColor=true)
Open a file for writing the video.
mrpt::img::TImageSize m_img_size
A copy of the video size.
bool isOpen() const
Return true if already successfully open with open() and not closed yet.
mrpt::pimpl< Impl > m_video
size_t getWidth() const override
Returns the width of the image in pixels.
A pair (x,y) of pixel coordinates (integer resolution).
Classes for computer vision, detectors, features, etc.
CVideoFileWriter()
Default constructor, which does not open any file.
virtual ~CVideoFileWriter()
Destructor.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
An output stream which takes a sequence of images and writes a video file in any of a given of compat...
pimpl< T > make_impl(Args &&... args)
mrpt::pimpl< Impl > m_video
A class for storing images as grayscale or RGB bitmaps.