Practical Image Processing1 Chap7 Image Transformation Image and Transformed image Spatial Transformed domain Transformation domain Fourier, DCT Image and Transformed image Spatial Transformed domain Transformation domain h(x,y) Fourier, DCT F(u,v) Processing in the transformed domain : u Filtering, Compression, Description Fourier transform : 1807 Fourier u any periodic signal can be represented as a weighted sum of sinusoids
Practical Image Processing2
3 spatial frequency of an image refers to the rate at which pixel intensities change
Practical Image Processing4 H(u,v); u : spatial frequency along x axis u : spatial frequency along x axis v : spatial frequency along y axis v : spatial frequency along y axis
Practical Image Processing5 Discrete Fourier Transform (DFT) u let h(x,y) be an M x N image Inverse Discrete Fourier Transform(IDFT)
Practical Image Processing6 Sample code for DFT input : double h[M][N] output : COMPLEX H[M][N] for (u=0; u<M; u++) for (v=0; v<N; v++) { sum_re = 0; sum_im = 0; cu = 2* *u/M; cv=2* *v/N; for (x=0; x<M; x++) for (y=0; y<N; y++) { theta = x*cu + y*cv; sum_re += h[x][y] * cos(theta); sum_im -= h[x][y] * sin(theta); } H[u][v].re = sum_re; H[u][v].im = sum_im; } struct { double re; double im; } COMPLEX;
Practical Image Processing7 u DFT expects input to be periodic
Practical Image Processing8 Gibbs phenomenon u ringing effect caused by sampling & truncation u can reduce width of ringing by increasing the number of data samples u amplitude of ringing is proportional to difference between amplitude of first and last sample F can reduce it by multiplying data by windowing function skip
Practical Image Processing9 skip
Practical Image Processing10 window functions attenuate values at truncation edges
Practical Image Processing11 Fast Fourier transform u for NxN image, time complexity of DFT is O(N 4 ) u fast algorithm : Bell lab 1965 u adopt divide and conquer technique for fast computation : O(N 2 logN) 19 hours 4.8 sec : table 7.2 u dimension of image must be powers of 2 F expand to legal size by zero-padding
Practical Image Processing12 (1) bit-reversal operation : skip
Practical Image Processing13 skip F exploit periodicity and symmetry of recursive DFT computation F swap data elements for in-place computation u butterflies operation F divide set of data points down and perform series of 2 points DFT
Practical Image Processing14 how to display frequency data u 1 pixel range : 1 cycle small u, v : low frequency u logarithmic transform : wide dynamic range D(u,v) = c log(1+|H(u,v)|) u unordered vs ordered display(centering) I IVIII IIIV III III
Practical Image Processing15
Practical Image Processing16 Magnitude only + Phase
Practical Image Processing17
Practical Image Processing18 Fourier, Logarithmic Partial Inverse Fourier
Practical Image Processing19
Practical Image Processing20
Practical Image Processing21 Filtering in Frequency Domain convolution in spatial domain == multiplication in frequency domain u transform into frequency domain by FFT F f(x, y) F(u, v). pgm : list 7.1 u multiply by filtering mask in frequency domain F G(u, v) = H(u, v) F(u, v). pgm : list 7.2 F H(u, v) : filter u transform back to spatial domain by IFFT F G(u, v) g(x, y)
Practical Image Processing22 F(u,v) f(x,y) H(u,v) H(u,v)F(u,v) g(x,y)
Practical Image Processing23 Ideal Filters filters : low-pass, high-pass, band-pass, band- stop ideal filter : pass, not-pass style
Practical Image Processing24 Ideal Low Pass Filter
Practical Image Processing25 Ideal Low Pass Filter : Example Input image 500x500 H(u,v) with D 0 : 5, 15, 30, 80, 230 D 0 = 5 D 0 = 30 D 0 = 230 D 0 = 80 D 0 = 15 Ringing 현상 나타남
Practical Image Processing26 Practical Low Pass Filter : Butterworth ideal filters cause blurring & ringing in spatial domain use Butterworth filter for smooth frequency response Low Pass Filter : (== blurring, smoothing mask) D 0 : cutoff frequency n : order
Practical Image Processing27 Butterworth Low Pass Filter : Example Input image 500x500 H(u,v) with D 0 : 5, 15, 30, 80, 230 D 0 = 5 D 0 = 30 D 0 = 230 D 0 = 80 D 0 = 15 Ringing 현상 안 나타남
Practical Image Processing28
Practical Image Processing29 D 0 = 1/3 D 0 = 1/2 Ideal lowpass filters
Practical Image Processing30 D 0 = 1/3 D 0 = 1/2 ideal Butterworth
Practical Image Processing31 Ideal High Pass Filter
Practical Image Processing32 Ideal High Pass Filter : Example IHPF D 0 = 15 IHPF D 0 = 30 IHPF D 0 = 80 Input Image 500 x 500
Practical Image Processing33 ButterWorth HPF The Butterworth high pass filter is given as: where n is the order and D 0 is the cut off distance as before
Practical Image Processing34 Butterworth HPF : Example D 0 = 15D 0 = 30D 0 = 80
Practical Image Processing35 High Pass Filter : sharpening Band Pass Filter u pass specific frequency component only W : bandwidth, D 0 : center freqency
Practical Image Processing36 Discrete Cosine Transform(DCT) produce real frequency coefficients fast : pgm list 7.2, 7.3 used for image compression : JPEG, MPEG