📚 Course contents
AI & Computer Vision, lesson 4 of 52
Images, Pixels & Colour Spaces: Finding the Pitch with HSV
Introduction
You know a pixel is three numbers. But which three numbers is a choice, and the right choice makes a computer-vision job easy or impossible. Today you'll meet four ways of describing colour, and use the best one, HSV, to make a computer find the green football pitch in a photo, even where the grass is in shadow.
By the end of this lesson you'll be able to:
- Explain what a pixel is and how an image is stored as a NumPy array
- Describe the RGB colour model and read single-channel values
- Convert an image between BGR, RGB, grayscale and HSV with OpenCV
- Explain why HSV is more useful than RGB for colour-based automation
- Write a function that isolates a colour range with
cv2.inRange() - Use a hue mask to isolate the green football pitch from a real image

