PARP Research Group Universidad de Murcia


QVVideoReaderBlock Class Reference
[Block programming]

This is a generic video input processing block for the QVision architecture. More...

#include <QVVideoReaderBlock>

Inherits QVProcessingBlock.

List of all members.

Signals

void opened ()
 Emitted each time a new video source is opened.
void closed ()
 Emitted each time the video source is closed.
void grabbed ()
 Emitted each time a new frame is grabbed.

Public Member Functions

 QVVideoReaderBlock (QString name=QString(""))
 Constructor for QVVideoReaderBlock class.
 ~QVVideoReaderBlock ()
 Destructor for QVVideoReaderBlock class.
bool linkProperty (QVPropertyContainer *dstCont, QString dstProp)
 Links a QVImage<uChar,3> (RGB image) or QVImage<uChar,1> (gray image) from the camera to another block.
bool linkProperty (QVPropertyContainer *dstCont, QString dstProp1, QString dstProp2, QString dstProp3, bool YUV_RGB=false)
 Links 3 QVImage<uChar,1> from the camera (YUV channels) to the corresponding ones of another block.

Detailed Description

This is a generic video input processing block for the QVision architecture.

This is a generic video input processing block (see QVProcessingBlock) for the QVision architecture, which is based on the corresponding generic video source reader class QVVideoReader. You will find it very useful when writing QVision programs which have to process a sequence of video images, as it provides you with a lot of functionality by default, such as selecting from a wide range of video sources in runtime, rescaling input images, grab YUV, gray or RGB images, pausing the video, or going directly to a desired position in it, among many other possibilities. Compile and test example videoReader.cpp in Example programs section for a quick hands-on introduction to its usage.

As any other QVProcessingBlock, it has some custom input and output properties:

Input properties:

The user can set desired values for these properties directly through the command line, and the programmer through the corresponding QVProcessingBlock::setPropertyValue method:

  • NoLoop (bool): If the source should be opened in no loop mode.
  • RealTime (bool): If the source should be opened in real time mode.
  • URL (QString): URL of the video source to read.
  • Cols (int): Number of suggested columns for the video source.
  • Rows (int): Number of suggested rows for the video source.

Note.- RealTime property is also input (and as such can be initialized using the command line), but invisible to the GUI (because once the source has been linked, it cannot be relinked changing its synchronism).

Note.- Note also that you can open the camera in a different size of that specified in the real video source, by setting the desired values of properties Cols and Rows (this class will automatically rescale output images if needed).

Output properties:

These can be accessed using the corresponding QVProcessingBlock::getPropertyValue method:

  • Opened (bool): Tells if the camera is correctly opened and working.
  • FPS (int): FPS of the video.
  • Frames (int): Number of read frames up to now.
  • ColsR (int): Actual number of columns of the video -not necessarily equal to the number of requested columns, which will in any case be transparently rounded to the nearest upper even integer-.
  • RowsR (int): Actual number of rows of the video -not necessarily equal to the number of requested rows, which will in any case be transparently rounded to the nearest upper even integer-.
  • Pos (double): Current position in the video, if available.
  • Length (double): Length of the video, if available.

Note.- Remember again that you can open the camera in a different size of that specified in the real video source file (this class will automatically rescale output images if needed); thus, ColsR and RowsR will always contain the real size of the output images served by this block.

Output image properties:

Again, these can be accessed using the QVProcessingBlock::getPropertyValue method:

  • RGB image (QVImage<uChar,3>): Last grabbed RGB image.
  • Y channel image (QVImage<uChar,1>): Last grabbed Y channel image (gray level image).
  • U channel image (QVImage<uChar,1>): Last grabbed U channel image.
  • V channel image (QVImage<uChar,1>): Last grabbed V channel image.
Remarks:
  • Output image properties can (and should!) be linked automatically, without the need of naming them explicitly, using any of the QVVideoReaderBlock::linkProperty() available methods.
  • When using QVVideoReaderBlock objets in your program, you can specify any of the input properties at the start of the program, using the command line parameters; for example, the file to read the video from could be specified by calling the program this way: ./program --URL="/home/me/myfile.avi --Rows=300 --Cols=400" . But modification of these properties can also be done directly in the corresponding graphical widgets when reopening the camera during execution (though, of course, these new values will have no effect until the camera is reopened).
  • Two important properties worth a little more discussion are RealTime and NoLoop, both boolean. The first one specifies if the camera will be read in real time mode -possibly leaving frames unprocessed, if processing is slower than reading (RealTime=true)-, or at maximum speed -but without leaving any frame unprocessed in any case (RealTime=false)-. The second one specifies if the camera will be closed when the end of the file is reached (NoLoop=true), or will loop, starting from the first frame again and again (NoLoop=false).
See also:
QVVideoReader QVBaseReader

Definition at line 115 of file qvvideoreaderblock.h.


Constructor & Destructor Documentation

QVVideoReaderBlock::QVVideoReaderBlock ( QString  name = QString("")  ) 

Constructor for QVVideoReaderBlock class.

Parameters:
name the (optional) name given to the camera block.

Definition at line 40 of file qvvideoreaderblock.cpp.

QVVideoReaderBlock::~QVVideoReaderBlock (  ) 

Destructor for QVVideoReaderBlock class.

Definition at line 98 of file qvvideoreaderblock.cpp.


Member Function Documentation

bool QVVideoReaderBlock::linkProperty ( QVPropertyContainer dstCont,
QString  dstProp 
)

Links a QVImage<uChar,3> (RGB image) or QVImage<uChar,1> (gray image) from the camera to another block.

This method will automatically link, using the adequate synchronism (Asynchronous for real time cameras and Synchronous for non real time cameras; see QVPropertyContainer), a gray or an RGB image in the block to the corresponding output image property of the camera. An error (return value=false) will occur if dstProp is not of the adequate type (QVImage<uChar,3> or QVImage<uChar,1>).

Parameters:
dstCont Pointer to the destination block.
dstProp Name of the destination property.
Returns:
true if success, false otherwise.

Definition at line 223 of file qvvideoreaderblock.cpp.

bool QVVideoReaderBlock::linkProperty ( QVPropertyContainer dstCont,
QString  dstProp1,
QString  dstProp2,
QString  dstProp3,
bool  YUV_RGB = false 
)

Links 3 QVImage<uChar,1> from the camera (YUV channels) to the corresponding ones of another block.

This method will automatically link, using the adequate synchronism (Asynchronous for real time cameras and Synchronous for non real time cameras; see QVPropertyContainer), a set of three one channel images in the block to the corresponding output image properties of the camera. An error (return value=false) will occur if any of the dstProp are not of the adequate QVImage<uChar,1> type.

Parameters:
dstCont Pointer to the destination block.
dstProp1 Name of the destination property for image Y (or R; see YUV_RGB parameter).
dstProp2 Name of the destination property for image U (or G; see YUV_RGB parameter).
dstProp3 Name of the destination property for image V (or B; see YUV_RGB parameter).
YUV_RGB if false (default), Y, U and V images are linked; otherwise, R, G, and B will be linked.
Returns:
true if success, false otherwise.

Definition at line 240 of file qvvideoreaderblock.cpp.

void QVVideoReaderBlock::opened (  )  [signal]

Emitted each time a new video source is opened.

void QVVideoReaderBlock::closed (  )  [signal]

Emitted each time the video source is closed.

void QVVideoReaderBlock::grabbed (  )  [signal]

Emitted each time a new frame is grabbed.


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



QVision framework. PARP research group. Copyright © 2007, 2008, 2009, 2010, 2011.