how to compare ground truth image with segmented image?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
tashu Dabariya
el 29 de Jul. de 2019
Respondida: Leandro Hidalgo Torres
el 25 de Oct. de 2019
BW2=imread('C2.png'); %segmented image
figure,imshow(BW2)
BW=imread('001_mask.png'); %groundtruth-image
figure,imshow(BW)
% mask = false(size(BW2));
% mask(25:end-25,25:end-25) = true;
% BW = activecontour(BW2, mask, 300);
similarity = jaccard (BW2, BW)
figure
imshowpair(BW2, BW)
title(['Jaccard Index = ' num2str(similarity)])
I am trying to find accuracy but got an error.
Undefined function 'jaccard' for input arguments of type 'uint8'.
Error in Untitled (line 8)
similarity = jaccard (BW2, BW)
what will be changed in this code?
2 comentarios
Arslan Ahmed Awan
el 22 de Oct. de 2019
You have to Install MATLAB R2017b because jaccard was introduced in Image Processing Toolbox of R2017b.
Respuestas (2)
Constantino Carlos Reyes-Aldasoro
el 22 de Oct. de 2019
Jaccard index is the intersection (BW.*BW2) over the union (BW|BW2) or ((BW+BW2)>0), so you can calculate directly like this
sum(sum( BW.*BW2)) / sum(sum( BW|BW2))
Accuracy is different, that is how many pixels are exactly the same (including background)
sum(sum(BW==BW2)) / prod(size(BW))
0 comentarios
Leandro Hidalgo Torres
el 25 de Oct. de 2019
Hi,
Jaccard needs their arguments to be logical type. Check the data type of BW and BW2, surely they are uint8 type. If it's true, use BW=logical(BW) and the problem will be solved,
Best regards,
LH
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!