# Image Recognition/Compare

#### czeslaw1

##### Member
Im gonna make a program to a webbrowser game.
There is a captcha, there with pictures of cars.
i need to compare these two pictures and i want the result of equalnes in PERCENT. So if the picture are 75% equal then it click on the picture.

1.
2.

#### henryminute

##### Well-known member
I think that for anyone to be able to answer your question, you need to define what you mean by equalness.
Does it mean that the average hue, brightness or another metric are within 75%?
Does it mean that the proportion of a particular colour is within 75%?

What does equalness mean to you in this context.

Whatever the answer to this, it is unlikely that I have the skills to resolve it. I am just trying to help you to get an answer.

#### bufer24

##### Active member
Certainly there are many approaches. If your application doesn´t rely much on speed, you could scan each line in the image and make a histogram from which you then compute some values like median, dispersion or something like that. But you have to decide what to measure: amount of contrast, amount of some color, brightness. You could even use the shape of the diagram (point approximation with some fuzziness) to distinguish the image similarity.
Another approach could be square approximation. Basically, comparing images means comparing their pixels. But if you whish to incorporate some level of uncertainty (similarity), you colud take bigger chunks of both images (let´s say square areas of 10x10 pixels) and compare those by calculating some representative value for each square (like some median value or average).

#### kanaida

##### Member
just a thought but if its not a ridiculous amount of pixels,

cycle through each one, make an averege R, G, B

then compare the difference between the 2 image's RGB by percentage.

so:

Image A:
Averege_R_A = 127
Agerege_G_A = 245
Agerege_B_A = 100

Dim Image_A_Averege = Averege_R_A + G + B

Do the same for Image 2

then compare the 2 values any way you want, say if the difference is greater than 25% of 255 then it would be false.