evaluation of image segmentation

1 次查看(过去 30 天)
I have a problem on this program, you can help me? thank you :
I = imread('cell.tif');
figure, imshow(I), title('original image');
text(size(I,2),size(I,1)+15, ...
'Image courtesy of Alan Partin', ...
'FontSize',7,'HorizontalAlignment','right');
text(size(I,2),size(I,1)+25, ....
'Johns Hopkins University', ...
'FontSize',7,'HorizontalAlignment','right');
[junk threshold] = edge(I, 'sobel');
fudgeFactor = .5;
BWs = edge(I,'sobel', threshold * fudgeFactor);
figure, imshow(BWs), title('binary gradient mask');
se90 = strel('line', 3, 90);
se0 = strel('line', 3, 0);
BWsdil = imdilate(BWs, [se90 se0]);
figure, imshow(BWsdil), title('dilated gradient mask');
BWdfill = imfill(BWsdil, 'holes');
figure, imshow(BWdfill);
title('binary image with filled holes');
BWnobord = imclearborder(BWdfill, 4);
figure, imshow(BWnobord), title('cleared border image');
seD = strel('diamond',1);
BWfinal = imerode(BWnobord,seD);
BWfinal = imerode(BWfinal,seD);
figure, imshow(BWfinal), title('segmented image');
Imdep = title('original image');
Imseg = title('segmented image');
function valeur= Inter_LN(Imdep,Imseg)
% Calcul du contraste inter-région de Lévine et Nazif
% pour une image bmp 8bits en niveaux de gris stockée sous la forme d'une matrice
% Imseg : matrice correspondant à l'image segmentée avec des valeurs allant de 1 à n pour les n régions segmentées
% Imdep : 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.
valeur=0;
NBCLASS=double(max(max(Imseg)));
moyenne=zeros(1,NBCLASS);
contraste=zeros(1,NBCLASS);
contraste_croise=zeros(NBCLASS);
perimetre=zeros(1,NBCLASS);
frontiere=zeros(NBCLASS);
aire=zeros(1,NBCLASS);
for k=1:NBCLASS
[region_k]=find(Imseg==k);
aire(k)=length(region_k); %nb de pixels de la région k
if (aire(k)>0)
moyenne(k)=sum(sum(Imdep(region_k)))/aire(k);
else
moyenne(k)=0;
end;
Imbin=zeros(size(Imseg));
Imbin(region_k)=ones(size(region_k));
contour_k=find((double(dilate(Imbin,ones(3)))-double(Imbin))==1);
for l=1:NBCLASS
if (contour_k)
M=find(Imseg(contour_k)==l);
if (M)
frontiere(k,l)=length(M);
else
frontiere(k,l)=0;
end;
else
frontiere(k,l)=0;
end;
end;
perimetre(k)=length(contour_k);
if (perimetre(k)==0)
frontiere(k,:)=0;
else
frontiere(k,:)=frontiere(k,:)/perimetre(k);
end;
end;
for k=1:NBCLASS
for l=1:NBCLASS
if (moyenne(k)+moyenne(l)==0)
contraste_croise(k,l)=0;
else
contraste_croise(k,l)=abs(moyenne(k)-moyenne(l))/(moyenne(k)+moyenne(l));
end;
end;
contraste(k)=frontiere(k,:)*contraste_croise(k,:)';
end;
%[contraste_croise]
%pause;
valeur=(aire*contraste')/sum(aire);
disp(valeur)
  1 个评论
Image Analyst
Image Analyst 2011-8-9
What's the problem? I copied, I pasted, and it ran. No problem that I could see, other than you don't know how to use subplot and so you have 6 separate figures.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2011-8-8
Perhaps diode J17 on your mouse is suffering an P/NP junction breakdown because the power source went over-amperage because of a transient when you put new batteries in 206 days ago.
Do you have the proper equipment at home to do xenon penta-fluoride sputter welding on 34 nm scale?
  2 个评论
hamaimi sarah
hamaimi sarah 2011-8-9
you have tested my program, I found an error that says:
Function definitions are not permitted in this context.
Walter Roberson
Walter Roberson 2011-8-9
At the very top of the code, add the line
function diodeJ17
Then write the code to the file diodeJ17.m
This will remove the problem about the function definition not being permitted.
It will not, however, deal with the problem that your code never calls upon the function that gets defined there.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by