I want to apply a check if the two binary images are similar. I subtract a binary image 1 from the other to get a difference image. where Confidence = (sum(Image_1(:)) - Overlapping_Area)*100 /sum(Image_1 (:)) ; It would not be reliable if the matching images have lot of shapes and rest borders lines in difference image. Any idea?
Kshitij Singh answered .
2025-11-20
% Find out where either mask is true. unionMask = mask1 | mask2; % Find the differences. Not used - just for fun/visualization. %xorMask = xor(flippedMask, mask); % Find the common/overlap area. andMask = mask1 & mask2; % Compute the Dice Coefficient dice = nnz(andMask) / nnz(unionMask);