Deblurring image with deconvolution

I have a picture 'image.jpg' that is blurred with function sin(x+y). How can I deblur it with deconvolution?

8 个评论

Is that the blurring PSF (if so, what's its extent?), or just a multiplicative factor over the whole image (like there is ripple in the image)? You forgot to post the image.
Consider the original picture A.jpg as the matrix m*n. then assume that every position [x y] of this picture is multiplied by sin(ax+by) resulting the blurred picture B.jpg.
Now I have to clear the sinus noise from B to obtain A. How can I do it?
I have attached the blurred picture.
I'm pretty sure no real world imaging system created this, so I suspect it's a synthesized image for your homework. If so, please read this link and create a tag on the right that says "homework".
Did you try using fft2() on the image and looking for spikes?
This image has combination of motion and sinusoidal noises. can you help me how to remove the motion noise?
Didn't my demo show you how to get rid of sinusoidal noise?
No after I used fft2 I saw a lot of spikes so we don't know which are caused by sinusoidal noise. so I tried this to remove the motion type noise but I don't know which appropriate LEN and THETA should I set.
I = im2double(imread('B.jpg'));
imshow(I);
LEN=5;
THETA=5;
PSF = fspecial('motion', LEN, THETA);
noise_mean = 0;
noise_var = 0.0001;
estimated_nsr = noise_var / var(I(:));
wnr = deconvwnr(I, PSF, estimated_nsr);
figure, imshow(wnr),title('deblur image');
I also tried your demo but the picture became more blurred !!
grayImage = imread('B.jpg');
[rows columns numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
grayImage = rgb2gray(grayImage);
end
subplot(2, 3, 1);
imshow(grayImage, [0 255]);
set(gcf, 'Name', ['Results for ' fullFileName]);
title('Original Image', 'FontSize', fontSize);
set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
% Compute the 2D fft.
frequencyImage = fftshift(fft2(grayImage));
% Take log magnitude so we can see it better in the display.
amplitudeImage = log(abs(frequencyImage));
minValue = min(min(amplitudeImage));
maxValue = max(max(amplitudeImage));
subplot(2, 3, 4);
imshow(amplitudeImage, []);
caption = sprintf('Notice the two spikes\nperpendicular to the periodic frequency');
title(caption, 'FontSize', fontSize);
axis on;
% zoom(10)
% Find the location of the big spikes.
amplitudeThreshold = 11;
brightSpikes = amplitudeImage > amplitudeThreshold; % Binary image.
subplot(2, 3, 5);
imshow(brightSpikes);
axis on;
title('Bright Spikes', 'FontSize', fontSize);
% Let user see the image.
promptMessage = sprintf('The image below shows the bright spikes.\nNow we will exclude the central spike.');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
return;
end
% Exclude the central DC spike. Everything from row 115 to 143.
brightSpikes(800:400, :) = 0;
imshow(brightSpikes);
title('Bright spikes other than central spike', 'FontSize', fontSize);
promptMessage = sprintf('Now we will use these bright spikes to filter (mask) the spectrum.');
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
return;
end
% Filter/mask the spectrum.
frequencyImage(brightSpikes) = 0;
% Take log magnitude so we can see it better in the display.
amplitudeImage2 = log(abs(frequencyImage));
minValue = min(min(amplitudeImage2));
maxValue = max(max(amplitudeImage2));
subplot(2, 3, 5);
imshow(amplitudeImage2, [minValue maxValue]);
axis on;
title('Spikes zeroed out', 'FontSize', fontSize);
% zoom(10)
filteredImage = ifft2(fftshift(frequencyImage));
amplitudeImage3 = abs(filteredImage);
minValue = min(min(amplitudeImage3));
maxValue = max(max(amplitudeImage3));
subplot(2, 3, 6);
imshow(amplitudeImage3, [minValue maxValue]);
title('Filtered Image', 'FontSize', fontSize);
% set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
% %

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by