2013-08-27 99 views
7

Im新增至MatLab。一直玩和阅读帮助指南,但我似乎无法解决这种情况。Matlab上的图像去模糊

enter image description here

我已删除通过使用高斯算法的噪声。这是成功的,但我没有设法让图像清晰,我试过使用Richardson-Lucy去模糊算法,但它不起作用。任何想法如何解决这个问题? Thnx提前。

这是我迄今为止所做的。

图像大小= 21KB 图像尺寸= 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'); 

,当我试图使用中值滤波器,我得到这个输出

使用medfilt2
预期输入数1错误,A ,是二维的。

错误medfilt2> parse_inputs(线106)
validateattributes(一,{ '数字', '逻辑'},{ '2D', '真实'},mfilename, 'A',1);

medfilt2错误(第48行)
[a,mn,padopt] = parse_inputs(varargin {:});

a1q21错误(第2行)
J = medfilt2(img);

和我目前的结果是这样的。

enter image description here

+0

输入图像中的噪声看起来更像“盐和胡椒”噪声。尝试使用[中值过滤器](http://www.mathworks.com/help/images/ref/medfilt2.html)将其删除。 – Shai

+0

@shai Thnx。我曾尝试使用中值滤波器。问题是,图像不是2D的,我的讲师告诉我,我不必转换图像。她告诉我的唯一情况是我应该使用Richardson-Lucy去模糊算法。 – Harvin

+0

你是什么意思你的“图像不是二维”?您可以对每个通道进行中值滤波并重新合并它们。尝试比较结果。 – Shai

回答

4

您使用了错误的点扩散函数的debluring算法(碉堡是一个不错的选择)。为获得最佳效果,使用中值滤波器进行滤波,以去除S噪声,然后用高斯核函数去模糊。由于图像似乎没有强烈的方向模糊,我会跳过运动去模糊。您将需要使用锐化滤镜的西格玛来获得最佳效果。

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');