1. Dr. Bilal Ghazal
Lebanese University (UL) – Faculty of Sciences IV
Info 2234 1
IMAGE PROCESSING
Image Restoration
2. Image degradation and restoration
2
➢ f(x,y) is the initial image
➢ H degradation function
➢ n(x,y) is the noise
➢
𝒇 𝒙, 𝒚 is an approximation of the original
3. Image deblurring
3
➢ Fredholm integral
➢ h(x,y) :point spread function PSF of an optical system
➢ f(x,y) is a function of real object (image)
➢ n(x,y) is an additive noise
➢ g(x,y) is an observed signal
6. Point spread function PSF
➢ PSF is a deterministic fixed quantity
➢ Depends on physical hardware
❖Optical system: nature of lenses, shape
❖Medical image: Anger camera for gamma rays
❖ expect to have knowledge about PSF
➢ Noise n(x,y)
❖Stochastic in nature
❖Random and unwanted fluctuation on signal
❖Don’t have control on it
❖Calculated using integral transformation
6
7. Convolution
➢ If PSF h is linear and shift invariant function
➢ The degraded image is expressed in the spatial domain
by its convolution with the spatial representation of PSF
7
8. Frequency domain representation
➢ In frequency domain representation, the convolution
formula becomes:
➢ G(u,v) Fourier transform of g(x,y)
➢ H(u,v) Fourier transform of h(x,y)
➢ F(u,v) Fourier transform of f(x,y)
➢ N(u,v) Fourier transform of n(x,y)
8
9. Degradation in spatial&frequency domain
➢ In the spatial domain, degradation or blurring is
observed as
❖Fuzziness
❖Unsharpened edges
❖Small image details look undistinguishable
➢ In the frequency domain, degradation or blurring
❖Affect significantly power spectrum
❖Some zero appears ➔ some frequencies disappear
➢ Phase spectrum is slightly affected
9
-
14. Ideal Model
➢ Ideal model assumes that effect of noise is negligible
n(x,y) = 0
➢ Relation in frequency domain
➢ To restore our image, we should solve the F(u,v)
equation
14
-
15. Ideal Model
➢ In spatial domain
f(x,y) = F-1{G(u,v)/H(u,v)} = F-1{G(u,v)Y(u,v)}
Where
Y(u,v) = 1/H(u,v)
➢ H(u,v) is the optical transfer function OTF
➢ H(u,v) is called also inverse filter
➢ The deconvolution equation
f(x,y) = g(x,y)*{h(x,y)}-1
➢ This equation cannot be solved since h and H
contains zero.
15
16. Ideal model
➢ To restore a blurred image we should know
❖The exact PSF model
❖Function h and its spectrum H ?
➢ Apply a blind deconvolution
❖Rate of success 50%
➢ It is preferable to identify the PSF
❖Frequencies where H(u,v) are not involved in the equation
❖Use neural network
❖Use support vector machine
16
17. Blurred images
➢ A=imread('cameraman.tif');
➢ B=fft2(double(A));
➢ B=fftshift(B); %Read in image and take FT
➢ [x y]=size(A);
➢ [X Y]=meshgrid(1:x,1:y); %Construct Gaussian PSF
➢ h=exp(-(X -x/2).^2./48).*exp(-(Y- y/2).^2./48);
%extending over entire array
➢ H=psf2otf(h,size(h));
➢ H=fftshift(H); %Get OTF corresponding to PSF
➢ g=ifft2(B.*H); g=abs(g);
17
-
34. Model with noise
➢ Frequency equation
𝑭(u,v) = G(u,v)/H(u,v) + N(u,v)/H(u,v)
𝑭(u,v) = F(u,v) + N(u,v)/H(u,v)
➢
𝑭(u,v) is the estimated function of F(u,v)
➢ Noise spectrum is unknown and random
➢ If |N(u,v)| >> |G(u,v)| ➔ noise completely dominate
34
35. Blurred images
➢ A=imread('cameraman.tif'); B=fft2(double(A));
➢ B=fftshift(B); %Read in image and take FT
➢ [x y]=size(A);
➢ [X Y]=meshgrid(1:x,1:y); %Construct Gaussian PSF
➢ h=exp(-(X -x/2).^2./48).*exp(-(Y- y/2).^2./48);
➢ H=psf2otf(h,size(h));
➢ H=fftshift(H); %Get OTF corresponding to PSF
➢ g=ifft2(B.*H);
➢ g=mat2gray(abs(g)); %Blur image in Fourier domain
➢ subplot(1,2,1),imshow(abs(g),[]);
➢ g=imnoise(g,'gaussian',0,0.002);
➢ subplot(1,2,2),imshow(abs(g),[]); 35
-
39. Wiener–Helstrom filter
➢ It is a sophisticated approach
➢ Wiener filter for white noise
➢ K noise spectrum for noise
➢ 3 cases to identify
❖If |N(u,v)| << |G(u,v)| ➔ ideal filter
❖If |N(u,v)| >> |G(u,v)|
➔ filter should approaches zero Y(u,v) 0
❖If |N(u,v)| |G(u,v)| ➔ damped these frequencies in an
appropriate compromise
39
-
40. Wiener–Helstrom filter
➢ I = imread('cameraman.tif');I=double(I); %Read in image
➢ noise =15*randn(size(I)); %Generate noise
➢ PSF = fspecial('motion',21,11); %Generate motion PSF
➢ Blurred = imfilter(I,PSF,'circular'); %Blur image
➢ BlurredNoisy= Blurred +noise; %Add noise to blurred image
➢ NSR = sum(noise(:).^2)/sum(I(:).^2); % Calculate SCALAR
noise to power ratio
➢ NP = abs(fftn(noise)).^2; %Calculate noise power spectrum
➢ NPOW = sum(NP(:))/prod(size(noise)); %Calculate average
power in noise spectrum
➢ NCORR = fftshift(real(ifftn(NP))); %Get autocorrelation
function of the noise, %centred using fftshift
➢ Cont… 40
-
41. Wiener–Helstrom filter(Cont..)
➢ IP = abs(fftn(I)).^2; %Calculate image power spectrum
➢ IPOW = sum(IP(:))/prod(size(I)); %Calculate average power
in image spectrum
➢ ICORR = fftshift(real(ifftn(IP))); %Get autocorrelation
function of the image, %centred using fftshift
➢ NSR= NPOW./IPOW; %Scalar noise to signal power ratio
➢ subplot(1,3,1);
➢ imshow(BlurredNoisy,[min(min(BlurredNoisy))
max(max(BlurredNoisy))]); %Display blurred&noisy image';
➢ subplot(1,3,2);
➢ imshow(deconvwnr(BlurredNoisy,PSF,NSR),[]);
➢ %Wiener filtered PSF and scalar noise/ %signal power ratio
➢ subplot(1,3,3);
➢ imshow(deconvwnr(BlurredNoisy,PSF,NCORR,ICORR),[]);
%Wiener filtered PSF and noise and signal autocorrelations
41
-