user960439
user960439

Reputation: 125

matlab image comparison

I am trying to set up a database of images that can be used to compare to a current image (So if the current image is equal, or almost equal to the one being compared it'll give a match)

However to start this project off I want to just compare 2 images using Matlab to see how the process works.

Does anyone know how I might compare say image1.jpg and image2.jpg to see how closely related to each other they are? So basically if I was to compare image1.jpg and image1.jpg the relationship should be 100%, but comparing 2 different images might give me quite a close relationship.

I hope that makes some sense!!!

Thanks,

Upvotes: 1

Views: 1723

Answers (1)

KlausCPH
KlausCPH

Reputation: 1835

Well, the method to use greatly depend on what you define as similar images. If for example you can guarantee that translations (moves in the x and y directions) are very small (no more than a few pixels), a simple RMS subtraction measure might do fine. If this is not the case, brute force template search methods might be an option. At the other end of the scale are advanced recognition techniques using morphological measures.

The first and simplest approach might look something like this:

errorMeasure = sqrt(sum(sum(sum((image1-image2).^2))))

This method simple takes the difference and finds the "energy" of the error.

Upvotes: 2

Related Questions