2013-08-27 96 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');