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

The Capture device for HTTP images. More...

#include <httpcapture.h>

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

Public Member Functions

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

Additional Inherited Members

- Public Types inherited from cavapa_gui::CaptureInterface
enum  INTERFACE_TYPE { HTTP, OPENCV }
 Used to define the type of source interface.
 

Detailed Description

The Capture device for HTTP images.

The class can be used as the interface device for capturing the HTTP images from websites (like webcam). It uses CURL library for it's image retrieval.

Remarks
The class was design to be a backup interface for network cameras. As it turned out, there was no real need for the class so it was excluded from the build. It is still here in case it is needed.
Author
Petri Partanen

Member Function Documentation

double cavapa_gui::HTTPCapture::getBarrelCorrection ( )
inlineoverridevirtual

Retrieves the barrel correction applied to the source.

Returns
The amount of the barrel correction.

Implements cavapa_gui::CaptureInterface.

FrameCapture cavapa_gui::HTTPCapture::getBuffered ( )
overridevirtual

Retrieves the currently buffered frame.

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

Implements cavapa_gui::CaptureInterface.

std::string cavapa_gui::HTTPCapture::getDescription ( ) const
inlineoverridevirtual

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.

Implements cavapa_gui::CaptureInterface.

int cavapa_gui::HTTPCapture::getDeviceID ( ) const
inlineoverridevirtual

Returns the ID number the device was initialized with.

Returns
The device ID used in the initialization or UNKNOWN_DEVICE if not specified.
UNKNOWN_DEVICE. The HTTP devices are not real devices.

Implements cavapa_gui::CaptureInterface.

double cavapa_gui::HTTPCapture::getFramerate ( ) const
inlineoverridevirtual

Retrieves the capture device framerate.

Returns
The current framerate.
0. The HTTP devices do not have framerate.

Implements cavapa_gui::CaptureInterface.

int cavapa_gui::HTTPCapture::getMissedFrames ( ) const
inlineoverridevirtual

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.

Implements cavapa_gui::CaptureInterface.

FrameCapture cavapa_gui::HTTPCapture::getNext ( bool  skip,
bool *  error 
)
overridevirtual

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!

Implements cavapa_gui::CaptureInterface.

std::string cavapa_gui::HTTPCapture::getPath ( ) const
inlineoverridevirtual

Retrieves the path given during the initialization.

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

Implements cavapa_gui::CaptureInterface.

cv::Size cavapa_gui::HTTPCapture::getResolution ( ) const
overridevirtual

Retrieves the capture device resolution.

Returns
The resolution of the device.
Remarks
On HTTP sources this can only be known after the first successful image retrieval.

Implements cavapa_gui::CaptureInterface.

int cavapa_gui::HTTPCapture::getRetrievedFrames ( ) const
inlineoverridevirtual

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.

Implements cavapa_gui::CaptureInterface.

INTERFACE_TYPE cavapa_gui::HTTPCapture::getType ( ) const
inlineoverridevirtual

Retrieves the type of the device.

Returns
The interface type.

Implements cavapa_gui::CaptureInterface.

bool cavapa_gui::HTTPCapture::hasNew ( )
inlineoverridevirtual

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.
true. HTTP devices always have new images.

Implements cavapa_gui::CaptureInterface.

bool cavapa_gui::HTTPCapture::isOpen ( ) const
inlineoverridevirtual

Checks whether the capturing device is open or not.

Returns
True if the device is open or false otherwise.

Implements cavapa_gui::CaptureInterface.

bool cavapa_gui::HTTPCapture::open ( const std::string &  path)
overridevirtual

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.

Implements cavapa_gui::CaptureInterface.

void cavapa_gui::HTTPCapture::resetStats ( )
overridevirtual

Resets the statistical counters.

This affects the missed and total frame counters.

Implements cavapa_gui::CaptureInterface.

void cavapa_gui::HTTPCapture::setBarrelCorrection ( double  amount)
inlineoverridevirtual

Sets the amount of the barrel correction to be applied.

Parameters
amountThe barrel effect. 0.0 means none.

Implements cavapa_gui::CaptureInterface.

bool cavapa_gui::HTTPCapture::setResolution ( const cv::Size &  new_size)
inlineoverridevirtual

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.
false. You cannot change resolution of HTTP sources.

Implements cavapa_gui::CaptureInterface.


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