用于比较图像相似度的Java库

发布于 2024-12-23 01:30:01 字数 1540 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ゞ花落谁相伴 2024-12-30 01:30:01

您可以看一下 SO 本身的两个答案: 这个是关于图像比较本身,提供链接用 C++ 填充(如果我没读错的话),而 这个提供指向更广泛方法的链接,其中之一位于 C 中。

我建议从第二个链接开始,因为该讨论中的链接将导致一些相关技术的实现代码,您可以自己将其“翻译”为 Java。

这是我的谷歌技能所能做到的最好的,但没有 Java - 抱歉。我希望这是一个好的起点!

编辑:
这里有人遇到了你的问题,他用 Java 编写了自己的比较类。不过我没有读过源代码。他明确表示他也找不到用于此目的的 Java 库,因此他自己编写了它。

哦,这个关于SO的问题可能有最好的链接 关于这一点,所有关于图像处理的Java库。希望其中有一个可以比较图像的相似性。

好的,最后编辑:
Java图像处理手册展示了确定两张图片之间差异的基本算法的 Java 实现。它还包含一封用于联系撰写该文章的人的电子邮件以及大量参考资料。虽然没有图书馆。

阅读您对问题的评论后进行编辑:
除非您已经检查了上述所有链接,因为您想要的似乎是检查两个图像是否相等,所以我建议从 Java 图像处理食谱开始(因为它有一个 Java 算法的实现来检查两个图像是否相等)相同的图像)以及最后一个指向 SO 问题的链接。另外,检查 PerceptualImageDiff 和该项目的源代码(C++);这听起来真的很漂亮——它显然应该检查两个图像看起来是否与人类视觉系统相同。

You could take a look at two answers on SO itself: this one is about image comparison itself, offering links to stuff in C++ (if I read correctly) while this one offers links to broader approaches, one being in C.

I would suggest starting with the second link since there's links on that discussion that'll lead to implementation code of some relevant techniques which you might be able to "translate" into Java yourself.

That's the best my google skills could do, no Java though - sorry. I hope it's a good starting point!

EDIT:
Here's someone with your problem who wrote his own comparison class in Java. I didn't read the source code though. He expressly states that he couldn't find Java libraries for that purpose either, so that's why he wrote it himself.

Oh, and this question on SO has probably the best links on this, all regarding Java libraries of image processing. Hopefully there's one amongst them that can compare images for similarity.

Ok, last edit:
The Java Image Processing Cookbook shows a Java implementation of a basic algorithm to determine the difference between two pictures. It also has an email to contact the guy who wrote it as well as a host of references. No library though.

EDIT after reading your comment to your question:
Unless you've already checked all of the above links, since what you want seems to be checking whether two images are equal, I would suggest starting with the Java Image Processing Cookbook (since that has an implementation of an algorithm in Java to check for equal images) and the last link to an SO question. Also, check PerceptualImageDiff and the source code of that project (C++); it sounds really nifty - it's apparently supposed to check whether two images look equal to the human visual system.

行雁书 2024-12-30 01:30:01

就在我的脑海中,OpenCV 是一个很棒的图像处理库,但它可能有点矫枉过正如果您只想比较图像。如果是这样的话,我会选择 ImageJ

有人已经在此处询问如何使用 OpenCV 来做到这一点。

我会使用 C++ 来实现此目的,但如果您必须使用 Java,有一个项目为 OpenCV 制作了 Java 包装器,这里

Just off the top of my head, OpenCV is a great image processing library, but it might be overkill if you just want to compare images. If that's the case, I'd go with ImageJ.

Someone already asked how to do this using OpenCV here.

I'd use C++ for this, but if you must use Java, there is a project which made a Java wrapper for OpenCV, here.

爱*していゐ 2024-12-30 01:30:01

我使用此链接中的类来比较两个产品图像,结果很酷。实现它并不难,只是用来比较两个图像,你只需要删除 JAI 和 Swing 等行即可。它将图像大小调整为 300x300 并返回差值,例如“1234”。最大差异值接近“11041”,如链接中所述。做除法,你可以简单地得到百分比。如果有兴趣,我可以稍后在这里发布修改后的代码。

结果很酷,但我仍然得到了“数码相机照片”,检测到与“电视照片”相似。因此,我使用 ImageJ 来检测图片中的边缘。使用检测边缘操作,ImageJ 将图像转换为边缘检测灰度图像。然后我将两个边缘检测图像放在同一个比较器中并将两个值相乘。结果变得更加准确。

获取图像的边缘检测形式

I used the class in this link to compare two product images, and the results were cool. It's not very hard to implement it just to be used for comparing two images, you just need to delete the lines of JAI and Swing and such. It resizes images to 300x300 and returns a difference value such as "1234". The maximum difference value is near "11041", it's stated in the link. Doing a division, you can simply get the percentage. If interested I can post the modified code here later.

The results were cool, but I still got "digital camera photos", detected to be similar to "TV photos". So, I used ImageJ to detect edges in the picture. Using the detect edges operation, ImageJ converts the image into a edge detected greyform image. Than I put the two edge-detected images in the same comparator and multiplied the both values. The results got even more accurate.

Getting the edge-detected form of the images

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文