Pregunta

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

enter image description here

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.

enter image description here

¿Fue útil?

Solución

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');
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top