%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Illustration cours "Introduction aux Champs de Markov"%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Partie II : classification binaire d'une image bruitee 
%-------------------------------------------------------

I=imread('Iobservee.png');
imagesc(I)

S=imread('IoriginaleBW.png');
imagesc(S);

% pour forcer l'histogramme a utiliser 255 valeurs pour le vecteur v
% utiliser les commandes 
%bins=0:255;
%plot(hist(v,bins)); 

%analyse des distributions des classes




% donnees en entree a definir
% moyennes et ecart-types des classes 0 et 1 

m0= ;
m1= ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Optimisation par ICM - Programme a completer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%modifier echantillonneur en iteration_ICM
% NB il faudra appeler le fichier du nom iteration_ICM.m
beta=;
% image de classes, binaire, à initialiser
Srs=;
figure;
for n=1:100,
    Srs=iteration_ICM(I,Srs,m0,m1,beta);
    imagesc(Srs); colormap(gray)
    title(sprintf('ICM, iter %d',n));
    drawnow;
end

