60-second card
Pixels and channels
An image is a grid of pixels. A colour image has 3 channels (red, green, blue), each 0 to 255.
- Shape is usually (height, width, channels), like (224, 224, 3).
- Greyscale has 1 channel.
- One 224×224 colour image is 150,528 numbers.
import numpy as np
img = np.zeros((224, 224, 3), dtype=np.uint8)
print(img.shape, img.size)Prints
(224, 224, 3) 150528Remember: Height comes first in the shape, then width.
Common mistake: Mixing up channel order: OpenCV loads BGR, most others use RGB.