Find distance or similarity index between two 2D arrays

Viewed 19

I have 2D matrices and the values are either 0 or 1. The position of 1 are different. How can I find similarity index between 2 matrix.

For example similarity score:

Matrix 1 and Matrix 2 = 0.8

Matrix 1 and Matrix 3 = 0.5

Matrix 1 and Matrix 4 = 0.3

Which indicates Matrix 1 and matrix 2 are almost similar. The position algorithm shouldn't match the position of points strictly. If two points are visually closer or the proximity is closer, then they are similar.

I tried to convert the matrix to string and then compare the strings, but it is not working.

enter image description here

0 Answers
Related