Images as data
Pixels, grids and coordinates, colour channels and colour spaces, and histograms for judging and fixing contrast.
About 4 hours of study
Learning objectives
- Read, crop, flip and invert images as grids
- Convert colour to greyscale and to HSV
- Stretch and equalise contrast with histograms
Lessons
- 1
Pixels, grids and coordinates Intermediate
An image is a grid of numbers. Learn how pixels, rows, columns and brightness values work, how to read, crop, flip and invert an image in plain Python, and how to print one as text shading.
- 2
Colour channels, colour spaces and greyscale Intermediate
A colour image stores three numbers per pixel. Split images into red, green and blue channels, convert colour to greyscale the way cameras and libraries do, and use the HSV colour space to find pixels of a chosen colour.
- 3
Histograms and contrast Intermediate
A histogram counts how many pixels have each brightness. Read histograms to judge exposure and contrast, stretch a dull image to the full range, and spread its levels evenly with histogram equalisation.
Module practice
- Computer vision: Size and brightness of an imageEasy
- Computer vision: Crop, flip, rotate and invertMedium
- Computer vision: Shade an image as textHard
- Computer vision: Colour to greyscaleEasy
- Computer vision: RGB to HSVMedium
- Computer vision: Find coloured pixels with HSVHard
- Computer vision: A histogram with binsEasy
- Computer vision: Stretch the contrastMedium
- Computer vision: Histogram equalisationHard