JeVois
1.18
JeVois Smart Embedded Machine Vision Toolkit
|
|
#include <jevois/Core/MovieInput.H>
Movie input, can be used as a replacement for Camera to debug algorithms using a fixed video sequence.
The movie will be looped forever to provide continual input. This is a direct wrapper around the VideoCapture class of OpenCV, and it hence supports many different video file formats, and image sequences when the filename contains a printf-like d placeholder for a frame number. See OpenCV documentation for VideoCapture for more details.
Note that the movie frames will be resized to match the dimensions specified by setFormat() and will be converted to the pixel type specified in setFormat().
Definition at line 35 of file MovieInput.H.
Public Member Functions | |
MovieInput (std::string const &filename, unsigned int const nbufs=3) | |
Constructor, opens the movie file. More... | |
virtual | ~MovieInput () |
Virtual destructor for safe inheritance. More... | |
void | streamOn () override |
Start streaming. More... | |
void | abortStream () override |
Abort streaming. More... | |
void | streamOff () override |
Stop streaming. More... | |
void | get (RawImage &img) override |
Get the next frame from the video file, possibly looping back to start if end is reached. More... | |
void | done (RawImage &img) override |
Indicate that user processing is done with an image previously obtained via get() More... | |
void | queryControl (struct v4l2_queryctrl &qc) const override |
Get information about a control, throw if unsupported by hardware. More... | |
void | queryMenu (struct v4l2_querymenu &qm) const override |
Get the available menu entry names for a menu-type control, throw if unsupported by hardware. More... | |
void | getControl (struct v4l2_control &ctrl) const override |
Get a control's current value, throw if unsupported by hardware. More... | |
void | setControl (struct v4l2_control const &ctrl) override |
Set a control, throw if the hardware rejects the value. More... | |
void | setFormat (VideoMapping const &m) override |
Set the video format and frame rate. More... | |
![]() | |
VideoInput (std::string const &devname, unsigned int const nbufs=0) | |
Constructor. More... | |
virtual | ~VideoInput () |
Virtual destructor for save inheritance. More... | |
virtual bool | hasScaledImage () const |
Check whether a second input image scaled by the JeVoisPro Platform ISP is available. More... | |
virtual void | get2 (RawImage &img) |
Get the next captured ISP-scaled secondary buffer. More... | |
virtual void | done2 (RawImage &img) |
Indicate that user processing is done with a second ISP-scaled image previously obtained via get2() More... | |
Protected Attributes | |
cv::VideoCapture | itsCap |
Our OpenCV video capture, works on movie and image files too. More... | |
std::shared_ptr< VideoBuf > | itsBuf |
Our single video buffer. More... | |
VideoMapping | itsMapping |
Our current video mapping, we resize the input to the mapping's camera dims. More... | |
![]() | |
const std::string | itsDevName |
Our device or movie file name. More... | |
unsigned const int | itsNbufs |
Our number of buffers. More... | |
jevois::MovieInput::MovieInput | ( | std::string const & | filename, |
unsigned int const | nbufs = 3 |
||
) |
Constructor, opens the movie file.
Definition at line 27 of file MovieInput.C.
|
virtual |
Virtual destructor for safe inheritance.
Definition at line 35 of file MovieInput.C.
|
overridevirtual |
Abort streaming.
This only cancels future get() and done() calls, one should still call streamOff() to turn off streaming.
Implements jevois::VideoInput.
Definition at line 43 of file MovieInput.C.
|
overridevirtual |
Indicate that user processing is done with an image previously obtained via get()
You should call this as soon after get() as possible, once you are finished with the RawImage data so that it can be recycled. This also invalidates the image and in particular its pixel buffer.
Implements jevois::VideoInput.
Definition at line 92 of file MovieInput.C.
|
overridevirtual |
Get the next frame from the video file, possibly looping back to start if end is reached.
Implements jevois::VideoInput.
Definition at line 51 of file MovieInput.C.
References jevois::RawImage::buf, jevois::RawImage::bufindex, jevois::rawimage::convertCvBGRtoRawImage(), jevois::RawImage::fmt, jevois::RawImage::fps, jevois::RawImage::height, LFATAL, LINFO, and jevois::RawImage::width.
|
overridevirtual |
Get a control's current value, throw if unsupported by hardware.
In MovieInput, this just throws an std::runtime_error
Implements jevois::VideoInput.
Definition at line 107 of file MovieInput.C.
|
overridevirtual |
Get information about a control, throw if unsupported by hardware.
In MovieInput, this just throws an std::runtime_error
Implements jevois::VideoInput.
Definition at line 99 of file MovieInput.C.
|
overridevirtual |
Get the available menu entry names for a menu-type control, throw if unsupported by hardware.
In MovieInput, this just throws an std::runtime_error
Implements jevois::VideoInput.
Definition at line 103 of file MovieInput.C.
|
overridevirtual |
Set a control, throw if the hardware rejects the value.
In MovieInput, this just throws an std::runtime_error
Implements jevois::VideoInput.
Definition at line 111 of file MovieInput.C.
|
overridevirtual |
Set the video format and frame rate.
Video frames read from the input movie file will be rescaled (if necessary) to that format's resolution, and will be converted (if necessary) to that format's pixel type.
Implements jevois::VideoInput.
Definition at line 115 of file MovieInput.C.
|
overridevirtual |
|
overridevirtual |
|
protected |
Our single video buffer.
Definition at line 85 of file MovieInput.H.
|
protected |
Our OpenCV video capture, works on movie and image files too.
Definition at line 84 of file MovieInput.H.
Referenced by MovieInput().
|
protected |
Our current video mapping, we resize the input to the mapping's camera dims.
Definition at line 86 of file MovieInput.H.