Block 114: Drawing & Annotation
Add shapes and text to images programmatically.
Concepts
- cv2.line(), cv2.rectangle(), cv2.circle(), cv2.ellipse()
- cv2.putText() with font, scale, color
- Copying images before annotation to preserve original
- Use cases: bounding boxes, labels
Code Examples
See exercise below.
Exercise
Draw a labeled bounding box (rectangle + text) around a specific region of an image. Create a 'blank canvas' 400×400 image and draw 5 different shapes on it.
Homework
What are the 3 parameters you must get right for cv2.putText() to display clearly? Wednesday