Methods for comparing images with Java

I am looking for several methods to compare two images to see how similar they are. I am currently planning to have interest as the “end result of the similarity index”. My outline plan looks something like this:

  • The user selects 2 images for comparison.
  • Using the button, images are compared using several different methods.
  • In the end, each method will have a percentage next to it, indicating how similar the images are based on this method.

I've been reading a lot lately, and some of the materials that I read seem incredibly complex and advanced, and not for people like me, only with a year of Java experience. So far I read about:

  • The Fourier transform is im pretty confusing to implement in Java, but apparently the Java Advanced Imaging API has a class for it. Although I'm not sure how to convert the result to the actual result

  • SIFT algorithm - seems incredibly complex

  • Histograms - Perhaps the easiest of all mentioned so far

  • Pixel grabbing - It seems viable, but if there is a significant number of changes between two images, it does not look like it will produce any exact result. Maybe I'm wrong?

I also have the idea of ​​preprocessing the image using a Sobel filter and then comparing it. The problem is the actual comparative part.

So yes, I am looking to see if anyone has any ideas for comparing images in Java. I hope that there are people here who previously did similar projects. I just want some input on viable comparison methods that are too difficult to implement in Java.

Thank you in advance

+7
java comparison image-processing fft
Dec 01 '10 at 19:22
source share
2 answers
  • Fourier transform - this can be used to efficiently calculate cross-correlation , which describes how to align two images and how similar to them when they are optimally aligned.
  • Sift descriptors - they can be used to compare local functions. They are often used for correspondence analysis and object recognition. (See Also SURF )
  • Histograms. Normalized cross-correlation often gives good results for comparing images globally. But since you are simply comparing the distribution of colors, you can end up declaring an outdoor scene with a lot of snow, like a room with lots of white wallpaper ...
  • Pixel capture - I don’t know what it is.

You can get a good review from this article . Another area you can explore is image content search (CBIR) .

Sorry I'm not Java specific. NTN.

+4
Dec 01 '10 at 20:06
source share

For a better alternative to simple pixel capture, try SSIM . However, this requires that your images are basically the same object at the same angle. This is useful if you are comparing images compressed using different algorithms, for example (for example, JPEG vs JPEG2000). In addition, this is a fairly simple approach that you should be able to quickly implement in order to see some results.

I do not know about the Java implementation, but there is a C ++ implementation using OpenCV . You can try to reuse this (via something like javacv ) or just write it from scratch. The algorithm itself is not so complicated, so you should be able to implement it directly.

+1
Dec 02 '10 at 2:10
source share



All Articles