The outcome
Test a repeatable image pipeline before adding a live camera.
Documented target: Ubuntu 24.04 · ROS 2 Jazzy · Gazebo Harmonic where used. Browser labs tested; ROS/Ubuntu/hardware execution not performed here.
Before you begin
- Python 3 virtual environment
- OpenCV 4.x
- No camera needed for initial test
Prepare with Find a colour region with OpenCV.
Download project files →Build, observe, explain.
Create known input
Download the complete colour-mask script or use the lesson code.
Expected: A 100×100 image with a 50×50 green region.
Verify the mask
Run the script and inspect mask.png.
python colour_mask.pyExpected: 2500 selected pixels.
Vary inputs
Change brightness and thresholds; record inputs and selected fractions.
Expected: A table explaining selection changes.
Troubleshooting
- Camera inaccessible
- Prove the synthetic case first, then inspect device permissions.
- Background triggers
- Colour is not unique object identification.
Take it further
- Measure contour area/centroid.
- Add a calibrated ROS image pipeline.
Documentation and next steps
Explore another project · Return to learning · Report a project issue