how can I process the similarity of two images using jaccard distance in matlab gui?
1 view (last 30 days)
Show older comments
% We compute the intersection of the two lines using the "AND" operator "&".
intersectImg = intersect(J,L);
%figure; imagesc(intersectImg); axis image; colormap gray; title('intersection');
% We compute the union of the two lines using the "OR" operator "|".
unionImg = union(J,L);
%figure; imagesc(unionImg); axis image; colormap gray; title('union');
% There is only one pixel that overlaps (intersects)
numerator = sum(intersectImg(:));
% There are 5 pixels that are unioned.
denomenator = sum(unionImg(:));
% So intuitively we might expect that a similarity of 1/5 would
% be a good indication. This is exactly what Jaccard's does.
jaccardIndex = numerator/denomenator
% Jaccard distance shows how dis-similar the two line drawings are.
jaccardDistance = 1 - jaccardIndex
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!