cv_face_detection¶
Overview¶
The cv_face_detection application uses a selected camera to scan for faces for 10 seconds. If one or more faces are detected, it takes a snapshot, displays it on the robot’s chest screen, and logs the number of faces detected. If no faces are detected, it logs “No face detected” in the console.
Inputs¶
Optional command-line argument for selecting a camera (-c or –camera).
User input via terminal menu when no camera argument is provided.
Outputs¶
Log messages indicating the detection status.
A snapshot is captured and published to the robot’s chest display when a face is detected.
Execution¶
The application can be executed using:
Specify the camera directly using an argument:
python3 cv_face_detection/ --auto-run -c <camera_name>
python3 cv_face_detection/ --auto-run --camera <camera_name>
Select the camera via an interactive terminal menu:
If no camera argument is provided, the user will be prompted to select a camera from a menu:
python3 cv_face_detection/ --auto-run
If the terminal window is too small, a notification will appear instructing the user to resize it.
The user selects a camera by pressing the Enter key.
Behavior¶
The application enables the YunetFace model.
It subscribes to the detections topic for 10 seconds.
If no faces are detected, the following log message is displayed:
[INFO] [timestamp] [pyraya.cv_face_detection]: No face detected
- If one or more faces are detected:
A snapshot is taken and displayed on the chest screen.
A console log message is generated:
If one face is detected:
[INFO] [timestamp] [pyraya.cv_face_detection]: 1 face detected 👤
If multiple faces are detected:
[INFO] [timestamp] [pyraya.cv_face_detection]: <number> faces detected 👥
Example Output¶
During execution, the output logs follow this pattern:
[INFO] [timestamp] [pyraya.cv_face_detection]: Auto running the app
[WARNING] [timestamp] [pyraya.cv_face_detection]: Enabling Yunet Face model 👁️
[WARNING] [timestamp] [pyraya.cv_face_detection]: Subscribing to _gary_cv_detector_face_detections_1 topic 🦻
[WARNING] [timestamp] [pyraya.cv_face_detection]: Detecting faces...
[INFO] [timestamp] [pyraya.cv_face_detection]: 1 face detected 👤
Additionally, in case of a detection, an output image will be displayed on the chest.
Key Notes¶
If no faces are detected within 10 seconds, a log message is shown and nothing is published on the chest display.
If the camera or the chest display is unavailable, the application prints an error message and exits.