Due to scheduling conflicts, no recitation session on this topic was possible, however; to assist students in understanding Image Processing, this RHEA informational page was created. The material covered in this page covers topics presented in ECE438 lecture from 16-30 November. This page attempts to present a very general overview of the image filtering process, an understanding of boundary conditions, and examples of linear and non-linear filters.
Image Processing:
Image Filtering: process to sharpen or smooth image
f(m,n) → h(x,y) → g(m,n)
f(m,n) → input image h(x,y) → filter g(m,n) → filtered image
To calculate g(m,n) → h(m,n) ** f(m,n)
= ΣmΣn h(k,l) f(m-k, n-l)
= ΣkΣl h(m-k,n-l) f(k,l)
= ΣkΣl h_(k-m,l-n) f(k,l)
where
h_(x,y) = h(-m,-n)
Boundary Conditions:
Given a grid of pixels below, we are interested in determining a value for pixel(L) using the surrounding pixel values: A B C D E F G H I J K L M N O P
Several types of boundary conditions were discussed in lecture: FREE → filter image based only on pixels: {H, K, P}
TOROIDAL → filter image based on three surrounding pixels, and pixel from across image in the same row as L: {H, K, P, I}
REFLECTIVE → reflect pixel from inside image to outside boundary: {H, K, P, K}
SYMMETRIC → repeat edge row of pixels as boundary pixels: {H, K, P, L}
Examples of Image Filters:
Average filter: smoothes/blurs noise and edges.
h[k,l] = 1/16 * $ \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix} $
Note: the averaging filter is separable:
h[k,l] = 1/16 * $ \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix} = \begin{bmatrix} 1/4\\ 1/4\\ 1/2 \end{bmatrix} \begin{bmatrix} 1/4 & 1/2 & 1/4 \end{bmatrix} $
Since the filter is separable, H(u,v) = H(u) H(v)
If we Fourier Transform the filter, we discover that the filter is linear:
H(u) = Σ h(k)e-jku
= ¼ e-ju + ½ + ¼ e-ju
= ½(1 + cos(u))
Sobel Filter/Operator: detects edges in images. This operator returns a large response across edges, and no response when image is constant.
h[k,l] = 1/9 * $ \begin{bmatrix} -1 & -1 & -1 \\ -1 & 8 & -1 \\ -1 & -1 & -1 \end{bmatrix} $
Sharpening, using an Unsharpmask:
y[m,n] = f[m,n] + λ (f[m,n] - <f[m,n]>)
the component: f[m,n] - <f[m,n]> will mask the image with neighborhood average of pixels to extract variations in image.
f[m,n] + λ (variations): will add variations to sharpen original image.
How to calculate h[k,l]:
<f[m,n]> = ΣkΣl f[m+k, n+l] / (2M+1)2
where (2M+1) is the window size of the sample
g[m,n] = f[m,n] + λ (f[m,n] - <f[m,n]>)
= f[m,n] + λ ΣkΣl h’[k,l] f[m+k, n+l]
= ΣkΣl (δ[k,l] + λh’[k,l]) f[m+k, n+l]
the term: (δ[k,l] + λh’[k,l]) represents the filter – h_[k,l]
h_[k,l] =
$ \begin{bmatrix} -lambda/N^2 & -lambda/N^2 & -lambda/N^2 \\ -lambda/N^2 & 1 + -lambda(1-1/N^2) & -lambda/N^2 \\ -lambda/N^2 & -lambda/N^2 & -lambda/N^2 \end{bmatrix} $
Non-Linear Image Filters:
We cannot convolve non-linear filters. An example of a non-linear filter is a ‘Median Filter’.
g(m,n) = median{f[m+k, n+l]}
If we look at the following set of pixels, we can easily determine the median, but the filter is not separable and therefore not linear:
$ \begin{bmatrix} 4 & 2 & 100 \\ 3 & 1 & 5 \\ 8 & 7 & 6 \end{bmatrix} $
Partial Differential Equation based image processing:
Consider an image that evolves with time (τ).
I(x,y,τ), where I(x,y,0) = fc(x,y)
according to the differential equation;
δI / δτ = δ2I / dx2 + δ2I / δy2
the solution for the evolved image is:
I(x,y,τ) = fc(x,y) ** (1/4πτ) e (–x2+y2/4τ)
and h(x,y) = (1/4πτ) e (–x2+y2/4τ)
further, we could discretize the equation to arrive at a linear time-invariant system
Perona-Malik Filter:
The Perona-Malik Filter attempts to remove image noise while not removing any significant parts of the image content:
a Perona-Malik Filter can be defined by the following function:
g[m,n] = f[m,n] + λ {ψ(f[m-1,n] – f[m,n]) + ψ(f[m+1,n] – f[m,n]) + ψ(f[m,n-1] – f[m,n]) + ψ(f[m,n+1] – f[m,n])}
examining the above equation, it is possible to determine that if no feature edge exists in the window then all Δf values will be small, and thus, ψΔf ~ Δf
in this case, the above equation can be rewritten as:
g[m,n] = f[m,n] + λ {f[m-1,n] + f[m+1,n] +f[m,n-1] + f[m,n+1] – f[m,n])}
which is simply an averaging filter.
however; if an edge is present, one (or more) Δf values will be large, and for large Δf, ψΔf ~ Δf .
in this case, will resemble the average filter, but with one of the edge values equal to 0.