# ALVisionRecognition API ¶

NAOqi Vision - Overview | API | Tutorial

Namespace : AL



#include <alproxies/alvisionrecognitionproxy.h>



## Method list ¶

class  ALVisionRecognitionProxy 
• As any module, this module inherits methods from ALModule API .
• It also inherits methods from ALExtractor API .
• It also has the following specific methods:

## Methods ¶

bool  ALVisionRecognitionProxy::   changeDatabase  ( const std::string& databasePath , const std::string& databaseName )

By default, databases are located on the robot in “/home/nao/naoqi/.local/share/naoqi/vision/visionrecognition/” folder. The default database name is “current”.

This method allows to choose another database by providing its name and folder. For further details, see: Teaching NAO to recognize objects .

 Parameters: databasePath – Absolute path of the database on the robot, or “” to set default path. databaseName – Name of the database, or “” to set default database name. true if success.
void  ALVisionRecognitionProxy::   clearCurrentDatabase  ( )

Clear the current database. Warning: all files in the database folder will be deleted.

void  ALVisionRecognitionProxy::   detectFromFile  ( const std::string& filename )

Search for known objects in the given image file.

 Parameters: filename – Absolute filename of the image to be searched.
int  ALVisionRecognitionProxy::   getMaxOutObjs  ( )

Get the maximal number of detected objects for each detection.

 Returns: Number of maximal objects to be detected.
int  ALVisionRecognitionProxy::   getSize  ( )

Get the size of the current database, i.e. number of objects stored in the database.

 Returns: Number of objects in the current database.
std::string  ALVisionRecognitionProxy::   getParam  ( const std::string& paramName )

Get vision recognition parameters. Available parameters are:

• “db_path”: database path on the robot
• “db_name”: database name
 Parameters: paramName – Name of the parameter to get. Value of the parameter as a string.
bool  ALVisionRecognitionProxy::   learnFromFile  ( const std::string& filename , const std::string& name , const std::vector<std::string>& tags , bool isWholeImage = true, bool forced = false )

Load the image from the given filename and learn it with given information about name, tags, boundary.

 Parameters: image – Image to interpret as an object. name – Name of the object, must be a non-empty string. tags – List of tags of the object, to be stored with the object, can be empty. isWholeImage – Boolean, True by default. True: the object occupies the whole image. False: automatic detection of the border of the object. Use only when the object stands out well from an uni-color background. forced – Boolean, False by default. True: the learned object will replace a possible existing object (criteria: having the same original filename). False: if a object alreay exists with the same filename it won’t be replaced and the method will abort. true if success, false otherwise.
void  ALVisionRecognitionProxy::   setMaxOutObjs  ( int maxOutObjs )

Set the maximal number of detected objects for each detection.

 Parameters: iMaxOutObjs – Number of desired objects to be detected between 1 (default) and 10.
void  ALVisionRecognitionProxy::   setParam  ( const std::string& paramName , const AL::ALValue& paramValue )

Deprecated since version 1.22: “resolution” can now be set with  ALVisionExtractor::setResolution  ; “scoreThreshold” is not used anymore.

## Events ¶

Event:  "PictureDetected" 
callback ( std::string eventName , AL::ALValue value , std::string subscriberIdentifier )

Raised when a visual pattern previously learned is recognized.

 Parameters: eventName ( std::string ) – “PictureDetected” value – Informations related to the detected picture. Please refer to ALVisionRecognition for details. subscriberIdentifier ( std::string ) –