Tuesday, July 08, 2008

image filters in time domain, Nyquist Frequency

almost totally forgot the low pass, high pass filter in time domain

blurring-> lowpass filtering or smoothing
[ 1 1 1 ]
[ 1 1 1 ] x 1/9
[ 1 1 1 ]

Gaussian smoothers:
G[x,y] = e^{-(x^2 + y^2_/2\delta ^2} / 2pi \delta^2
\delta = width of filter
-- small \delta leads to narrow filter with high cut-off frequency
-- large \delta leads to wide filters with low cut-off frequency

sharpening-> DC preserving highpass filters
[ 0 -1  0 ]  [ -1 -1 -1 ]  [ 1 -2   1 ]
[-1  5 -1 ]  [ -1  9 -1 ]  [-2  5  -2 ]
[ 0 -1  0 ]  [ -1 -1 -1 ]  [ 1 -2   1 ]

laplacian edge detector:
[ 0  1 0 ]  [ 1 1  1 ]
[ 1 -4 1 ]  [ 1 -8 1]
[ 0  1 0 ]  [ 1 1  1 ]

embossing:
[ -1 0 0 ]
[  0 0 0 ]
[  0 0 1 ]

median filter, weighted median filter

To avoid aliasing, the minimum sampling rate is at least twice the highest frequency of the signal. -- Nyquist rate.

Edge Detection->Coolest thing ever.
Define an edge as a sharp gradient, that is a gradient stronger than some predefined threshold.

Discrete derivative: Edge. \delta (X[n]) = X[n] - X[n-1]. In two dimensions, have both a row and column gradient.

Discrete 2D derivative: for edge detection, we want the magnitude of the gradient. |\delta f(x,y)|^2 = (df(x,y)/dx)^2 + (df(x,y)/dy)^2.

How to calculate |\delta f(x,y)| for discrete f[m,n]?
|\delta f[m,n]| = (Hr^2 [m,n] + Hc^2 [m,n]) ^ (1/2), where
Hr = Fr * I, and Hc = Fc * I.

Fr = [ 0 0 -1]  [ 1 0 -1]  [ 1 0 -1]  [ 1         0 -1]
       [ 0 1 0 ], [ 1 0 -1], [ 2 0 -2], [sqrt(2) 0 -sqrt(2)]
       [ 0 0 0 ]  [ 1 0 -1]  [ 1 0 -1]  [ 1         0 -1 ]

Fc = [ -1 0 0]  [-1 -1 -1]  [-1 -2 -1]  [-1 -sqrt(2) -1]
       [ 0 1 0 ], [ 0  0  0 ], [ 0  0  0], [ 0      0      0 ]
       [ 0 0 0 ]  [ 1  1  1 ]  [ 1  2  1]   [ 1  sqrt(2)  1 ]

       Roberts, Prewitt,    Sobel,       Frie-Chen

Now notice:

____/~~~~~   : f(x)

____/\____   : f'(x)

___/\     ___  : f''(x) 
          \/

f''(x) crosses the 0-point at all possible edges. Check the above laplacian edge detector.

No comments:

Post a Comment