資源簡(jiǎn)介
TV正則化對(duì)圖像去噪。 matlab代碼,導(dǎo)入圖片直接可以運(yùn)行。TV正則化對(duì)圖像去噪。 matlab代碼,導(dǎo)入圖片直接可以運(yùn)行
代碼片段和文件信息
clear?all;clc;
%--------------------------------------------------------------------------?
%?Total?Variation?Regularization?Method?
%--------------------------------------------------------------------------?
I?=?imread(‘0.tif‘);
%?load(‘C:\Users\admin\Desktop\matlab.mat‘)
%?I=matrix;
figureimagesc(I);?
title(‘Original?Image‘);?
xlabel(‘No:of?pixels‘);?
ylabel(‘No:of?pixels‘);?
N?=?32;?%?Image?Size?
I_res?=?reshape(IN^21);?%?Image?Vector?
%?Computing?the?PSF?
b?=?10;?%?Band?
s?=?7;?%?Sigma?value?
Z?=?[exp(-([0:b-1].^2)/(2*s^2))zeros(1N-b)];?
A?=?toeplitz(Z);?
A?=?(1/(2*pi*s^2))*kron(AA);?%?Point?Spread?Function?
%?Addition?of?Gaussina?Noise?
%?noise?=?imnoise(I‘gaussian‘00.005);?
for?n=1:32
????noise(:n)=awgn(I(:n)10*log10(1/(0.05)^2)‘measured‘);
end
figureimagesc(noise);?
title(‘Noise?added?to?the?image‘);?
xlabel(‘No:of?pixels‘);?
ylabel(‘No:of?pixels‘);?
%?Creating?Noise?Image.?
x?=?zeros(NN);?
noisex?=?imnoise(x‘gaussian‘00.005);?
figureimagesc(x);?
figureimagesc(noisex);?
title(‘Noise‘);?
%?Lexicographic?Arrangement?of?Noisy?image?
Nr?=?reshape(noise32^21);?
lg_Nr?=?double(Nr);?
%?g?is?the?blurred?image?
%?I_res?is?the?resized?image?to?32*1?
%?I_org?is?the?image?restored?back?to?original?size?of?32*32?
g?=?A*lg_Nr;?
I_blur?=?reshape(g3232);?
figureimagesc(I_blur);?
title(‘Blurred?and?Noisy?Image‘);?
xlabel(‘No:of?pixels‘);?
ylabel(‘No:of?pixels‘);?
%?Computing?the?Least?square?method?
%?using?in-built?command?
lsinbuilt?=?lsqr(Ag);?
imagesc(reshape(lsinbuilt3232));?
title(‘Least?Square?Output?using?the?inbuilt?Matlab?command‘);?
xlabel(‘No:of?pixels‘);?
ylabel(‘No:of?pixels‘);?
%?Least?suqares?using?formulation?
inverse?=?(transpose(A)*A)^-1*transpose(A)*g;?
lsrest?=?reshape(inverse3232);?
figureimagesc(lsrest);?
title(‘Least?Square?Output?using?the?formulation‘);?
xlabel(‘No:of?pixels‘);?
ylabel(‘No:of?pixels‘);?
fixed_iter?=?512;?%?fixed?point?iteration?
%?fixed_iter?=?10;?%?fixed?point?iteration?
beta?=?0.1;?%?Smoothing?factor?
lamda?=?1.5e-05;?%?Regularization?parameter?
%?Non-Linear?Equation?
%?Computation?of?Regularization?operator:?
n?=?32;?
nsq?=?n^2;?
Delta_x?=?1?/?n;?
Delta_y?=?Delta_x;?
D?=?spdiags([-ones(n1)?ones(n1)]?[0?1]?nn)?/?Delta_x;?
I_trunc1?=?spdiags(ones(n1)?0?nn);?
Dx1?=?kron(DI_trunc1);?%?Forward?(upwind)?differencing?in?x?
Dy1?=
評(píng)論
共有 條評(píng)論