以编程方式比较图像 - lib或class [英] comparing images programmatically - lib or class
问题描述
我的目标是提供2个图像文件,并获得关于这2个文件是否可以相同(在可接受的确定程度内)的真/假响应。
My objective is to supply 2 image files, and get a true/false response as to whether these 2 files could be the same (within an acceptable degree of certainty).
我意识到这个问题属于人工智能,并且比它看起来要复杂得多,所以我非常怀疑我能够(或者甚至想)自己做这件事。我正在寻找的可能是图书馆或班级。我正在使用PHP。
I realize this question falls under artificial intelligence and is much more complex than it appears, so I highly doubt I could (or would even want to) do it myself. What I'm looking for is probably a library or a class. I'm working with PHP.
提前感谢..
所有有用的答案/评论都会被投票..
All helpful answers/comments get up voted..
更新:
我想知道我是否过于复杂,也许像imageMagick(imagick)这样的更通用的库可以完成吗?任何对imageMagick更有经验的人?
推荐答案
http://tineye.com/ 可能会有用。
你可能应该做一些关于图像相似度算法的研究,虽然任何高级技术都不适合像PHP这样的脚本语言。最简单的比较方法可以这样工作:
You should probably do some research on image similarity algorithms, though anything advanced isn't going to suit a scripting language like PHP. The most simple comparison method would work like this:
- 如果图像不相同,则使两个图像大小相同。
- 比较每个相应的像素并确定它们的相似程度。最简单的方法是取红色值之间的差值,然后取蓝色值,然后取绿色值,然后平均它们。
- 取所有像素的平均差值。如果它低于你决定的某个阈值,那么图像是相同或相似的。您需要使用各种图像进行测试才能确定阈值。
我对ImageMagick和PHP的图像功能并不完全熟悉所以不确定你是否可以做到这一切。
I'm not totally familiar with ImageMagick and PHP's image functions so not sure if you can do all of this.
这篇关于以编程方式比较图像 - lib或class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!