Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 70 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
70
Dung lượng
2,11 MB
Nội dung
Chapter4FrequencyDomainProcessing Image Enhancement in the FrequencyDomain Jean Baptiste Joseph Fourier (1768-1830) had crazy idea (1807): Any periodic function can be rewritten as a weighted sum of sines and cosines of different frequencies. Don’t believe it? – Neither did Lagrange, Laplace, Poisson and other big wigs – Not translated into English until 1878! But it’s true! – called Fourier Series Introduction to the Fourier Transform Any function that periodically repeats itself can be expressed as the sum of sines and/or cosines of different frequencies, each multiplied by a different coefficient (Fourier series). Even functions that are not periodic (but whose area under the curve is finite) can be expressed as the integral of sines and/or cosines multiplied by a weighting function (Fourier transform). The advent of digital computation and the “discovery” of fast Fourier Transform (FFT) algorithm in the late 1950s revolutionized the field of signal processing, and allowed for the first time practical processing and meaningful interpretation of a host of signals of exceptional human and industrial importance. FrequencyDomainProcessing The frequencydomain refers to the plane of the two dimensional discrete Fourier transform of an image. The purpose of the Fourier transform is to represent a signal as a linear combination of sinusoidal signals of various frequencies. FrequencyDomainProcessing = + example : g(t) = sin(2pi f t) + (1/3)sin(2pi (3f) t) 1D Fourier transform and its inverse 1 2 / 0 ( ) ( ) for 0,1, 2, , 1 M j ux M x F u f x e u M π − − = = = − ∑ 1 2 / 0 1 ( ) ( ) for 0,1, 2, , 1 M j ux M u f x F u e x M M π − = = = − ∑ Fourier transform (DFT) Inverse Fourier transform (IDFT) 2D Fourier transform and its inverse 1 1 2 ( / / ) 0 0 ( , ) ( , ) for 0,1, 2, , 1, 0,1, 2, , 1 M N j ux M vy N x y F u v f x y e u M v N π − − − + = = = = − = − ∑ ∑ 1 1 2 ( / / ) 0 0 1 ( , ) ( , ) for 0,1, 2, , 1, 0,1, 2, , 1 M N j ux M vy N u v f x y F u v e MN x M y N π − − + = = = = − = − ∑∑ Fourier transform (DFT) Inverse Fourier transform (IDFT) Discrete Fourier Transform The Fourier transform of a discrete function f(x), x=0,1,2,…,M-1 is given by (Discrete Fourier transform, DFT) inverse DFT The multiplier 1/M in front of the Fourier transform sometimes is placed in front of the inverse instead Or, both equations are multiplied by 1, ,2,1,0 )( 1 )( 1 0 /2 −== ∑ − = − Muforexf M uF M x Muxj π 1, ,2,1,0 )()( 1 0 /2 −== ∑ − = MxforeuFxf M u Muxj π M/1 Discrete Fourier Transform Euler’s formula DFT is represented as Each term of the Fourier transform is composed of the sum of all values fo the function f(x). The values of f(x) are multiplied by sines and cosines of various frequencies The domain (values of u) of F(u) is appropriately called frequencydomain because u determines the frequency of the components of the transform θθ θ sincos je j += 1, ,2,1,0 ]/2sin/2)[cos( 1 )( 1 0 −= −= ∑ − = Mufor MuxjMuxxf M uF M x ππ Discrete Fourier Transform The Fourier transform may be viewed as a “mathematical prism” that separates a function into various components based on frequency content In the analysis of complex numbers, it is convinient to express F(u) in polar coordinates where )( |)(|)( uj euFuF φ = 1/2 2 2 1 2 2 2 ( ) ( ) ( ) ; ( ) ( ) tan : ( ) ( ) ( ) ( ) ( ) : F u R u I u magnitude, spectrum I u u phase angle, phase spectrum R u P u F u R u I u power spectrum ϕ − = + = = = + [...]... result of filtering f in the spatial domain with the Sobel mask process in the frequency domain Obtain FrequencyDomain Filters from Spatial Filters Obtain FrequencyDomain Filters from Spatial Filters clear all; clc f = imread('circuit.tif'); F= fft2(f); S= fftshift(log(1+abs(F))); S=mat2gray(S); %S= gscale(F1); figure imshow(f); figure imshow(S); Obtain FrequencyDomain Filters from Spatial Filters... h=fspecial('laplacian', 0.9); H=freqz2(h, PQ); g=dftfilt(f, H); imshow(g) Obtain FrequencyDomain Filters from Spatial Filters The syntax: H = freqz2 (h, R, c) Where h is a 2-D spatial filter and H is the corresponding 2-D frequencydomain filter Consider the image, f, of size 600×600 pixels shown in × following figure In what follows, we generate the frequencydomain filter, H, corresponding to the Sobel spatial filter... imshow(F0);title('Centered spectrum: ifft2',… 'FontSize',14) Filtering in the frequencydomain f ( x, y ) ∗ h ( x, y ) ⇔ H (u, v ) F (u, v ) The convolution theorem: Linear spatial convolution is by convolving f(x,y) and h(x,y) The same result is obtained in the frequencydomain by multiplying F(u,v) and H(u,v) The basic idea in frequencydomain is to select a filter transfer function that modifies F(u,v) in... Inverse DFT (IDFT) f(x, y) F(u, v) M, N: image size x, y: image pixel position u, v: spatial frequency WN = e − j 2π / N Filtering in frequencydomain Low-pass filters: preserve low frequencies, useful for noise suppression High-pass filters: preserves high frequencies, useful for edge detection Filtering in frequencydomain Original signal Low-pass filtered High-pass filtered Computing and visualizing DFT... exp(-(D.^2)./(2*(D0^2))); otherwise error('Unknown filter type.') end function [U, V] = dftuv(M, N) function [U, V] = dftuv(M, N) %DFTUV Computes meshgrid frequency matrices % [U, V] = DFTUV(M, N) computes meshgrid frequency matrices U and % V U and V are useful for computing frequency- domain filter % functions that can be used with DFTFILT U and V are both M-by-N % Set up range of variables u = 0:(M-1); v = 0:(N-1); %... attenuates the high frequency components to F(u,v) while leaving the low frequencies relatively unchanged f ( x , y ) ∗ h ( x , y ) ⇔ H ( u, v ) F ( u, v ) clear all; f=zeros(5); f(3,3)=1; w=[1 2 3; 4 5 6 ; 7 8 9]; [a b]=size(w);[c d]=size(f); P=(a+c)-1;Q=(b+d)-1; g=imfilter(f,w,'conv',0,'full') F=fft2(f, P, Q ); W=fft2(w, P, Q); G=W.*F; G=real(ifft2(G)) Filtering in the frequencydomain g= 0 0 0 0... real part of the inverse FFT of G: g=real(ifft2(G)); 6.Crop the top, left rectangle to the original size; g=g(1:size(f,1),1:size(f,2)); Basic Steps in DFT Filtering An M-function Filtering in the FrequencyDomain function g = dftfilt(f, H) F = fft2(f, size(H, 1), size(H, 2)); % Perform filtering g = real(ifft2(H.*F)); % Crop to original size g = g(1:size(f, 1), 1:size(f, 2)); Application of function... 0.0000 0.0000 5.0000 6.0000 -0.0000 0.0000 8.0000 9.0000 0 0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 Fourier Transform The Fourier Transform is of fundamental importance to image processing its efficiency allows us to perform other tasks more quickly The Fourier Transform provides, among other things, a powerful alternative to linear spatial filtering; it is more efficient to use . Chapter4 Frequency Domain Processing Image Enhancement in the Frequency Domain Jean Baptiste Joseph Fourier (1768-1830) had crazy. signal processing, and allowed for the first time practical processing and meaningful interpretation of a host of signals of exceptional human and industrial importance. Frequency Domain Processing The. by sines and cosines of various frequencies The domain (values of u) of F(u) is appropriately called frequency domain because u determines the frequency of the components of the transform θθ θ sincos