JeVois
1.22
JeVois Smart Embedded Machine Vision Toolkit
|
|
#include <jevois/Core/MovieOutput.H>
Video output to a movie file, using OpenCV video encoding.
This video output mode saved output frames to a file (or series of files). It is useful when developing new algorithms to check the correctness of generated outputs offline, or to save some documentation/demo movies of a module.
Definition at line 33 of file MovieOutput.H.
Public Member Functions | |
MovieOutput (std::string const &fn) | |
Constructor. | |
virtual | ~MovieOutput () |
Virtual destructor for safe inheritance. | |
virtual void | setFormat (VideoMapping const &m) override |
Set the video format and frame rate. | |
virtual void | get (RawImage &img) override |
Get a pre-allocated image so that we can fill the pixel data and later send out using send() | |
virtual void | send (RawImage const &img) override |
Send an image out. | |
virtual void | streamOn () override |
Start streaming. | |
virtual void | abortStream () override |
Abort streaming. | |
virtual void | streamOff () override |
Stop streaming. | |
Public Member Functions inherited from jevois::VideoOutput | |
virtual | ~VideoOutput () |
Virtual destructor for safe inheritance. | |
Protected Member Functions | |
void | run () |
Use a thread to encode and save frames. | |
Protected Attributes | |
std::shared_ptr< VideoBuf > | itsBuffer |
Our single video buffer. | |
VideoMapping | itsMapping |
Our current video mapping, we resize the input to the mapping's camera dims. | |
std::future< void > | itsRunFut |
Future for our run() thread. | |
jevois::BoundedBuffer< cv::Mat, jevois::BlockingBehavior::Block, jevois::BlockingBehavior::Block > | itsBuf |
Buffer of frames to encode and write to file. | |
std::atomic< bool > | itsSaving |
True when we are saving to file. | |
int | itsFileNum |
File number, gets incremented on each streamOff() to avoid overwriting previous files. | |
std::atomic< bool > | itsRunning |
True when our run() thread should keep running. | |
std::string | itsFilename |
Current file name to save video to. | |
std::string | itsFilebase |
Current file base to save video to. | |
jevois::MovieOutput::MovieOutput | ( | std::string const & | fn | ) |
Constructor.
Definition at line 32 of file MovieOutput.C.
References jevois::async(), itsRunFut, and run().
|
virtual |
Virtual destructor for safe inheritance.
Definition at line 39 of file MovieOutput.C.
References LERROR, LINFO, and jevois::warnAndIgnoreException().
|
overridevirtual |
Abort streaming.
This only cancels future get() and send() calls, one should still call streamOff() to turn off streaming.
Implements jevois::VideoOutput.
Definition at line 102 of file MovieOutput.C.
|
overridevirtual |
Get a pre-allocated image so that we can fill the pixel data and later send out using send()
May throw if not buffer is available, i.e., all have been queued to send but have not yet been sent. Application code must balance exactly one send() for each get().
Implements jevois::VideoOutput.
Definition at line 63 of file MovieOutput.C.
References jevois::RawImage::buf, jevois::RawImage::bufindex, jevois::RawImage::fmt, jevois::RawImage::fps, jevois::RawImage::height, LFATAL, and jevois::RawImage::width.
|
protected |
Use a thread to encode and save frames.
Definition at line 127 of file MovieOutput.C.
References LERROR, LFATAL, and LINFO.
Referenced by MovieOutput().
|
overridevirtual |
Send an image out.
May throw if the format is incorrect or std::overflow_error if we have not yet consumed the previous image.
Implements jevois::VideoOutput.
Definition at line 81 of file MovieOutput.C.
References jevois::rawimage::convertToCvBGR(), LERROR, and LFATAL.
|
overridevirtual |
Set the video format and frame rate.
Implements jevois::VideoOutput.
Definition at line 56 of file MovieOutput.C.
|
overridevirtual |
|
overridevirtual |
|
protected |
Buffer of frames to encode and write to file.
Definition at line 71 of file MovieOutput.H.
|
protected |
Our single video buffer.
Definition at line 65 of file MovieOutput.H.
|
protected |
Current file base to save video to.
Definition at line 76 of file MovieOutput.H.
|
protected |
Current file name to save video to.
Definition at line 75 of file MovieOutput.H.
|
protected |
File number, gets incremented on each streamOff() to avoid overwriting previous files.
Definition at line 73 of file MovieOutput.H.
|
protected |
Our current video mapping, we resize the input to the mapping's camera dims.
Definition at line 66 of file MovieOutput.H.
|
protected |
Future for our run() thread.
Definition at line 69 of file MovieOutput.H.
Referenced by MovieOutput().
|
protected |
True when our run() thread should keep running.
Definition at line 74 of file MovieOutput.H.
|
protected |
True when we are saving to file.
Definition at line 72 of file MovieOutput.H.