cv_object_segmentator¶
Overview¶
The cv_object_segmentator example captures an image every 5 seconds using a selected camera and displays it on the robot’s chest screen. If objects are detected, the application highlights their contours using segmentation.
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 every 5 seconds and displayed on the robot’s chest screen.
If objects are detected, segmentations are drawn on the image.
The console logs the detected objects’ names.
Execution¶
The application can be executed using:
Specify the camera directly using an argument:
python3 cv_object_segmentator/ --auto-run -c <camera_name>
python3 cv_object_segmentator/ --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_object_segmentator/ --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 object segmentator model.
It captures an image every 5 seconds.
The captured image is displayed on the chest screen.
If no objects are detected, the following log message is displayed:
[INFO] [timestamp] [pyraya.cv_object_segmentator]: No objects detected
- If one or more objects are detected:
Segmentations are drawn around the detected objects.
A console log message is generated:
If one object is detected:
[INFO] [timestamp] [pyraya.cv_object_segmentator]: 1 object detected [INFO] [timestamp] [pyraya.cv_object_segmentator]: - <object_name>
If multiple objects are detected:
[INFO] [timestamp] [pyraya.cv_object_segmentator]: <number> objects detected [INFO] [timestamp] [pyraya.cv_object_segmentator]: - <object1_name> [INFO] [timestamp] [pyraya.cv_object_segmentator]: - <object2_name> ...
Example Output¶
During execution, the output logs follow this pattern:
[INFO] [timestamp] [pyraya.cv_object_segmentator]: Auto running the app
[WARNING] [timestamp] [pyraya.cv_object_segmentator]: Enabling object detection model 🔍
[WARNING] [timestamp] [pyraya.cv_object_segmentator]: Capturing image...
[INFO] [timestamp] [pyraya.cv_object_segmentator]: 1 object detected
[INFO] [timestamp] [pyraya.cv_object_segmentator]: - <object_name>
Additionally, the output image will be displayed on the chest.
Key Note¶
If the camera or chest display is unavailable, the application logs an error and exits.