我想使用多分辨率SVD去除噪音。以下是我想从研究论文中获得的算法。
文章标题:使用多分辨率奇异值进行图像去噪 分解变换。
作者: Malini.Sa,*,Moni.R.Sa
这是我的代码:
imt = imread('eight.tif');
imt= im2double(imt);
imt=imresize(imt,[256,256]);
figure; imshow(imt);
J = imnoise(imt,'salt & pepper',0.1);
figure, imshow(J);
%apply MSVD
[X1, U1] = MSVD(J);
%apply IMSVD
imf = IMSVD(X1,U1);
%%%%%% MSVD %%%%
function [Y,U] = MSVD(x)
% multiresolution SVD (MSVD)
% input-> x: image (spatial domain)
% outputs-> Y: one level MSVD decomposition of x
% U: the unitary matrix (U in SVD)
% x=imresize(x,[256,256]);
[m,n] = size(x);
m = m/2; n = n/2;
A = zeros(4,m*n);
for j = 1:n
for i = 1:m
A(:,i + (j-1)*m) = reshape(x((i-1)*2+(1:2),(j-1)*2+(1:2)),4,1);
end
end
[U,S] = svd(A);
U
S
T = U'*A;
Y.LL = reshape(T(1,:),m,n);
Y.LH = reshape(T(2,:),m,n);
Y.HL = reshape(T(3,:),m,n);
Y.HH = reshape(T(4,:),m,n);
%%%% IMSVD %%%%%
function[x1] = IMSVD(Y,U)
% inverse MSVD (IMSVD)
% Inputs-> Y: MSVD coefficients & U: unitary matrix (U in SVD)
% output-> x: image (spaitial domain)
[m,n] = size(Y.LL);
mn = m*n;
T1 = zeros(4,mn);
T1(1,:) = reshape((Y.LL),1,mn);
T1(2,:) = reshape((Y.LH),1,mn);
T1(3,:) = reshape((Y.HL),1,mn);
T1(4,:) = reshape((Y.HH),1,mn);
% figure,imshow(Y.LL,[]);
A1 = U * T1;
x1 = zeros(m*2,n*2);
for j = 1:n
for i = 1:m
x1((i-1)*2+(1:2), (j-1)*2+(1:2)) = reshape(A1(:,i+(j-1)*m),2,2);
end
end
figure,imshow(x1,[]);
我的代码不起作用。执行后,噪音仍然存在。请有人修改此代码,以便消除噪音。