約束最小二乘方濾波去模糊

維納濾波要求未退化圖像和噪聲功率譜已知。實際情景沒有這麼多先驗知識。約束最小二乘濾波僅要求噪聲方差和均值的知識。

g=Hf+η

假設g(x,y)的大小爲M×N ,g(x,y) 第一行的圖像元素構成向量g 的第一組N 個元素,第二行構成下一組N 個元素,結果向量MN×1 維,矩陣HMN×MN 維,這樣轉換增加了H 矩陣維度,且對噪聲高度敏感,問題更加複雜。
該算法核心是H 對噪聲的敏感性問題。減小噪聲敏感性問題的一種方法是以平滑度量的最佳復原爲基礎的,如一副圖像的二階導數,期望找到最小準則函數C :
C=x=0M1y=0N1[2f(x,y)]2

其約束爲:
||gHf^||2=||η||2

根據拉格朗日乘子法,代價函數:
||pf^||2+λ(||gHf^||2||η||2)

關於f^ 求導:
f^=λHgλHH+PP=HgHH+γPP

p=010141010
這裏寫圖片描述
deconvreg(g,PSF,NOISEPOWER,RANGE)

g 是未被污染圖像,NOISEPOWER與||η||2 成比例,RANGE爲值的範圍。默認範圍[109,109] ,將上述兩個參數排除在參數之外產生逆濾波方案,針對NOISEPOWER比較好的估計是MN[σ2η+ση2] 。NOISEPOWER可以得到較好的結果。

close all;
clear all;
clc;
% Display the original image.
I = imread('1.jpg'); 
[d1,d2,d3] = size(I); 
if(d3 > 1) 
I = rgb2gray(I);
end
I = im2double(I);

[hei,wid,~] = size(I);
subplot(2,3,1),imshow(I);
title('Original Image ');


% Simulate a motion blur.
LEN = 100;
THETA = 11;
PSF = fspecial('motion', LEN, THETA);
blurred = imfilter(I, PSF, 'conv', 'circular');
subplot(2,3,2), imshow(blurred); title('Blurred Image');


% Simulate additive noise.
noise_mean = 0;
noise_var = 0.00001;
blurred_noisy = imnoise(blurred, 'gaussian', ...
                        noise_mean, noise_var);
subplot(2,3,3), imshow(blurred_noisy)
title('Simulate Blur and Noise')

If = fft2(blurred);
Pf = psf2otf(PSF,[hei,wid]);

% Try restoration using  Home Made Constrained Least Squares Filtering.
p = [0 -1 0;-1 4 -1;0 -1 0];
P = psf2otf(p,[hei,wid]);

gama = 0.001;
If = fft2(blurred_noisy);

numerator = conj(Pf);%計算共軛
denominator = Pf.^2 + gama*(P.^2);

deblurred2 = ifft2( numerator.*If./ denominator );
subplot(2,3,4), imshow(deblurred2)
title('Restoration of Blurred Using Constrained Least Squares Filtering');

subplot(2,3,5); imshow(deconvreg(blurred_noisy, PSF,10e1)); title('Regul in Matlab');

數字圖像處理MATLAB第二版
http://blog.csdn.net/bluecol/article/details/46242355

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章