.. _alfacedetection-api: ALFaceDetection API =================== :ref:`Overview ` | API | :ref:`Tutorial ` Namespace : **AL** .. code-block:: cpp #include Method list ----------- .. cpp:class:: ALFaceDetectionProxy * Methods: * :cpp:func:`ALFaceDetectionProxy::clearDatabase` * :cpp:func:`ALFaceDetectionProxy::enableRecognition` * :cpp:func:`ALFaceDetectionProxy::enableTracking` * :cpp:func:`ALFaceDetectionProxy::isTrackingEnabled` * :cpp:func:`ALFaceDetectionProxy::learnFace` * :cpp:func:`ALFaceDetectionProxy::reLearnFace` * :cpp:func:`ALFaceDetectionProxy::subscribe` * :cpp:func:`ALFaceDetectionProxy::unsubscribe` .. seealso:: * :ref:`Methods inherited from ALModule ` Methods ------- .. cpp:function:: bool ALFaceDetectionProxy::clearDatabase() Remove all learned faces from the database. :return: true if the operation succeeded .. cpp:function:: void ALFaceDetectionProxy::enableRecognition(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. :param enable: True/False .. cpp:function:: void ALFaceDetectionProxy::enableTracking(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. :param enable: True/False .. cpp:function:: bool ALFaceDetectionProxy::forgetPerson(const std::string& name) Delete from the database all learned faces corresponding to the specified person. :param name: The name of the person to forget :return: true if the operation succeeded .. cpp:function:: bool ALFaceDetectionProxy::isTrackingEnabled() Returns whether tracking is enabled. Tracking is enabled by default. :return: True/False .. cpp:function:: bool ALFaceDetectionProxy::learnFace(const std::string& name) Learn a new face and add it in the database under the specified name. :param name: The name of the person to learn :return: true if the operation succeeded .. cpp:function:: bool ALFaceDetectionProxy::reLearnFace(const std::string& name) Use in a new learning process the latest images where a face has been wrongly recognized. In details, when a face is recognized a serie of few images before and after the recognition are kept in memory in a rolling buffer for 7 seconds. If this method is called, these images are going to feed the learning stage in order to associate the correct name to this face. :param name: The name of the person to learn :return: true if the operation succeeded .. note:: if two different persons are recognized in less than 7 seconds, only the first one can be relearned. .. cpp:function:: void ALFaceDetectionProxy::subscribe(const std::string& name, const int& period, const float& precision) Subscribes to **ALFaceDetection** with the specified parameters. This causes the module to start writing information to **ALMemory** in *"FaceDetected"*. This can be accessed in *ALMemory* using :cpp:func:`ALMemoryProxy::getData`. :param name: Name to identify the subscriber :param period: Refresh period (in milliseconds) :param precision: Precision of the extractor (not relevant here, value not taken into account). .. cpp:function:: void ALFaceDetectionProxy::subscribe(const std::string& name) Subscribes to **ALFaceDetection**. This causes the module to start writing information to **ALMemory** in *"FaceDetected"*. This can be accessed in *ALMemory* using :cpp:func:`ALMemoryProxy::getData`. :param name: Name to identify the subscriber .. cpp:function:: void ALFaceDetectionProxy::unsubscribe(const std::string& name) Unsubscribes to **ALFaceDetection**. This causes the module to stop writing information to **ALMemory** in *"FaceDetected"*. :param name: Name to identify the subscriber (as used in :cpp:func:`ALFaceDetectionProxy::subscribe`).