JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
jevois::VideoInput Class Referenceabstract

#include <jevois/Core/VideoInput.H>

Base class for video input, which will get derived into Camera and MovieInput.

Engine uses a VideoInput to capture input frames and pass them to its currently loaded machine vision Module for processing. The VideoInput class is abstract and simply defines the interface. For live video processing, Engine will implement its VideoInput as a Camera, and for processing of pre-recorded videos or image sequences (useful to debug or tune an algorithm on reproducible image sequences), it can also implement its VideoInout as a MovieInput.

Definition at line 31 of file VideoInput.H.

Inheritance diagram for jevois::VideoInput:
Collaboration diagram for jevois::VideoInput:

Public Member Functions

 VideoInput (std::string const &devname, unsigned int const nbufs=0)
 Constructor.
 
virtual ~VideoInput ()
 Virtual destructor for save inheritance.
 
virtual void streamOn ()=0
 Start streaming.
 
virtual void abortStream ()=0
 Abort streaming.
 
virtual void streamOff ()=0
 Stop streaming.
 
virtual void get (RawImage &img)=0
 Get the next captured buffer.
 
virtual bool hasScaledImage () const
 Check whether a second input image scaled by the JeVoisPro Platform ISP is available.
 
virtual void get2 (RawImage &img)
 Get the next captured ISP-scaled secondary buffer.
 
virtual void done (RawImage &img)=0
 Indicate that user processing is done with an image previously obtained via get()
 
virtual void done2 (RawImage &img)
 Indicate that user processing is done with a second ISP-scaled image previously obtained via get2()
 
virtual void queryControl (struct v4l2_queryctrl &qc) const =0
 Get information about a control, throw if unsupported by hardware.
 
virtual void queryMenu (struct v4l2_querymenu &qm) const =0
 Get the available menu entry names for a menu-type control, throw if unsupported by hardware.
 
virtual void getControl (struct v4l2_control &ctrl) const =0
 Get a control's current value, throw if unsupported by hardware.
 
virtual void setControl (struct v4l2_control const &ctrl)=0
 Set a control, throw if the hardware rejects the value.
 
virtual void setFormat (VideoMapping const &m)=0
 Set the video format and frame rate.
 

Protected Attributes

std::string const itsDevName
 Our device or movie file name.
 
unsigned int const itsNbufs
 Our number of buffers.
 

Constructor & Destructor Documentation

◆ VideoInput()

jevois::VideoInput::VideoInput ( std::string const &  devname,
unsigned int const  nbufs = 0 
)

Constructor.

Parameters
devnamename of the device, or movie file, or empty
nbufsnumber of video buffers to use, or 0 for automatic.

Definition at line 21 of file VideoInput.C.

◆ ~VideoInput()

jevois::VideoInput::~VideoInput ( )
virtual

Virtual destructor for save inheritance.

Definition at line 27 of file VideoInput.C.

Member Function Documentation

◆ abortStream()

virtual void jevois::VideoInput::abortStream ( )
pure virtual

Abort streaming.

This only cancels future get() and done() calls, one should still call streamOff() to turn off streaming.

Implemented in jevois::Camera, and jevois::MovieInput.

◆ done()

virtual void jevois::VideoInput::done ( RawImage img)
pure virtual

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.

Note
This also invalidates the image and in particular its pixel buffer!

Implemented in jevois::Camera, and jevois::MovieInput.

◆ done2()

void jevois::VideoInput::done2 ( RawImage img)
virtual

Indicate that user processing is done with a second ISP-scaled image previously obtained via get2()

You should call this as soon after get2() as possible, once you are finished with the RawImage data so that it can be recycled. Default implementation throws.

Note
This also invalidates the image and in particular its pixel buffer!

Reimplemented in jevois::Camera, and jevois::MovieInput.

Definition at line 39 of file VideoInput.C.

◆ get()

virtual void jevois::VideoInput::get ( RawImage img)
pure virtual

Get the next captured buffer.

Throws if we are not streaming or blocks until an image is available (has been captured). The image img should have been allocated by the caller and will be filled in by what we receive from the device here.

Implemented in jevois::Camera, and jevois::MovieInput.

◆ get2()

void jevois::VideoInput::get2 ( RawImage img)
virtual

Get the next captured ISP-scaled secondary buffer.

On JeVois-Pro Platform only, the camera ISP can output 2 frames: 1) raw from sensor, 2) scaled by ISP. This function is to access the ISP scaled frame. Throws if not JeVois-Pro Platform or the camera crop type is not jevois::CropType::CropScale. Throws if we are not streaming or blocks until an image is available (has been captured). The image img should have been allocated by the caller and will be filled in by what we receive from the device here. Default implementation throws.

Reimplemented in jevois::Camera, and jevois::MovieInput.

Definition at line 35 of file VideoInput.C.

◆ getControl()

virtual void jevois::VideoInput::getControl ( struct v4l2_control &  ctrl) const
pure virtual

Get a control's current value, throw if unsupported by hardware.

This is just a pass-through to VIDIOC_G_CTRL

Implemented in jevois::Camera, and jevois::MovieInput.

◆ hasScaledImage()

bool jevois::VideoInput::hasScaledImage ( ) const
virtual

Check whether a second input image scaled by the JeVoisPro Platform ISP is available.

Returns false unless we are on JeVois-Pro Platform and the camera format modifier jevois::CropType::CropScale is currently in use.

Reimplemented in jevois::Camera, and jevois::MovieInput.

Definition at line 31 of file VideoInput.C.

◆ queryControl()

virtual void jevois::VideoInput::queryControl ( struct v4l2_queryctrl &  qc) const
pure virtual

Get information about a control, throw if unsupported by hardware.

Caller should zero-out qc and then set the id field to the desired control id. See VIDIOC_QUERYCTRL for more information.

Implemented in jevois::Camera, and jevois::MovieInput.

◆ queryMenu()

virtual void jevois::VideoInput::queryMenu ( struct v4l2_querymenu &  qm) const
pure virtual

Get the available menu entry names for a menu-type control, throw if unsupported by hardware.

Caller should zero-out qm and then set the id and index fields to the desired control id and menu item index. See VIDIOC_QUERYMENU for more information.

Implemented in jevois::Camera, and jevois::MovieInput.

◆ setControl()

virtual void jevois::VideoInput::setControl ( struct v4l2_control const &  ctrl)
pure virtual

Set a control, throw if the hardware rejects the value.

This is just a pass-through to VIDIOC_S_CTRL

Implemented in jevois::Camera, and jevois::MovieInput.

◆ setFormat()

virtual void jevois::VideoInput::setFormat ( VideoMapping const &  m)
pure virtual

Set the video format and frame rate.

Implemented in jevois::Camera, and jevois::MovieInput.

◆ streamOff()

virtual void jevois::VideoInput::streamOff ( )
pure virtual

Stop streaming.

Implemented in jevois::Camera, and jevois::MovieInput.

◆ streamOn()

virtual void jevois::VideoInput::streamOn ( )
pure virtual

Start streaming.

Implemented in jevois::Camera, and jevois::MovieInput.

Member Data Documentation

◆ itsDevName

std::string const jevois::VideoInput::itsDevName
protected

Our device or movie file name.

Definition at line 106 of file VideoInput.H.

◆ itsNbufs

unsigned int const jevois::VideoInput::itsNbufs
protected

Our number of buffers.

Definition at line 107 of file VideoInput.H.


The documentation for this class was generated from the following files: