Chapter 3: Image Processing
Fundamental techniques for manipulating and enhancing digital images
Chapter Overview
Now that we understand how images are formed, it's time to manipulate them. Image processing provides the tools to enhance, filter, and transform images.
What is this chapter about? We cover the fundamental operations that transform pixel values—from simple brightness adjustments to sophisticated filtering using convolution. These are the building blocks used in every computer vision pipeline.
Why does this matter? Before any high-level analysis, images usually need preprocessing:
- Noise reduction to clean up sensor artifacts
- Contrast enhancement to make features more visible
- Edge detection to find boundaries between regions
- Frequency analysis to understand image structure at different scales
How the topics connect: We start with point operators that transform each pixel independently—simple but powerful. Then linear filtering introduces convolution, which considers neighborhoods of pixels. We explore the frequency domain where convolution becomes multiplication, enabling efficient processing. Finally, histogram analysis provides tools for contrast enhancement and image comparison.
Chapter Roadmap
Click any topic to jump in
Point Operators
Per-pixel transforms, gamma correction, and histograms — operations that don't depend on neighbors.
Color Transforms
RGB to grayscale, HSV conversion, and color matrices — changing color representations.
Linear and non-linear approaches
Linear Filtering
Convolution, separable filters, and Gaussian blur — the workhorse of image processing.
Non-linear Filtering
Median, bilateral, and morphological filters — edge-preserving operations that convolution can't do.
Frequency analysis and spatial warping
Fourier Transforms
DFT and the convolution theorem — understanding images in the frequency domain.
Geometric Transforms
Affine, bilinear interpolation, and homography — warping images to new coordinate systems.
Point operators are the simplest image transformations—each output pixel depends only on the corresponding input pixel. Despite their simplicity, they're incredibly useful for adjusting brightness, contrast, and applying tone curves.
These operations are also blazingly fast since pixels can be processed in parallel with no dependencies.
In this topic
Linear Transform
A point-wise operation that adjusts pixel intensities independently:
- (alpha): The gain or contrast multiplier. increases contrast, decreases it
- (beta): The bias or brightness offset. Positive brightens, negative darkens
Used for basic image enhancement, exposure correction, and normalizing images before processing. The transformation is linear because output is a linear function of input.
The linear point operator is a scalar affine map applied independently to each pixel. In vector terms, if the image is a vector , then is an element-wise affine transform that shifts the mean by and scales the variance by . Contrast stretching is the special case that maps onto via , which is the unique affine map satisfying the two boundary conditions.
An image has pixel values in range [40, 180]. Find and to stretch this to [0, 255].
Gamma Correction
A non-linear intensity mapping that compensates for display characteristics:
- : Brightens dark regions more than bright ones (useful for underexposed images)
- : Darkens midtones (useful for overexposed images)
- : No change (identity)
Human vision perceives brightness logarithmically, so gamma correction helps match display output to perceptual expectations. Standard sRGB uses .
Gamma correction applies the power-law nonlinearity , which is a monotonic concave function for and convex for . The sRGB standard uses a piecewise function combining a linear segment near zero with a power law. In information-theoretic terms, gamma encoding allocates more code values to dark tones where human contrast sensitivity is highest, effectively performing a form of perceptual quantization that minimizes visible banding for a fixed bit depth.
A pixel has intensity 100. What is its value after gamma correction with (brightening)?
Histogram
A frequency distribution showing how many pixels have each intensity value:
- Narrow histogram: Low contrast image (values clustered)
- Wide histogram: High contrast (full range used)
- Skewed left: Dark image (most pixels have low values)
- Skewed right: Bright image
Histogram equalization redistributes intensities to achieve a more uniform histogram, automatically enhancing contrast.
The histogram estimates the probability mass function of pixel intensities. Histogram equalization seeks a monotonic mapping such that the output CDF is approximately uniform: where . This is an application of the probability integral transform — for continuous random variables, if , then . The discrete version only approximates uniformity because the CDF is a step function.
A 4×4 grayscale image has values: [0,0,1,1, 0,1,2,2, 1,2,2,3, 2,3,3,3]. Compute its histogram for range [0,3].
Theory Exercise
Problem:
An 8-bit grayscale image has pixel values ranging from 50 to 150. You want to stretch this to use the full range [0, 255]. What linear transformation parameters (α, β) should you use?
Hints:
- Find the current range: max - min
- Target range is 255 - 0 = 255
- α (gain) = target_range / current_range
- β (bias) must map the minimum value to 0