www.pudn.com > Matlab_Markov.rar > run2.m
clear all
N=64;
beta = 2;
[x,mu,sigma] = gen_pat(N,N);
M = max(size(mu));
image(x);
color = [(0:(M-1)); (0:(M-1)); (0:(M-1)) ]'./(M-1);
colormap(color);
axis('image');
print org_seg.ps -deps
y = gen_img(mu,sigma,x);
figure
image(y);
graymap = (0:255)/255;
graymap = [graymap; graymap; graymap]';
colormap(graymap);
axis('image');
print image.ps -deps
%Compute ML estimate
x = ICM(y,mu,sigma,x,0,M);
figure
image(x);
color = [(0:(M-1)); (0:(M-1)); (0:(M-1)) ]'./(M-1);
colormap(color);
axis('image');
print mlseg.ps -deps
%Do SA iterations
for iteration = 1:1
x = SA(y,mu,sigma,x,beta,M,1);
end
figure
image(x);
color = [(0:(M-1)); (0:(M-1)); (0:(M-1)) ]'./(M-1);
colormap(color);
axis('image');
print sa1.ps -deps
%Do SA iterations
for iteration = 1:4
x = SA(y,mu,sigma,x,beta,M,iteration*0.2+1 );
end
figure
image(x);
color = [(0:(M-1)); (0:(M-1)); (0:(M-1)) ]'./(M-1);
colormap(color);
axis('image');
print sa5.ps -deps
%Do SA iterations
for iteration = 1:5
x = ICM(y,mu,sigma,x,beta,M,iteration*0.2+2.0);
end
figure
image(x);
color = [(0:(M-1)); (0:(M-1)); (0:(M-1)) ]'./(M-1);
colormap(color);
axis('image');
print sa10.ps -deps