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.
Deblurring is the process of removing blurring artifacts from images. Deblurring recovers a sharp image S from a blurred image B, where S is convolved with K (the blur kernel) to generate B. Mathematically, this can be represented as. (where * represents convolution).
nsr is the noise-to-signal power ratio of the additive noise. The algorithm is optimal in a sense of least mean square error between the estimated and the true images.
J = imnoise( I ,'salt & pepper') adds salt and pepper noise, with default noise density 0.05. This affects approximately 5% of pixels. J = imnoise( I ,'salt & pepper', d ) adds salt and pepper noise, where d is the noise density. This affects approximately d*numel(I) pixels.
Image enhancement or deblurring is necessary to reduce blur amount from the image. Image deblurring is a process used to reduce the blur quantity in a blurred image and make the degraded image into sharpened and clear image.
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');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With