JeVois  1.0
JeVois Smart Embedded Machine Vision Toolkit
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. More...
 
virtual ~VideoInput ()
 Virtual destructor for save inheritance. More...
 
virtual void streamOn ()=0
 Start streaming. More...
 
virtual void abortStream ()=0
 Abort streaming. More...
 
virtual void streamOff ()=0
 Stop streaming. More...
 
virtual void get (RawImage &img)=0
 Get the next captured buffer. More...
 
virtual void done (RawImage &img)=0
 Indicate that user processing is done with an image previously obtained via get() More...
 
virtual void queryControl (struct v4l2_queryctrl &qc) const =0
 Get information about a control, throw if unsupported by hardware. More...
 
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. More...
 
virtual void getControl (struct v4l2_control &ctrl) const =0
 Get a control's current value, throw if unsupported by hardware. More...
 
virtual void setControl (struct v4l2_control const &ctrl)=0
 Set a control, throw if the hardware rejects the value. More...
 
virtual void setFormat (VideoMapping const &m)=0
 Set the video format and frame rate. More...
 
virtual void writeRegister (unsigned char reg, unsigned char val)=0
 Write a value of one of the camera's registers. More...
 
virtual unsigned char readRegister (unsigned char reg)=0
 Read a value from one of the camera's registers. More...
 

Protected Attributes

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

Constructor & Destructor Documentation

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

Constructor.

Parameters
nbufsnumber of video buffers to use, or 0 for automatic.

Definition at line 21 of file VideoInput.C.

jevois::VideoInput::~VideoInput ( )
virtual

Virtual destructor for save inheritance.

Definition at line 27 of file VideoInput.C.

Member Function Documentation

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.

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.

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.

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.

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.

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.

virtual unsigned char jevois::VideoInput::readRegister ( unsigned char  reg)
pure virtual

Read a value from one of the camera's registers.

This very low-level access is for development of optimal camera settings only and should not be used in normal operation, it can crash your system.

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

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.

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

Set the video format and frame rate.

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

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

Stop streaming.

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

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

Start streaming.

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

virtual void jevois::VideoInput::writeRegister ( unsigned char  reg,
unsigned char  val 
)
pure virtual

Write a value of one of the camera's registers.

This very low-level access is for development of optimal camera settings only and should not be used in normal operation, it can crash your system.

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

Member Data Documentation

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

Our device or movie file name.

Definition at line 95 of file VideoInput.H.

unsigned int const jevois::VideoInput::itsNbufs
protected

Our number of buffers.

Definition at line 96 of file VideoInput.H.


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