PIXELBANKv8.2.1
Menu
Back to CV Study Plan
Week 3-4

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

1
Point Operators

Per-pixel transforms, gamma correction, and histograms — operations that don't depend on neighbors.

Linear TransformGamma CorrectionHistogram
2
Color Transforms

RGB to grayscale, HSV conversion, and color matrices — changing color representations.

RGB to GrayscaleRGB to HSVColor Matrix
Neighborhood operations

Linear and non-linear approaches

3
Linear Filtering

Convolution, separable filters, and Gaussian blur — the workhorse of image processing.

Convolution OperationSeparable FiltersGaussian Filter
4
Non-linear Filtering

Median, bilateral, and morphological filters — edge-preserving operations that convolution can't do.

Median FilterBilateral FilterMorphological Operations
Theory and practice

Frequency analysis and spatial warping

5
Fourier Transforms

DFT and the convolution theorem — understanding images in the frequency domain.

Fourier TransformDiscrete Fourier Transform (DFT)Convolution Theorem
6
Geometric Transforms

Affine, bilinear interpolation, and homography — warping images to new coordinate systems.

Affine TransformationBilinear InterpolationHomography

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

1Linear Transform
2Gamma Correction
3Histogram
1 of 3
Linear Transform

g(x,y)=αf(x,y)+βg(x,y) = \alpha \cdot f(x,y) + \beta

A point-wise operation that adjusts pixel intensities independently:

  • α\alpha (alpha): The gain or contrast multiplier. α>1\alpha > 1 increases contrast, α<1\alpha < 1 decreases it
  • β\beta (beta): The bias or brightness offset. Positive β\beta brightens, negative β\beta 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.

Mathematical Intuition

The linear point operator g=αf+βg = \alpha f + \beta is a scalar affine map applied independently to each pixel. In vector terms, if the image is a vector fRHW\mathbf{f} \in \mathbb{R}^{HW}, then g=αf+β1\mathbf{g} = \alpha \mathbf{f} + \beta \mathbf{1} is an element-wise affine transform that shifts the mean by β\beta and scales the variance by α2\alpha^2. Contrast stretching is the special case that maps [fmin,fmax][f_{\min}, f_{\max}] onto [0,255][0, 255] via α=255/(fmaxfmin)\alpha = 255 / (f_{\max} - f_{\min}), which is the unique affine map satisfying the two boundary conditions.

Example:

An image has pixel values in range [40, 180]. Find α\alpha and β\beta to stretch this to [0, 255].

2 of 3
Gamma Correction

g(x,y)=255(f(x,y)255)γg(x,y) = 255 \left( \frac{f(x,y)}{255} \right)^\gamma

A non-linear intensity mapping that compensates for display characteristics:

  • γ<1\gamma < 1: Brightens dark regions more than bright ones (useful for underexposed images)
  • γ>1\gamma > 1: Darkens midtones (useful for overexposed images)
  • γ=1\gamma = 1: No change (identity)

Human vision perceives brightness logarithmically, so gamma correction helps match display output to perceptual expectations. Standard sRGB uses γ2.2\gamma \approx 2.2.

Mathematical Intuition

Gamma correction applies the power-law nonlinearity g=255(f/255)γg = 255 (f/255)^\gamma, which is a monotonic concave function for γ<1\gamma < 1 and convex for γ>1\gamma > 1. The sRGB standard uses a piecewise function combining a linear segment near zero with a γ2.2\gamma \approx 2.2 power law. In information-theoretic terms, gamma encoding allocates more code values to dark tones where human contrast sensitivity dL/dIdL/dI is highest, effectively performing a form of perceptual quantization that minimizes visible banding for a fixed bit depth.

Example:

A pixel has intensity 100. What is its value after gamma correction with γ=0.5\gamma = 0.5 (brightening)?

3 of 3
Histogram

H(i)=x,yδ(f(x,y)i)H(i) = \sum_{x,y} \delta(f(x,y) - i)

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.

Mathematical Intuition

The histogram H(i)H(i) estimates the probability mass function p(i)=H(i)/Np(i) = H(i)/N of pixel intensities. Histogram equalization seeks a monotonic mapping TT such that the output CDF is approximately uniform: T(i)=(L1)CDF(i)T(i) = \lfloor (L-1) \cdot \text{CDF}(i) \rfloor where CDF(i)=j=0ip(j)\text{CDF}(i) = \sum_{j=0}^{i} p(j). This is an application of the probability integral transform — for continuous random variables, if XFX \sim F, then F(X)Uniform(0,1)F(X) \sim \text{Uniform}(0,1). The discrete version only approximates uniformity because the CDF is a step function.

Example:

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