Image deblurring on Matlab

非 Y 不嫁゛ 提交于 2019-11-29 14:38:13

问题


Im new to MatLab. Been playing around and reading through the help guide but i can't seem to solve this situation.

I have removed the noise by using gaussian algorithm. That was successful but I've not managed to get the image to be clear, i've tried using Richardson-Lucy deblurring algorithm but it doesn't work. Any idea how can i solve this? Thnx in advance.

Here's what i've done so far.

image size = 21kb image dimension = 264 x 126

img = imread('car_plate.jpg')
subplot(331);
imshow(img), title('Original Image')

PSF = fspecial('gaussian',15,15);
blur = imfilter(img,PSF,'replicate');
subplot(332);imshow(blur);title('Filter image');

motion_noise = fspecial('disk', 7);

luc1 = deconvlucy(img,motion_noise);
subplot(333); imshow(luc1);
title('Disk and Lucy');

LEN = 9; THETA = 1;
motion_noise2 = fspecial('motion', LEN, THETA);


luc2 = deconvlucy(blur,motion_noise2);
subplot(334); imshow(luc2);
title('Motion and Lucy');

When i tried using median filter, i got this output

Error using medfilt2
Expected input number 1, A, to be two-dimensional.

Error in medfilt2>parse_inputs (line 106)
validateattributes(a, {'numeric','logical'}, {'2d','real'}, mfilename, 'A', 1);

Error in medfilt2 (line 48)
[a, mn, padopt] = parse_inputs(varargin{:});

Error in a1q21 (line 2)
J = medfilt2(img);

and my current results are this.


回答1:


You are using the wrong point spread functions for your debluring algorithm (pillbox is a bad choice). For best results filter with a median filter to remove the S&P noise and then deblur with a gaussian kernal. I would skip the motion deblur as the image doesn't seem to have strongly directional blur. You will need to play with the sigma of the sharpening filter to get the best results.

img = imread('car_plate.jpg')
subplot(331);
imshow(img), title('Original Image')

blur = medfilt2(img,[3 3]);
subplot(332);imshow(blur);title('Filter image');

deblurSigma = 10; %Adjust this to get the most visually pleasing results
motion_noise = fspecial('gaussian', 15,deblurSigma);
luc1 = deconvlucy(img,motion_noise);
subplot(333); imshow(luc1);
title('Disk and Lucy');


来源:https://stackoverflow.com/questions/18460579/image-deblurring-on-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!