Lecture

Image Enhancement

Consists of two spatial filters:

  1. Smoothing (lowpass)
  2. Sharpening (highpass)

There are two types of smoothing filters:

  1. Linear
  • Box Filter Kernels
  • Lowpass Gaussian Filter Kernels
  1. Nonlinear
  • Order-Statistic Filters

IMPORTANT: In terms of box filters, if the kernel size gets bigger, then the image will be much blurier, since the average of pixels increase.

Disadvantages of box filters:

  1. Blurry Edges
  2. Equal Weighting
  3. Noise Handling
  4. Visual Artifacts

Nonlinear: Order-Statistic Filters

Works based on the ordering (ranking) of pixels in the region encompassed by the neighborhood.

You must rank (sort from ascending) the numbers in the image first, then find the median of those numbers and replace the origin/middle value of the image w/ the numbers that you have sorted.

This filter would better smooth the image.

Benefits of Median Over Average Filters:

  1. Outlier Resistance
  2. Edge Preservation
  3. Non-linear Flexibility
  4. Effective in Noise

Sharpening (highpass) Filters:

For averaging, it would make the image less detailed and blurry since it is blending the intensities via integration.

For sharpening, it would make details clearer and more defined since it is highlighting the edges and contrasts via differentiation.

Different types of derivatives:

In image sharpening, there are different types of derivatives.

The first derivative - Highlights the rapid changes in intensity (edges) The second derivative - Detects areas where intensity changes begin or end

NOTE: A derivative is a continous function

Derivatives are useful to edge detection.

For first-order derivatives of a 1D function, it is represented using the formula: $\frac{df}{dx} = f(x+1) - f(x)$ Order: x, x+1

For second-order derivatives of a 1D function, it is represented using the formula: $\frac{d^2f}{dx^2} = f(x+1)+f(x-1)-2f(x)$ Order: x-1, x, x+1

NOTE: Look at canvas notes to see the outputs of the first and second derivatives.

  • Ramp - downwards slope that decrements by $n$
  • Step - upwards slope that increments by $n$
  • Edge/intensity transition - when the first and second derivative values are the same.
  • Zero Crossing - when connecting the first and second derivative value by using a line, it crosses the x-axis. Says that there is a change in signal or intensity.
  • Constant intensity - when the values of either the first or second derivative does not change.

Second-Order Derivatives - The Laplacian

It enhances the edges by highlighting the second derivative’s zero crossings.

$\frac{d^2f}{dx^2} = f(x+1, y) + f(x-1, y) - 2f(x,y)$ $\frac{d^2f}{dx^2} = f(x,y+1) + f(x,y-1) - 2f(x,y)$

If we replace the two second-derivative terms, then the formula is denoted as: $\delta^2f(x,y) = f(x+1,y) + f(x-1,y)$

In terms of the kernels are being used: if c = 1, then add else if c = -1, then subtract

Steps for Unsharp Masking and Highboost Filtering

  1. Blur the original image
  2. Subtract the blurred image from the orginal (resulting difference is called a mask)
  3. Add the mask to the original

NOTE: Potential MC question for this topic

Gradient

  • First derivatives are implemented using the magnitude of the gradient.

Reading

Summary