15,963,836 members
See more:
I have two images (of a few thousand), lets call them image A and image B. I know that they either go side by side, AB or BA, but how can I verify this using c# code?

Some of the images, when put side by side, will match up. Lines will align, so will circles and everything else. Some will not match at all. I would like a numerical approximation as to how well they do or do not match. If one pixel on the right column of the left image is red, and on the same row a red is in the first column of the right image, then they match. Same test for Blue and Green. Since there might be variations, I would settle for a probability of matching. I could then visually exam the closer ones first.

I have tried to compare the colors, of the last column of the left image with the first column of the right image, but there is no significant difference in the values that I get. I was hoping that the red value on one side less the red value on the other might zero out, and the same with the green and the blue. This did not work out that well.

Any ideas? I have tried searching for a result, but no one seems to have tried this.

Maybe this will help. Take any image 10,000 pixels by 10,000 pixels, and slice it into 100 smaller images 1000 x 1000 pixels. What is the best way to check if any image, lets say B, belongs on one side of another image, lets say A? Without involving any form of rotation of the images, and knowing that A <> B, how do we calculate the chance that B is on A's right side, or top, bottom or left side in the original image?
Posted
Updated 30-Jun-14 8:44am
v3
Kyle Gottfried 30-Jun-14 14:17pm
Are you trying to align two images, the content of the image or simply compare two images?
Talon96 30-Jun-14 14:37pm
I am testing to see if one image fits to either side of the other image. I know some do, and visually we can perceive the match, but how can we code a test so I can examine the ones the code thinks are closest.

## Solution 1

I would consider the right border of the left image and the left border of the right one (the width of the borders is up to you). for each pixel in each border you may test the neighbour pixels and establish some properties. i would expect such properties don't change abruptly passing from one border to the other one. I know it is a bit vague, but I haven't a more precise idea, at the moment.

## Solution 2

I started off by comparing the values of ARGB between the two sides, row by row. I found that there is not enough differences between the sides that match and the ones that don't.

I am now considering taking the ABS values of the differences in Red, Green and Blue and see if that helps. Past that effort, I might compute the average of each pixel and the pixels next to it and do the same to the other image. Then compare these values...

I was hoping that someone might have done this before. I tried searching for it online, but any vocabulary I tried using came back with no (relevant) matches. Lots of information on comparing two images, just not if they have matching sides.

I'll keep checking here, and I will report if I find anything relevant. Thanks.