Hi guys,

I am trying to find the similarities between two images and scale them from 0 (totally different) to 1 (totally the same).

To be more specific, I have multiple pre-set 2D Textures and a texture from WP8.1 Camera, and I want to figure out which textures is most resemble the camera texture.

Thanks, and sorry for my English.

The Unity answer is to use:

to get the pixels from the images. The image comparison algorithm you need isn’t a Unity issue, so you probably want to ask elsewhere.

There are different ways.

One way is that

Sum up all “r ,g , b” of pixels in three longs.

Ok let

“long a1” stores sum of all “r” of first image.

“long b1” stores sum of all “g” of first image.

“long c1” stores sum of all “b” of first image.

“long a2” stores sum of all “r” of second image.

“long b2” stores sum of all “g” of second image.

“long c2” stores sum of all “b” of second image.

now compare the a1 , b1 , c1 with a2 , b2 , c2 in order to find the difference.

You can make it more simple but this will not be good.

sum a1 , b1 and c1 and divide it with the resolution of texture.

and sum a2 , b2 and c2 and divide it with resolution of texture.

Now compare these two values. However I do not prefer this.