Block 112: Color Spaces & Grayscale
Convert between color spaces and understand their use.
Concepts
- cv2.cvtColor() with COLOR_BGR2GRAY, COLOR_BGR2HSV
- Single-channel (grayscale) vs 3-channel images
- Histograms of color channels
- Color segmentation concept with HSV
Code Examples
See exercise below.
Exercise
Convert an image to grayscale and HSV. Display all 3 versions side by side. Plot the histogram of the red, green, and blue channels separately.
Homework
Why is HSV (Hue, Saturation, Value) useful for color-based object detection compared to BGR? Tuesday