upgrade
upgrade

๐Ÿ‘๏ธComputer Vision and Image Processing

Image Enhancement Techniques

Study smarter with Fiveable

Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.

Get Started

Why This Matters

Image enhancement sits at the foundation of nearly every computer vision pipeline you'll encounter. Before any algorithm can detect objects, recognize faces, or segment scenes, the input image often needs preprocessing to correct for poor lighting, sensor noise, or low contrast. You're being tested on your understanding of how these techniques manipulate pixel values and when to apply each oneโ€”not just what they're called.

The techniques in this guide demonstrate core principles: intensity transformations, spatial domain operations, frequency domain analysis, and adaptive processing. Exam questions will ask you to select the appropriate technique for a given scenario, explain the mathematical basis behind a method, or compare approaches for noise reduction versus edge preservation. Don't just memorize definitionsโ€”know what problem each technique solves and the tradeoffs involved.


Intensity Transformation Techniques

These methods operate directly on pixel values using mathematical functions, transforming the input intensity to an output intensity without considering neighboring pixels. The key principle: a point operation applies the same transformation function to every pixel independently.

Histogram Equalization

  • Redistributes pixel intensities to achieve a more uniform histogramโ€”this spreads out the most frequent intensity values, effectively increasing global contrast
  • CDF-based mapping transforms each pixel using the cumulative distribution function of the original histogram, computed as sk=(Lโˆ’1)โˆ‘j=0kpr(rj)s_k = (L-1) \sum_{j=0}^{k} p_r(r_j)
  • Best for low-contrast images where pixel values cluster in a narrow range; less effective when you need to preserve specific tonal relationships

Contrast Stretching

  • Linear mapping expands intensity range from [rmin,rmax][r_{min}, r_{max}] to [0,Lโˆ’1][0, L-1], using the formula s=rโˆ’rminrmaxโˆ’rminร—(Lโˆ’1)s = \frac{r - r_{min}}{r_{max} - r_{min}} \times (L-1)
  • Simpler than histogram equalization because it uses a linear transformation rather than histogram-dependent mapping
  • Sensitive to outliersโ€”a single very bright or dark pixel can limit the stretch effect for the rest of the image

Gamma Correction

  • Nonlinear power-law transformation defined as s=cโ‹…rฮณs = c \cdot r^\gamma, where ฮณ<1\gamma < 1 brightens and ฮณ>1\gamma > 1 darkens the image
  • Targets mid-tones specifically while leaving very dark and very bright regions relatively unchangedโ€”unlike linear stretching
  • Compensates for display nonlinearity since monitors and human vision don't perceive brightness linearly; standard sRGB uses ฮณโ‰ˆ2.2\gamma \approx 2.2

Compare: Histogram Equalization vs. Contrast Stretchingโ€”both improve contrast, but histogram equalization adapts to the image's actual distribution while contrast stretching applies a fixed linear mapping. If an exam question mentions "adaptive contrast improvement," histogram equalization is your answer.


Spatial Domain Filtering

Spatial filters modify pixel values based on the values of neighboring pixels within a defined kernel or window. The underlying mechanism: convolution of the image with a filter mask determines whether you smooth, sharpen, or detect features.

Spatial Filtering (Smoothing and Sharpening)

  • Smoothing uses averaging kernels like the box filter or Gaussian kernel to blur images and reduce high-frequency noise
  • Sharpening enhances edges by subtracting a smoothed version or using Laplacian-based kernels that respond to second-order derivatives
  • Kernel size mattersโ€”larger kernels produce stronger effects but may blur fine details or create halos around edges

Unsharp Masking

  • Sharpens by adding a scaled difference between the original and blurred image: g(x,y)=f(x,y)+k[f(x,y)โˆ’fblur(x,y)]g(x,y) = f(x,y) + k[f(x,y) - f_{blur}(x,y)]
  • Parameter kk controls sharpening strengthโ€”values typically range from 0.5 to 2.0; too high causes ringing artifacts
  • Industry standard in photography and medical imaging where subtle detail enhancement improves diagnostic value

Noise Reduction Techniques

  • Mean filtering averages neighbors but blurs edges; median filtering replaces with median value and preserves edges better
  • Gaussian filtering weights neighbors by distance using G(x,y)=12ฯ€ฯƒ2eโˆ’x2+y22ฯƒ2G(x,y) = \frac{1}{2\pi\sigma^2}e^{-\frac{x^2+y^2}{2\sigma^2}}, providing smooth blur with controllable spread
  • Salt-and-pepper noise responds best to median filtering while Gaussian noise responds better to Gaussian or averaging filters

