MATLAB: Evaluation of segmentation image

evaluation

I have this program that the evaluation of image segmentation, but I just can not run this program.
function [val] = IntraInter_LN(Imseg,Imori)
% function [val] = IntraInter_LN(Imseg,Imori)
% Calcul du critère d'évaluation Intra-Inter de Lévine & Nazif
% Imseg : matrice correspondant à l'image segmentée avec des valeurs allant de 1 à n pour les n régions segmentées
% Imori : matrice correspondant à l'image originale
%




% Utilitaires pour l'évaluation de la segmentation d'images
% Toolbox matlab (version 5.3)
%
% (c) Laboratoire de Vision et Robotique (UPRES EA 2078)
% ENSI de Bourges - Université d'Orléans
%
% Sébastien Chabrier : sebastien.chabrier@ensi-bourges.fr
%
% Si vous utilisez cette toolbox, veuillez citer ce papier svp.
%
%S. Chabrier, B. Emile, C. Rosenberger, H. Laurent,
%"Unsupervised performance evaluation of image segmentation",
%Special Issue on Performance Evaluation in Image Processing,
%EURASIP Journal on Applied Signal Processing, pages 1-12, 2006.
if (min(min(Imseg))==0)
Imseg=double(Imseg)+1;
end;
NBclass=double(max(max(Imseg)));
nbre2lig=size(Imori,1);
nbre2col=size(Imori,2);
% statistiques sur les l'image originale
moy=zeros(NBclass,1);
cpt=zeros(NBclass,1);
var=zeros(NBclass,1);
for i=1:nbre2lig
for j=1:nbre2col
moy(Imseg(i,j))=double(moy(Imseg(i,j)))+double(Imori(i,j));
var(Imseg(i,j))=double(var(Imseg(i,j)))+double(Imori(i,j))*double(Imori(i,j));
cpt(Imseg(i,j))=double(cpt(Imseg(i,j)))+1;
end;
end;
for i=1:NBclass
if (cpt(i)~=0)
moy(i)=moy(i)/cpt(i);
var(i)=var(i)/cpt(i);
end;
var(i)=var(i)-moy(i)*moy(i);
end;
% disparite intraclasse
aux1=0.0;
for i=1:NBclass
aux1=aux1+(4.0/(255.0*255.0))*var(i);
end;
aux1=aux1/NBclass;
% disparite interclasse
aux2=0.0;
cpt2=0;
for i=1:NBclass
aux=0.0;
for j=1:NBclass
if (i~=j)
aux=aux+abs(moy(i)-moy(j))/512;
cpt2=cpt2+1;
end;
end;
aux2=aux2+aux;
end;
if (cpt2>0)
aux2=aux2/cpt2;
end;
val=(1+aux2-aux1)/2;
disp(val)

Best Answer

What happens when you try to run it?
What data class should the input images be? Should they be grayscale (2 dimensional) or RGB (3 dimensional) ?