CAVAPA-GUI  30.5.2014
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Public Types | Public Member Functions | List of all members
cavapa_gui::CaptureInterface Class Referenceabstract

Interface for the capture devices. More...

#include <captureinterface.h>

Inheritance diagram for cavapa_gui::CaptureInterface:
cavapa_gui::HTTPCapture cavapa_gui::OpenCVCapture

Public Types

enum  INTERFACE_TYPE { HTTP, OPENCV }
 Used to define the type of source interface.
 

Public Member Functions

 DISALLOW_COPY_AND_ASSIGN (CaptureInterface)
 Copy and assign of the class is not allowed.
 
virtual double getBarrelCorrection ()=0
 Retrieves the barrel correction applied to the source. More...
 
virtual FrameCapture getBuffered ()=0
 Retrieves the currently buffered frame. More...
 
virtual std::string getDescription () const =0
 Retrieves the description of the device. More...
 
virtual int getDeviceID () const =0
 Returns the ID number the device was initialized with. More...
 
virtual double getFramerate () const =0
 Retrieves the capture device framerate. More...
 
virtual int getMissedFrames () const =0
 Retrieves the logged frame misses. More...
 
virtual FrameCapture getNext (bool skip, bool *error)=0
 Retrieves the next frame. More...
 
virtual std::string getPath () const =0
 Retrieves the path given during the initialization. More...
 
virtual cv::Size getResolution () const =0
 Retrieves the capture device resolution. More...
 
virtual int getRetrievedFrames () const =0
 Retrieves the total logged frames. More...
 
virtual INTERFACE_TYPE getType () const =0
 Retrieves the type of the device. More...
 
virtual bool hasNew ()=0
 Checks whether the device has a new image to retrieve or not. More...
 
virtual bool isOpen () const =0
 Checks whether the capturing device is open or not. More...
 
virtual bool open (const std::string &path)=0
 Opens the video file or the stream. More...
 
virtual void resetStats ()=0
 Resets the statistical counters. More...
 
virtual void setBarrelCorrection (double amount)=0
 Sets the amount of the barrel correction to be applied. More...
 
virtual bool setResolution (const cv::Size &new_size)=0
 Sets the capturing device resolution. More...
 

Detailed Description

Interface for the capture devices.

The inherits from this class are used by the actual video frame sources. The class represents the core functionality of device image retrieval.

The key functions of this abstract class are getNext() and open().

Author
Petri Partanen

Member Function Documentation

virtual double cavapa_gui::CaptureInterface::getBarrelCorrection ( )
pure virtual

Retrieves the barrel correction applied to the source.

Returns
The amount of the barrel correction.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual FrameCapture cavapa_gui::CaptureInterface::getBuffered ( )
pure virtual

Retrieves the currently buffered frame.

Returns
The buffered frame.
Remarks
This does not signal for a new image fetch from the device.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual std::string cavapa_gui::CaptureInterface::getDescription ( ) const
pure virtual

Retrieves the description of the device.

Returns
For the devices initialized with HW index, this will be the name of the HW device. For other devices this is the path given during initialization.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual int cavapa_gui::CaptureInterface::getDeviceID ( ) const
pure virtual

Returns the ID number the device was initialized with.

Returns
The device ID used in the initialization or UNKNOWN_DEVICE if not specified.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual double cavapa_gui::CaptureInterface::getFramerate ( ) const
pure virtual

Retrieves the capture device framerate.

Returns
The current framerate.

Implemented in cavapa_gui::HTTPCapture, and cavapa_gui::OpenCVCapture.

virtual int cavapa_gui::CaptureInterface::getMissedFrames ( ) const
pure virtual

Retrieves the logged frame misses.

A frame miss occurs everytime when getNext() is called and the previous retrieval was still ongoing.

Returns
The count of the missed frames.

Implemented in cavapa_gui::HTTPCapture, and cavapa_gui::OpenCVCapture.

virtual FrameCapture cavapa_gui::CaptureInterface::getNext ( bool  skip,
bool *  error 
)
pure virtual

Retrieves the next frame.

Basically it returns the currently buffered frame and signals the device to grab a new image for next call to the function. If the device has not returned from previous image grab the call is recorded as a missed frame.

Parameters
skipSpecifies if the frame can be skipped. When set to true, this will force the main thread to wait for a new image from the device. This can result in a huge lag if the device is not capable of retrieving images fast enough.
errorWill receive an error message if something went wrong.
Returns
The next frame with the reference to the image! You must make a clone if you wish to alter it!

Implemented in cavapa_gui::HTTPCapture, and cavapa_gui::OpenCVCapture.

virtual std::string cavapa_gui::CaptureInterface::getPath ( ) const
pure virtual

Retrieves the path given during the initialization.

Returns
The path of the device or an empty string if not found.

Implemented in cavapa_gui::HTTPCapture, and cavapa_gui::OpenCVCapture.

virtual cv::Size cavapa_gui::CaptureInterface::getResolution ( ) const
pure virtual

Retrieves the capture device resolution.

Returns
The resolution of the device.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual int cavapa_gui::CaptureInterface::getRetrievedFrames ( ) const
pure virtual

Retrieves the total logged frames.

Basically, this is a counter on how many times getNext() has been called.

Returns
The count of the total frames returned.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual INTERFACE_TYPE cavapa_gui::CaptureInterface::getType ( ) const
pure virtual

Retrieves the type of the device.

Returns
The interface type.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual bool cavapa_gui::CaptureInterface::hasNew ( )
pure virtual

Checks whether the device has a new image to retrieve or not.

This checks if the FrameTime on the buffered image differs from what was retrieved on the last getNext().

Returns
True if new image or false otherwise.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual bool cavapa_gui::CaptureInterface::isOpen ( ) const
pure virtual

Checks whether the capturing device is open or not.

Returns
True if the device is open or false otherwise.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual bool cavapa_gui::CaptureInterface::open ( const std::string &  path)
pure virtual

Opens the video file or the stream.

Parameters
pathThe path of the video file or the network stream.
Returns
True if it was opened successfully or false otherwise.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual void cavapa_gui::CaptureInterface::resetStats ( )
pure virtual

Resets the statistical counters.

This affects the missed and total frame counters.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual void cavapa_gui::CaptureInterface::setBarrelCorrection ( double  amount)
pure virtual

Sets the amount of the barrel correction to be applied.

Parameters
amountThe barrel effect. 0.0 means none.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.

virtual bool cavapa_gui::CaptureInterface::setResolution ( const cv::Size &  new_size)
pure virtual

Sets the capturing device resolution.

Parameters
new_sizeThe size to be set.
Returns
True if at least one of the dimension was set or false otherwise.

Implemented in cavapa_gui::OpenCVCapture, and cavapa_gui::HTTPCapture.


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