Computer Vision Series
1
Image Basics & Getting Started with OpenCV
What Is a Digital Image
Computer vision operates on digital images. At its core, a digital image is just a 2D array of pixels.
Pixels and Grayscale Images
A grayscale image is the simplest form—each pixel stores a single brightness value from 0 (pure black) to 255 (pure white). In Python, a grayscale image of width W and height H is a 2D array with shape (H, W):
| |
uint8 ranges from 0 to 255 because 8 bits can represent 2^8 = 256 unique values. If a pixel value exceeds its range, wrap around occurs: 255 + 1 becomes 0, not 256 (like an odometer rolling over). Use cv2.add() (saturating arithmetic) or np.clip() to prevent wrap around.