我一直在尝试恢复使用已知点扩散函数模糊并使用卡尔曼滤波器被噪声破坏的图像。我研究了理论并对卡尔曼滤波器的工作原理有了基本的了解。但是我找不到任何关于如何使用它来恢复图像的好材料。我尝试了一种方法,我认为图像是在没有控制信号的情况下要预测的状态,并且观察模型等于具有已知测量噪声的模糊函数,即,
其中,
X(k) is the 2D image
Z(k) is the observed noisy blurred image
H is the PSF
R is the noise
这是使用的代码,
I = im2double(imread('E:\Wallpapers\2.jpg'));
I = I(:,:,1);
LEN = 2;
THETA = 5;
PSF = fspecial('motion', LEN, THETA);
blurred = imfilter(I, PSF, 'conv', 'circular');
SNR = 20;
noisy = awgn1(blurred,SNR);
noise = noisy - blurred;
R = cov(noise);
H = fft2(PSF,size(I,1),size(I,2));
K = 1e5*eye(size(I));
P = 1e5*eye(size(I));
X = zeros(size(I));
S = zeros(size(I));
for i = 1 : 1000
S = R + H*P*H';
K = P*H'/S;
X = X + K*(noisy - H*X);
P = (I - K*H)*P*(I - K*H)' + K*R*K';
end
MSE_noise = sum(sum((noisy-I).^2));
MSE1_restored = sum(sum((X-I).^2));
图像充满了 NaN,这是因为K = P*H'/S
缩放不当。我哪里错了?代码有问题还是我应该更改模型以恢复图像?