libalvision  2.1.4.13
 All Classes Namespaces Files Functions Variables Macros Pages
Public Member Functions | Protected Member Functions | List of all members
AL::ALVisionExtractor Class Referenceabstract

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 &paramName, const ALValue &paramValue)
 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 ()
 
virtual std::string httpGet ()
 

Protected Member Functions

void xUpdateParameters (const int pPeriod, const float pPrecision)
 
void setSubscriptionParameters (const std::vector< std::pair< int, int > > &parameters)
 
- 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)
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
[in]pBrokerBroker use to register the vision extractor.
[in]pNameName of the Vision Extractor.
resolutionResolution of the images the extractor will process at module startup. Default value is 1 (QVGA resolution).
colorspaceColorspace of the images the extractor will process at module startup. Default value is BGR colorspace.
framerateFramerate of the images the extractor will process at module startup. Default value is 30.
[in]activecameraIndex of the active camera -1 to use the default one.
virtual AL::ALVisionExtractor::~ALVisionExtractor ( )
virtual

Member Function Documentation

int AL::ALVisionExtractor::getActiveCamera ( )
int AL::ALVisionExtractor::getColorSpace ( )
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::getFrameRate ( )
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.

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.

Parameters
pausedtrue 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.

Parameters
imgPointer 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.

Parameters
cameraIdDesired camera ID.
Returns
True if the camera has been successfully set.
virtual bool AL::ALVisionExtractor::setColorSpace ( const int &  colorSpace)
virtual

Sets processed image colorspace on the fly.

Parameters
colorSpaceDesired colorspace.
Returns
True if the colorspace has been successfully set.
virtual bool AL::ALVisionExtractor::setFrameRate ( const int &  framerate)
virtual

Sets extractor framerate on the fly.

Parameters
framerateDesired extractor framerate.
Returns
True if the framerate has been successfully set.
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.

Parameters
paramNameName of the parameter to set ("resolution" or "pause")
paramValueALValue array of the value to be set.
Deprecated:
Use setResolution or pause instead.
virtual bool AL::ALVisionExtractor::setResolution ( const int &  resolution)
virtual

Sets processed image resolution on the fly.

Parameters
resolutionDesired resolution.
Returns
True if the resolution has been successfully set.
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 
)
protectedvirtual

Reimplemented from AL::ALExtractor.


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