ALVisionExtractor is a generic vision extractor. More...
#include <alvision/alvisionextractor.h>
Public Member Functions | |
ALVisionExtractor (boost::shared_ptr< ALBroker > pBroker, const std::string &pName, int resolution=kQVGA, int colorspace=kBGRColorSpace, int framerate=30, int activecamera=-1) | |
Create a generic vision extractor. | |
virtual | ~ALVisionExtractor () |
virtual bool | setColorSpace (const int &colorSpace) |
Sets processed image colorspace on the fly. | |
virtual bool | setFrameRate (const int &framerate) |
Sets extractor framerate on the fly. | |
virtual bool | setFrameRate (const std::string &pSubscribedName, const int &framerate) |
virtual bool | setResolution (const int &resolution) |
Sets processed image resolution on the fly. | |
virtual bool | setActiveCamera (const int &cameraId) |
Sets the camera from which the image is taken. | |
boost::shared_ptr < AL::ALVideoDeviceProxy > | getVideoDeviceProxy () |
int | getColorSpace () |
int | getFrameRate () |
int | getResolution () |
int | getActiveCamera () |
bool | isPaused () |
bool | isProcessing () |
QI_API_DEPRECATED void | setParameter (const std::string ¶mName, const ALValue ¶mValue) |
Set parameter value for resolution and pause. | |
virtual void | start ()=0 |
Method which will be called before each subscription to the extractor. | |
virtual void | process (ALImage *img)=0 |
Method which will be called each time the extractor gets an image. | |
void | pause (const bool &paused) |
Pause the extractor, without calling the stop method. | |
virtual void | stop ()=0 |
Method which will be called when the module is unsubscribed. | |
int | getDefaultPeriod () |
This method overrides the method inherited from ALExtractor. It computes the default period from the default framerate given in the constructor of the ALVisionExtractor. | |
int | getMinimumPeriod () |
This method overrides the method inherited from ALExtractor. It computes the minimum period from the highest framerate supported by the selected camera. | |
int | getMaximumPeriod () |
This method overrides the method inherited from ALExtractor. It computes the maximum period from the lowest framerate supported by the selected camera. | |
Protected Member Functions | |
void | xUpdateParameters (const int pPeriod, const float pPrecision) |
void | setSubscriptionParameters (const std::vector< std::pair< int, int > > ¶meters) |
ALVisionExtractor is a generic vision extractor.
ALVisionExtractor is an extractor dedicated to vision processing. It retrieves images from one of NAO's cameras, and gives them as input to a callback method process(). This method will be called each time an image is retrieved.
The parameters concerning the image retrieval (resolution, colorspace, camera and framerate) can be set either at the construction (which is recommended) if you do not have to change them, or on the fly using dedicated method.
Definition at line 37 of file alvisionextractor.h.
AL::ALVisionExtractor::ALVisionExtractor | ( | boost::shared_ptr< ALBroker > | pBroker, |
const std::string & | pName, | ||
int | resolution = kQVGA , |
||
int | colorspace = kBGRColorSpace , |
||
int | framerate = 30 , |
||
int | activecamera = -1 |
||
) |
Create a generic vision extractor.
[in] | pBroker | Broker use to register the vision extractor. |
[in] | pName | Name of the Vision Extractor. |
resolution | Resolution of the images the extractor will process at module startup. Default value is 1 (QVGA resolution). | |
colorspace | Colorspace of the images the extractor will process at module startup. Default value is BGR colorspace. | |
framerate | Framerate of the images the extractor will process at module startup. Default value is 30. | |
[in] | activecamera | Index of the active camera -1 to use the default one. |
virtual AL::ALVisionExtractor::~ALVisionExtractor | ( | ) | [virtual] |
int AL::ALVisionExtractor::getDefaultPeriod | ( | ) | [virtual] |
This method overrides the method inherited from ALExtractor. It computes the default period from the default framerate given in the constructor of the ALVisionExtractor.
For an ALVisionExtractor, there is no need to override this method: the default period can be chosen by setting the default framerate in the constructor.
Reimplemented from AL::ALExtractor.
int AL::ALVisionExtractor::getMaximumPeriod | ( | ) | [virtual] |
This method overrides the method inherited from ALExtractor. It computes the maximum period from the lowest framerate supported by the selected camera.
For an ALVisionExtractor, there is no need to override this method.
Reimplemented from AL::ALExtractor.
int AL::ALVisionExtractor::getMinimumPeriod | ( | ) | [virtual] |
This method overrides the method inherited from ALExtractor. It computes the minimum period from the highest framerate supported by the selected camera.
For an ALVisionExtractor, there is no need to override this method.
Reimplemented from AL::ALExtractor.
boost::shared_ptr<AL::ALVideoDeviceProxy> AL::ALVisionExtractor::getVideoDeviceProxy | ( | ) |
bool AL::ALVisionExtractor::isPaused | ( | ) |
bool AL::ALVisionExtractor::isProcessing | ( | ) |
void AL::ALVisionExtractor::pause | ( | const bool & | paused | ) |
Pause the extractor, without calling the stop method.
paused | true if the extractor must be paused, false else. |
virtual void AL::ALVisionExtractor::process | ( | ALImage * | img | ) | [pure virtual] |
Method which will be called each time the extractor gets an image.
img | Pointer to the image class, which is retrieved according to the extractor parameters (colorspace, framerate, resolution, camera). |
virtual bool AL::ALVisionExtractor::setActiveCamera | ( | const int & | cameraId | ) | [virtual] |
Sets the camera from which the image is taken.
cameraId | Desired camera ID. |
virtual bool AL::ALVisionExtractor::setColorSpace | ( | const int & | colorSpace | ) | [virtual] |
Sets processed image colorspace on the fly.
colorSpace | Desired colorspace. |
virtual bool AL::ALVisionExtractor::setFrameRate | ( | const int & | framerate | ) | [virtual] |
Sets extractor framerate on the fly.
framerate | Desired extractor framerate. |
virtual bool AL::ALVisionExtractor::setFrameRate | ( | const std::string & | pSubscribedName, |
const int & | framerate | ||
) | [virtual] |
QI_API_DEPRECATED void AL::ALVisionExtractor::setParameter | ( | const std::string & | paramName, |
const ALValue & | paramValue | ||
) |
Set parameter value for resolution and pause.
paramName | Name of the parameter to set ("resolution" or "pause") |
paramValue | ALValue array of the value to be set. |
virtual bool AL::ALVisionExtractor::setResolution | ( | const int & | resolution | ) | [virtual] |
Sets processed image resolution on the fly.
resolution | Desired resolution. |
void AL::ALVisionExtractor::setSubscriptionParameters | ( | const std::vector< std::pair< int, int > > & | parameters | ) | [protected] |
virtual void AL::ALVisionExtractor::start | ( | ) | [pure virtual] |
Method which will be called before each subscription to the extractor.
virtual void AL::ALVisionExtractor::stop | ( | ) | [pure virtual] |
Method which will be called when the module is unsubscribed.
void AL::ALVisionExtractor::xUpdateParameters | ( | const int | pPeriod, |
const float | pPrecision | ||
) | [protected, virtual] |
Reimplemented from AL::ALExtractor.