Sie sind auf Seite 1von 3

EXPERIMENT 11

AIM: Write a program for image restoration by using wiener filtering. Wiener deconvolution can be used effectively when the frequency characteristics of the image and additive noise are known, to at least some degree. In the absence of noise, the Wiener filter reduces to the ideal inverse filter. deconvwnr function is used to deblur an image using the Wiener filter.

1.DECONWNR: This MATLAB command restore image using the Wiener filter. Syntax J = deconvwnr(I,PSF) J = deconvwnr(I,PSF,NSR) Description J = deconvwnr(I,PSF) restores image I that was degraded by convolution with a pointspread function PSF and possibly by additive noise. The algorithm is optimal in a sense of least mean square error between the estimated and the true image, and uses the correlation matrixes of image and noise. J = deconvwnr(I,PSF,NSR), where NSR is the noise-to-signal power ratio. NSR could be a scalar or an array of the same size as I. The default value is 0. 2. IMADD: Add two images, or add a constant to an image Syntax Z = imadd(X,Y) Description Z = imadd(X,Y) adds each element in array X with the corresponding element in array Y and returns the sum in the corresponding element of the output array Z.

clear all; close all; I=imread('C:\Users\Public\Pictures\Sample Pictures\Jellyfish.jpg'); subplot(4,2,1) imshow(I) title('original image') J=rgb2gray(I) subplot(4,2,2) imshow(J) title('gray image') PSF = fspecial('motion',31,11); Blurred = imfilter(J,PSF,'circular','conv'); subplot(4,2,3) imshow(Blurred) title('Blurred image') wnr1 = deconvwnr(Blurred,PSF); subplot(4,2,4) imshow(wnr1) title('Restored, True PSF'); wnr2 = deconvwnr(Blurred,fspecial('motion',2*31,11)); subplot(4,2,5); imshow(wnr2); title('Restored, "Long" PSF'); wnr3 = deconvwnr(Blurred,fspecial('motion',31,2*11)); subplot(4,2,6); imshow(wnr3) title('Restored, Steep'); noise = 0.1*randn(size(J)); BlurredNoisy = imadd(Blurred,im2uint8(noise)); subplot(4,2,7) imshow(BlurredNoisy) title('Blurred & Noisy') NSR = sum(noise(:).^2)/sum(im2double(J(:)).^2); wnr5 = deconvwnr(BlurredNoisy,PSF,NSR); subplot(4,2,8) imshow(wnr5); title('Restored with NSR');

Das könnte Ihnen auch gefallen