Professional Documents
Culture Documents
Preface
Acknowledgement
Chapter No. Introduction to
Chapter No.
Chapter No.
Chapter No.
Objective:
The objective is to do blind image restoration of a degraded image, i.e. to reconstruct the
original image from a degraded image without the knowledge of either the original image or
the degradation process. If we represent the degradation in a linear model given by equation:
g(x,y) = f(x,y) * h(x,y) + n(x,y)
Where both the original image and the point spreading function (PSF) h are unknown
functions, then the restoration is reduced to a blind image deconolution problem where the
PSF is estimated using the degraded image and deconvolution of degraded image with the
estimated PSF if done to generate the reconstructed image. Blind Image restoration has been
topic a numerous research efforts and various deconvolution methods have been proposed.
Existing blind deconvolution techniques differ from each other mainly by the assumptions
they make about the true signal f(x,y) or the filter h(x,y).
Our aim is to identify different type of blurs in an image and then estimate the PSF based on
the identification and using the PSF to retore the image. Three usual blur types which
degrade an image Motion blur, Defocus blur and Gaussian blur are to be identified and
restored.
Introduction:
The purpose of image restoration is to "compensate for" or "undo" defects which degrade
an image. Degradation or blurring in an image can be caused by several factors like:
a) Relative motion between camera & object during the image capture process
(called motion blur),
b) Optical Blurs, for e.g. Out-of-focus optics ( called defocus blur), etc.,
c) Atmospheric turbulence blur, due to scattering, etc.,
d) Spatial quantization due to discrete pixels,
e) additive intensity noise during image acquisition (digitization) and transmission.,
etc.
The blurring is caused by convolution of original image by a blurring function, called the
Point Spread Function (PSF) (generated by the physical phenomena causing the blur).
During restoration process for all these type of blurs, we should compute a very good
estimate of the actual blurring function i.e. the PSF and remove the blur by
deconvolving the blurred image with this PSF to restore the original image. Also the
restoration process has to take into consideration the noise added to image and
compensate for the degradation it caused.
Linear Image Restoration: Degradation Model
Degradation is modelled as convolution of original image x(m,n) with a linear shift-
invariant filter, h(m,n) and addition of noise, w(m,n). y(m,n) is the degraded image which
we have to restore. Restoration is modelled as convolution of the degraded image, y(m,n)
a linear shift-invariant filter, g(m,n) which gives the estimate of original image x(m,n).
X (u , v) H (u , v) + W (u , v) W (u , v)
Xˆ (u , v) = Y (u , v)G (u , v) = = X (u , v) +
H (u , v) H (u , v)
i2 j2
h(i, j ) K exp
2 2
DEBLURRING/RESTORATION FILTERS:
1) Inverse Filtering
The quickest and easiest way to restore an image is by inverse filtering. It is a restoration
technique for deconvolution when the image is blurred by a known lowpass filter
Unfortunately, since the inverse filter is a form of high pass filer, inverse filtering
responds very badly to any noise that is present in the image because noise tends to be
high frequency. Thus Inverse filtering accentuates noise.
2) Wiener Filtering
The Wiener filtering executes an optimal trade-off between inverse filtering and noise
smoothing. It removes the additive noise and inverts the blurring simultaneously. The
Wiener filtering is optimal in terms of the mean square error. In other words, it minimizes
the overall mean square error in the process of inverse filtering and noise smoothing. The
Wiener filtering is a linear estimation of the original image. The Wiener filter in Fourier
domain can be expressed as follows:
3)Lucy- Richardson Filtering
Both Wiener and Lucy-Richardson Filters are adaptive filters. The Lucy-Richardson
algorithm generates a restored image through an iterative method. Lucy-Richardson
denoising accounts on photon counting noise with a Poisson distribution. The essence of
the iteration is as follows: the (n+1)th estimate of the restored image is given by the nth
estimate of the restored image multiplied by a correction image. With no noise
information, the Wiener filter do a poor job at realizing the original, non degraded, image.
However, the Lucy-Richardson filter works really good, despite having no information
about the noise in the image.
Although the Wiener filtering is the optimal tradeoff of inverse filtering and noise
smoothing, in the case when the blurring filter is singular, the Wiener filtering actually
amplify the noise. This suggests that a denoising step is needed to remove the amplified
noise. Wavelet-based denoising scheme is a successful approach provides a natural
technique for this purpose. Therefore, the image restoration contains two separate steps:
Fourier-domain inverse filtering and wavelet-domain image denoising. The diagram is
shown as follows.
This for image restoration improves the performance, however, in the case when the
blurring function is not invertible, the algorithm is not applicable. Furthermore, since the
two steps are separate, there is no control over the overall performance of the restoration.
Adaptive blind Image Restoration Algorithm: Implementation
Basic Principle:
In this project we have extracted features of degraded image while working in frequency
domain. It has been seen through many researches that certain type of blur may lead to
the specific frequency component distortion of the image Fourier spectrum, i.e the
Fourier spectrum of motion blur, Gaussian blur or any other type of blur will have
different features. This has been exploited in the project to identify the type of blur and
estimate the PSF accordingly. The degraded images are classified for three type of blurs:
Motion blur, Defocus blur and Gaussian blur. After identification of blur, PSF is
estimated and then decovolution is done of the estimated PSF and the degraded image to
restore the image. Restoration methods of Wiener filter and Lucy-Richardson’s filter have
been employed and compared & contrasted for different type of blurs.
The algorithm is computationally less extensive, effective and good adaptively.
Any degraded image (may be caused by any degradation factor) is input to the algorithm.
The Blur identification of degraded image is an automatic blur recognization method.
This is the primary and most important step for adaptive blind image restoration
algorithm.
Figure: Blur type identification of degraded image
Two-step Fourier transform of the a degraded image can distinguish the various kinds of
Blurs present in degraded images. Fourier spectrum for three blur types (motion,
Gaussian, defocus) are different.
After Binarization, post-treatment by morphology is done to deal with the pit, tip and
voids of spectrum.
Feature extraction is done for binarized images. The purpose of feature extraction is to
gain the characteristic information outstanding other images, and achieve the image
recognition. The two-step Fourier Transform of blur images with the same blur type but
different blur scale may be different in the size, scale and even the direction. But we hope
the feature extracted can ignore these differences, and have some outstanding differences
among these different blur types. For this, the seven moment invariants based on internal
domain and build with central moments by Hu[4]are used as the image feature, the
invariants means rotate invariants, shift invariants and scale invariants. Their formulas as
follows:
where
where
After feature extraction the classification & decision is done. The images are
automatically identified according to the image features. Using some the discrimination
functions and decision rules, the images are classified and identified, and the results are
obtained. The minimum distance classifier is introduced as the classifier in this paper.
The seven moment invariants of images are used as the retrieval shape features, the
European distance is used as the similarity measure. Calculating the similarity measuring
of two images, when the distance is less than the given threshold, the two images are
judged as similarity and belong to the same blur type. Threshold taken here is 1.5.
Seven moment invariants for three type of blur types are saved in computer as Sj , where
S1 is motion blur retrieval feature, S2 is defocus blur retrieval feature, and S3 is Gaussian
blur retrieval feature.. Then for any input degraded image the seven moment invariants
are computed. The European distance distj between the the saved values Sj and the
degraded image’s computed value S is computed as follows:
Where, Sj = {Mi | i = 1,2,3,….7}, j = 1,2,3
Then distj is compared for all the three blur types and the distance is minimum for j = i
then we say that the blur present in the degraded image is of ith type.
This completes the automatic identification of blur types in the degraded images.
When the degraded images’ blur types are classified by the algorithm, we then
deconvolve the degraded image with the corresponding PSF. For e.g. if blur type
identified is motion blur, then we deconvolve the degraded image with the motion blur
PSF (which is already saved in computer). This gives the restored image.
Above algorithm for adaptive blind image restoration has been implemented in
MATLAB. The algorithm has been tested with different images having different type of
blurs. The algorithm is properly identifying the type of blur present in an degraded image.
Restoration methods of Wiener filter and Lucy-Richardson’s filter have been employed
and compared & contrasted for different type of blurs.
Simulation Results:
Original Image
Images M1 M2 M3 M4 M5 M6 M7
Images M1 M2 M3 M4 M5 M6 M7
Lena 5.1333 10.263 15.3951 15.4020 30.8005 20.5344 44.8094
Camerama 6.4580 12.914 19.3714 19.3753 38.7487 25.8312 56.7400
n
Moment Invariants for two different Gaussian Blurred Image
Images M1 M2 M3 M4 M5 M6 M7
Lena 4.3236 8.6419 12.9625 12.9732 25.9411 17.2939 37.5238
Camerama 6.4580 12.914 19.3714 19.3753 38.7487 25.8312 25.8312
n
Moment Invariants for two different Defocus Blurred Image
Gaussian Blurred Image Restored Image: Wiener Filter Restored Image: LR Filter
Defocus Blurred Image Restored Image: Wiener Filter Restored Image: LR Filter
Thus we can see that Wiener Filter works well for Motion Blurred Images, but for
other two type of blurs, Lucy- Richardson Filter gives better results. For Gaussian
and defocus blurred images, Wiener filter accentuates noise which appear is form of
line patterns in the restored images.
MATLAB Code
1. TOP MODULE (imrestore.m)
clc;
close all;
clear all;
%--------------------------------------IMAGE READ------------------------------------------------------%
% im_org = imread('cameraman.tif');
% im_org = imread('rice.png');
% im_org = imread('pout.tif');
im_org = imread('lena512.bmp');
H = fspecial('disk',10);
im = imfilter(im_org ,H,'replicate');
figure; imshow(im);
title('Blurred Image Defocus Blur');
fft_mtbl=fftshift(fft2(double(im)));
% subplot(2,2,4);imshow(log(1+abs(fft_dfbl2)),[]);
% title('FFT of Defocussed Blurred image2');
%------------- --------------IMAGE PRETREATMENT MODULE------------ --------------------%
%-------------CONTRAST ENHANCEMENT USING MORPHOLOGICAL FILTER------------%
eroded_mtbl = imerode(abs(fft_mtbl),se);
dilated_mtbl = imdilate(abs(fft_mtbl),se);
[y,x] = size(eroded_mtbl);
for i = 1:y
for j = 1:x
if ( ( (dilated_mtbl(i,j)) - (abs(fft_mtbl(i,j))) ) < ( (abs(fft_mtbl(i,j))) - (eroded_mtbl(i,j)) ) )
enhanced_mtbl_img(i,j) = dilated_mtbl(i,j);
enhanced_mtbl_img(i,j) = eroded_mtbl(i,j);
enhanced_mtbl_img(i,j) = abs(fft_mtbl(i,j));
end
end
end
figure;imshow(log(1+abs(fft_mtbl)),[]);title(‘Original image');
%----------------------------------IMAGE BINARIZATION----------------------------------------------%
ihis = imhist(abs(fft_mtbl));
dim = size(abs(fft_mtbl));
leng = length(ihis);
para = zeros(1,leng);
for k = 2:leng-1
% intensity of class A
classa = ihis(1:k);
ind = (classa==0);
classa = classa+ind;
clear ind
% intensity of class B
classb = ihis(k+1:end);
ind = (classb==0);
classb = classb+ind;
clear ind
% probability distribution of class A
Pa = classa/(dim(1,1)*dim(1,2));
% probability distribution of class B
Pb = classb/(dim(1,1)*dim(1,2));
% parameters to decide threshold
para1 = log2(sum(Pa));
para2 = log2(sum(Pb));
logpa = log2(Pa);
logpb = log2(Pb);
para3 = -sum(Pa.*logpa)/sum(Pa);
para4 = -sum(Pb.*logpb)/sum(Pb);
% parameter which has to be maximized
para(1,k) = abs(para1+para2+para3+para4);
clear classa classb logpa logpb
end
% find threshold
[maxv,row] = max(para);
thresh = row-1;
% segment input image
BW1 = (abs(fft_mtbl)>=thresh);
figure;imshow(BW1);title('Binary Image - Motion Blur');
se1 = strel('diamond',5);
BW11 = imerode(BW1,se1);
figure;imshow(BW11);
[n1 n2 n3 n4 n5 n6 n7]=findmoment(double(BW11));
sharpFilter = fspecial('unsharp');
sharp = imfilter(wnr1, sharpFilter, 'replicate');
figure;imshow(sharp), title('Sharpened');
PSF = fspecial('gaussian',10,5);
%Wiener Filter %LR Filter
wnr1 = deconvwnr(im,PSF);
lucy1 = deconvlucy(im,PSF);
figure;imshow(wnr1);
title('Restored Image - Type of Blur was Gaussian Blur-Wiener');
figure;imshow(lucy1);
title('Restored Image - Type of Blur was Gaussian Blur-LR');
sharpFilter = fspecial('unsharp');
lucy1 = deconvlucy(im,PSF);
figure;imshow(lucy1);
title('Restored Image - Type of Blur was Defocus Blur-LR');
sharpFilter = fspecial('unsharp');
sharp = imfilter(lucy1, sharpFilter, 'replicate');
figure;imshow(sharp), title('Sharpened');
end
im=im/max(max(im));
cx = immoment(im, 1, 0);
cy = immoment(im, 0, 1);
u20= immoment(im,2,0,cx,cy);
u02= immoment(im,0,2,cx,cy);
u30= immoment(im,3,0,cx,cy);
u03= immoment(im,0,3,cx,cy);
u11= immoment(im,1,1,cx,cy);
u12= immoment(im,1,2,cx,cy);
u21= immoment(im,2,1,cx,cy);
m1= (u20+u02);
m2=((u20-u02).^2) + 4*(u11.^2);
m3=((u30-3*u12).^2 )+ (3*u21-u03).^2;
m4=((u30+u12).^2) + ((u21+u03).^2);
m1 = log (abs(m1));
m2 = log (abs(m2));
m3 = log (abs(m3));
m4 = log (abs(m4));
m5 = log (abs(m5));
m6 = log (abs(m6));
m7 = log (abs(m7));
[y x v] = find(im);
elseif nargin == 3
end
%---------------------------------------------------------------------------------------------------------------%
CONCLUSION:
[1] Katsaggelos A.K., Maximum likelihood image identification and restoration based on
the EM algorithm, Multidirnensional Signal Processing workshop,1989,pp. 183- 184.
[2] Ayers G R, J C.Iterative blind deconvolution method and its applications, Optics
Letters, 1998,pp.547-549.
[4] Hu M.K. Visual pattern recognition by moment invariant. IEEE Trans on Information
Theory, 1962,pp.179-187.
[5] CHEN Qianrong, LU Qisheng, CHENG Zhili. Identification the scale of the point
spread function from the motion blurred image.Computer Engineering and Applications,
2004,pp.15-19.
[6] TAO Qingchuan, DENG Hongbin. Wavelet transform based Gaussian point spread
function estimation.Optical Technique,2004,pp.284-288.