Java library for comparing image affinities

I spent quite a bit of time exploring a library that allows me to compare images with each other in Java.

I really didn't find anything useful, maybe my GoogleSearch skill is not high enough, so I thought I would ask you guys if you can tell me the direction of where I could find something like this.

Basically, I want to compare two images with each other and get the value of how similar they are. As a percentage or so.

Hope you guys have something that I can use, I don't know how to write something like that ...

PS: It doesn't have to be in Java, it's just the environment in which my application will run.

+49
java comparison image similarity
Dec 27 '11 at 13:00
source share
3 answers

You can take a look at two answers to SO itself: this example concerns image comparison itself, offering links to things in C ++ (if I read correctly), and this channel offers links to wider approaches, one of which is in C.

I would suggest starting with the second link, as there are links to this discussion, which will lead to the implementation of the code of some relevant methods that you could "translate" into Java yourself.

What my best Google skills could do, not a single Java, though - sorry. Hope this is a good starting point!

EDIT: Here, someone with your problem wrote their comparison class in Java . However, I did not read the source code. He bluntly states that he, too, could not find Java libraries for this purpose, so he wrote it himself.

Oh, and this SO question has probably the best links on this subject regarding Java image processing libraries. Hopefully there is one among them that can compare images for similarities.

Ok, last edit: The Java image processing book shows a Java implementation of a basic algorithm for determining the difference between two pictures. He also has an email to contact the guy who wrote it, as well as many links. There is no library.

EDIT after reading your comment on your question: If you have not already checked all of the above links, since it seems to you that you are checking if the two images are equal, I would suggest starting with the Java image processing Cookbook (since this has an implementation of the algorithm on Java for checking equal images) and the last link to the SO question. Also check out the PerceptualImageDiff and the source code for this project (C ++); it sounds very elegant - apparently, he must check whether the two images correspond to the human visual system .

+28
Dec 27 '11 at 1:06 p.m.
source share

Top of my head, OpenCV is a great image processing library, but it can be redundant if you just want to compare images. If so, I would go with ImageJ .

Someone has already asked how to do this using OpenCV here .

I would use C ++ for this, but if you have to use Java, there is a project that made the Java shell for OpenCV, here .

+8
Dec 27 '11 at 13:10
source share

I used the class in this link to compare two product images, and the results were cool. It is not very difficult to implement, just to compare two images, you just need to delete the JAI and Swing lines, etc. It resizes images to 300x300 and returns the difference value, for example, "1234". The maximum difference value is about 11041, indicated in the link. By doing a split, you can just get a percentage. If interested, I can post the modified code here later.

The results were cool, but I still have β€œdigital camera photos” that show up as β€œTV photos.” So, I used ImageJ to detect edges in the picture. Using the edge detection operation, ImageJ converts the image into a detected edge greyform image. Then I put the two detected edges of the image in the same comparator and multiplied both values. The results are even more accurate.

Obtaining image edges detected at the edges

+7
May 20 '12 at 1:16
source share



All Articles