#### Archived

This topic is now archived and is closed to further replies.

# Image comparison problem

This topic is 6925 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello all, I have a problem that is not necessarily related to game programming, but I figured that someone here might know of a good solution. I have a system of determining the outline of 2D vector images. It is a simple system that basically slices the image into 64 sections from top to bottom, and determines the left side and right side extents of the vector image. There is an array of "left" and "right" sides with 64 elements. Element 0 is the top and element 63 is the bottom. One way to think about it is to picture fingers coming in from the left and the right hand side. The fingers bump into the image and can record the shape of the image. This works very quickly and can determine the outline of many images and even handles some concavity. Now, here is the problem. Lets say that I have a "reference" image. I do my outline array trick and now I have 64 entries of "left" and "right" sides. Now I want to compare this image with a "test" image to see how closely the test image matches the reference image. It would seem that this method of comparison drastically reduces the calculations needed to compare two images. Indeed, the images can be drawn in a completely different order -- the only thing that matters is the outline. So I need a way to compare the 64 left and right entries from the reference image, and tell me how close of a match this one is to the test image. Ideally, if the test image has the same outline, I will get some round number like 0 error, or 100% match. Any ideas of how to compare the two images this way? The problem actually reminds me of comparing voice-print data. Bill

##### Share on other sites
Hi Bill,

I'm not sure of a couple of things but let's say your test image is the same size as your original image and that you perform the same outline routine on your test image.

Could you not just subtract and take the absolute values of the left and left test image arrays and right and right test image arrays and add them all up?

I'm not sure this is what you are looking for.

Another way is to take for instance a neural net, have a lot of test images, compute as above for each test image, and train the neural net while giving inputs for each test image as whether or not you feel the images are close.

Another thing,

I'm not sure what kind of images you are working on, but you might be careful about this type of comparison. You might have contours (i picture in my mind) that go deep within the picture or blobs, and a test image that does not have these characteristics and wind up with a close comparison measure.

Hope this helps,

Nick

"... you act as if stupidity were a virtue."
-- Flight of the Phoenix

Edited by - NickGA on 5/2/00 5:49:01 AM

##### Share on other sites
Just a though: you could use instead of the distance to the right/distance to the left the difference between them, so you''d have to compare half the values (this would give you errors if you compared a common banana with a straight one, though)
..And the point about pictures like an "U" being equal to filled "U"''s is valid.

##### Share on other sites
...that was me back there

• 10
• 13
• 52
• 11
• 15