Aldebaran documentation What's new in NAOqi 2.4.3?

ALFaceDetection API

NAOqi People Perception - Overview | API | Tutorial


Namespace : AL

#include <alproxies/alfacedetectionproxy.h>

Event list

Methods

bool ALFaceDetectionProxy::clearDatabase()

Removes all learned faces from the database.

Returns:true if the operation succeeded
bool ALFaceDetectionProxy::forgetPerson(const std::string& name)

Deletes from the database all learned faces corresponding to the specified person.

Parameters:
  • name – The name of the person to forget
Returns:

true if the operation succeeded

AL::ALValue ALFaceDetectionProxy::getLearnedFacesList()

Gets a list containing the name of each learned face. The size of this list is always equal to the number of faces in the data base.

Returns:List of names
float ALFaceDetectionProxy::getRecognitionConfidenceThreshold()

Returns the current threshold value used for face recognition.

Returns:Threshold value.
bool ALFaceDetectionProxy::importOldDatabase(const std::string& policy)

Conversion tool. Converts an old data base (NAOqi version < 1.22) to the new format. This needs to be run only once.

If the module ALFaceDetection has already faces in its data base, you can still import an old data base. Its content will be merged and conflicting entries (i.e. faces with the same name) will be dealt with according to the specified policy.

Parameters:
  • policy

    Merge policy if an imported entry has the same name as an existing one.

    “overwrite” to replace the existing entry by the imported one,

    “merge” to merge data from both entries (if they don’t relate to the same person, face recognition may fail),

    “keep” to keep the existing entry and ignore the imported one.

bool ALFaceDetectionProxy::isRecognitionEnabled()

Returns whether recognition is enabled. Recognition is enabled by default.

Returns:true/false
bool ALFaceDetectionProxy::isTrackingEnabled()

Returns whether tracking is enabled. Tracking is enabled by default.

Returns:true/false
bool ALFaceDetectionProxy::learnFace(const std::string& name)

Learns a new face and adds it in the database under the specified name.

Parameters:
  • name – The name of the person to learn
Returns:

true if the operation succeeded

bool ALFaceDetectionProxy::reLearnFace(const std::string& name)

Adds a new identification picture to a specific user record.

Learning a user’s face from different images with different head poses can improve the recognition results. Up to 10 images can be stored for each person, after which any new image will replace the oldest one, in a rolling buffer fashion.

Parameters:
  • name – The name of the person to learn
Returns:

true if the operation succeeded

Note

if two different persons are recognized in less than 7 seconds, only the first one can be relearned.

void ALFaceDetectionProxy::setRecognitionConfidenceThreshold(float threshold)

Sets a new threshold value for face recognition. This value must be between 0 and 1, with a default of 0.4. Refer to Threshold for a more complete explanation.

Parameters:
  • threshold – new threshold value.
void ALFaceDetectionProxy::setRecognitionEnabled(const bool& enable)

Enables/disables the face recognition process. The remaining face detection process will be faster if face recognition is disabled. Face recognition is enabled by default.

Parameters:
  • enable – true/false
void ALFaceDetectionProxy::setTrackingEnabled(const bool& enable)

Enables/disables face tracking. Enabling tracking usually allows you to follow a face even if the corresponding person is not facing the camera anymore. However, it can lead to more false detections. When active, only one face at a time will be detected.

Parameters:
  • enable – true/false
void ALFaceDetectionProxy::enableRecognition(const bool& enable)

Deprecated since version 2.0: Use ALFaceDetectionProxy::setRecognitionEnabled instead.

void ALFaceDetectionProxy::enableTracking(const bool& enable)

Deprecated since version 2.0: Use ALFaceDetectionProxy::setTrackingEnabled instead.

Events

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

Raised when one or several faces are currently being detected.

Parameters:
  • eventName (std::string) – “FaceDetected”
  • value – Informations related to the detected faces. Please refer to ALFaceDetection for details.
  • subscriberIdentifier (std::string) –