Similarity check between two binary images

Illustration
Az - 2022-02-21T10:41:43+00:00
Question: Similarity check between two binary images

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?

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

Try the Dice Similarity Coefficient
 
 
% 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);

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!