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. More... | |
virtual | ~ALVisionExtractor () |
virtual bool | setColorSpace (const int &colorSpace) |
Sets processed image colorspace on the fly. More... | |
virtual bool | setFrameRate (const int &framerate) |
Sets extractor framerate on the fly. More... | |
virtual bool | setFrameRate (const std::string &pSubscribedName, const int &framerate) |
virtual bool | setResolution (const int &resolution) |
Sets processed image resolution on the fly. More... | |
virtual bool | setActiveCamera (const int &cameraId) |
Sets the camera from which the image is taken. More... | |
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. More... | |
virtual void | start ()=0 |
Method which will be called before each subscription to the extractor. More... | |
virtual void | process (ALImage *img)=0 |
Method which will be called each time the extractor gets an image. More... | |
void | pause (const bool &paused) |
Pause the extractor, without calling the stop method. More... | |
virtual void | stop ()=0 |
Method which will be called when the module is unsubscribed. More... | |
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. More... | |
int | getMinimumPeriod () |
This method overrides the method inherited from ALExtractor. It computes the minimum period from the highest framerate supported by the selected camera. More... | |
int | getMaximumPeriod () |
This method overrides the method inherited from ALExtractor. It computes the maximum period from the lowest framerate supported by the selected camera. More... | |
Public Member Functions inherited from AL::ALExtractor | |
ALExtractor (boost::shared_ptr< ALBroker > pBroker, const std::string &pName) | |
virtual | ~ALExtractor () |
virtual void | subscribe (const std::string &pSubscribedName, const int &pPeriod, const float &pPrecision) |
virtual void | subscribe (const std::string &pSubscribedName) |
virtual void | updatePeriod (const std::string &pSubscribedName, const int &pPeriod) |
virtual void | updatePrecision (const std::string &pSubscribedName, const float &pPrecision) |
virtual void | unsubscribe (const std::string &pSubscribedName) |
virtual int | getCurrentPeriod () |
virtual float | getCurrentPrecision () |
virtual int | getMyPeriod (const std::string &pSubscribedName) |
virtual float | getMyPrecision (const std::string &pSubscribedName) |
ALValue | getSubscribersInfo () |
Protected Member Functions | |
void | xUpdateParameters (const int pPeriod, const float pPrecision) |
void | setSubscriptionParameters (const std::vector< std::pair< int, int > > ¶meters) |
Protected Member Functions inherited from AL::ALExtractor | |
virtual float | getDefaultPrecision () |
virtual std::vector< std::string > | getOutputNames (void) |
std::vector< std::string > | getEventList (void) |
std::vector< std::string > | getMemoryKeyList (void) |
void | declareEvent (const std::string &event) |
void | declareMemoryKey (const std::string &key) |
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 |
int AL::ALVisionExtractor::getActiveCamera | ( | ) |
int AL::ALVisionExtractor::getColorSpace | ( | ) |
|
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::getFrameRate | ( | ) |
|
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.
|
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.
int AL::ALVisionExtractor::getResolution | ( | ) |
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. |
|
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 |
Sets the camera from which the image is taken.
cameraId | Desired camera ID. |
|
virtual |
Sets processed image colorspace on the fly.
colorSpace | Desired colorspace. |
|
virtual |
Sets extractor framerate on the fly.
framerate | Desired extractor 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 |
Sets processed image resolution on the fly.
resolution | Desired resolution. |
|
protected |
|
pure virtual |
Method which will be called before each subscription to the extractor.
|
pure virtual |
Method which will be called when the module is unsubscribed.
|
protectedvirtual |
Reimplemented from AL::ALExtractor.