Adaptive Filtering

  • Adjusts filter behavior based on local statistics like varianceโ€”applies stronger smoothing in uniform regions, weaker near edges
  • Wiener filter is a classic example that minimizes mean square error by adapting to local signal and noise characteristics
  • Outperforms fixed filters when noise levels or image content vary across the frame; essential for real-world applications

Compare: Median Filter vs. Gaussian Filterโ€”both reduce noise, but median filtering is nonlinear and excels at removing salt-and-pepper noise while preserving edges. Gaussian filtering is linear and better for Gaussian-distributed noise but blurs edges. FRQs often ask which filter to choose for a specific noise type.


Edge and Boundary Detection

Edge detection identifies locations where intensity changes rapidly, marking boundaries between regions. The mathematical basis: edges correspond to high values of the first derivative (gradient) or zero-crossings of the second derivative (Laplacian).

Edge Detection

  • Gradient-based operators like Sobel compute G=Gx2+Gy2G = \sqrt{G_x^2 + G_y^2} using horizontal and vertical derivative approximations
  • Canny edge detector is multi-stage: Gaussian smoothing โ†’ gradient computation โ†’ non-maximum suppression โ†’ hysteresis thresholding
  • Prewitt and Roberts operators are simpler alternatives; Canny remains the gold standard for accuracy and noise robustness

Image Thresholding

  • Converts grayscale to binary using g(x,y)=1g(x,y) = 1 if f(x,y)>Tf(x,y) > T, else 00โ€”critical for segmentation pipelines
  • Global thresholding uses one value for entire image; Otsu's method automatically selects TT by maximizing between-class variance
  • Adaptive thresholding computes local thresholds for images with uneven illuminationโ€”essential for document scanning and OCR

Compare: Global Thresholding vs. Adaptive Thresholdingโ€”global works when lighting is uniform, but adaptive thresholding handles shadows and gradients by computing thresholds from local neighborhoods. If an exam scenario mentions "varying illumination," adaptive is the correct choice.


Frequency Domain Processing

Frequency domain methods transform images using the Fourier Transform, allowing manipulation of specific frequency components. The core insight: low frequencies carry overall structure and smooth variations; high frequencies encode edges, noise, and fine details.

Frequency Domain Filtering

  • Fourier Transform converts spatial data to frequency representation: F(u,v)=โˆ‘x=0Mโˆ’1โˆ‘y=0Nโˆ’1f(x,y)eโˆ’j2ฯ€(ux/M+vy/N)F(u,v) = \sum_{x=0}^{M-1}\sum_{y=0}^{N-1}f(x,y)e^{-j2\pi(ux/M + vy/N)}
  • Low-pass filters attenuate high frequencies to smooth images; high-pass filters attenuate low frequencies to sharpen or detect edges
  • Butterworth and Gaussian filters provide smoother transitions than ideal filters, avoiding ringing artifacts from sharp cutoffs

Compare: Spatial Domain vs. Frequency Domain Filteringโ€”spatial filtering is intuitive and efficient for small kernels, while frequency domain filtering excels for large kernels and allows precise control over which frequencies to modify. Know that convolution in spatial domain equals multiplication in frequency domain.


Quick Reference Table

ConceptBest Examples
Point operations (intensity transforms)Histogram Equalization, Contrast Stretching, Gamma Correction
Linear spatial filteringGaussian Smoothing, Mean Filter, Sharpening Kernels
Nonlinear spatial filteringMedian Filter, Adaptive Filtering
Edge detectionSobel, Canny, Prewitt
SegmentationImage Thresholding, Otsu's Method
Frequency domainFourier Transform, Low-pass/High-pass Filters
Detail enhancementUnsharp Masking, High-pass Filtering
Noise-specific solutionsMedian (salt-and-pepper), Gaussian filter (Gaussian noise)

Self-Check Questions

  1. Which two techniques both improve contrast but differ in whether they adapt to the image's histogram distribution? Explain when you'd choose one over the other.

  2. You're given an image corrupted by salt-and-pepper noise. Compare the effectiveness of mean filtering versus median filtering, and justify which you'd select.

  3. Explain how unsharp masking achieves sharpening without directly computing derivatives. What parameter controls the strength of the effect?

  4. An FRQ presents an image with uneven lighting across the frame. Compare global thresholding with adaptive thresholdingโ€”which would you recommend and why?

  5. Describe the relationship between spatial domain convolution and frequency domain multiplication. Why might you choose frequency domain filtering for a very large smoothing kernel?