how to calculate Jaccard index using segmented image with contour of original iamge in matlab -


i have segmented image , got contour of original image using command imcontour(original_image,1) , have used code calculate jaccard index in matlab.i new in matlab please me.here code have used

 function [jaccardidx,jaccarddist] = jaccard_coefficient(img_orig,img_seg)      img_orig = logical(img_orig);    img_seg = logical(img_seg);    if ~islogical(img_orig)         error('image must in logical format');    end    if ~islogical(img_seg)         error('image must in logical format');    end    inter_image = img_orig & img_seg;    union_image = img_orig | img_seg;    jaccardidx = sum(inter_image(:))/sum(union_image(:));    jaccarddist = 1 - jaccardidx; 

but , @ time of intersection of 2 images, error comming matrix dimensions must agree , not able resolve it.thanks in advance please me.

after reading comments understand reason failure fact using matrices different dimensions: ground truth image bigger segmentation image([121 167] vs [120 161]).

in general, these images should have same size in order calculate ir jaccard index. you'll need check why did different sizes in first place.

if 100% sure it's not bug, can perform resizing of segmentation image according the size of ground truth:

segimage = imresize(segimage,size(origimage)); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -