检测两个图像在视觉上是否相同 [英] Detecting if two images are visually identical

查看:25
本文介绍了检测两个图像在视觉上是否相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时两个图像文件在文件级别上可能不同,但人们会认为它们在感知上是相同的.鉴于此,现在假设您有一个庞大的图像数据库,并且您想知道人们是否会认为数据库中存在某些图像 X.如果所有图像都有一个可感知的散列/指纹,那么可以对图像 X 进行散列,查看它是否在数据库中将是一件简单的事情.

Sometimes two image files may be different on a file level, but a human would consider them perceptively identical. Given that, now suppose you have a huge database of images, and you wish to know if a human would think some image X is present in the database or not. If all images had a perceptive hash / fingerprint, then one could hash image X and it would be a simple matter to see if it is in the database or not.

我知道有围绕这个问题的研究,并且存在一些算法,但是有没有任何工具,例如 UNIX 命令行工具或库,我可以使用它来计算这样的散列,而无需从头开始实施某些算法?

I know there is research around this issue, and some algorithms exist, but is there any tool, like a UNIX command line tool or a library I could use to compute such a hash without implementing some algorithm from scratch?

来自 findimagedupes 的相关代码,使用 ImageMagick

edit: relevant code from findimagedupes, using ImageMagick

try $image->Sample("160x160!");
try $image->Modulate(saturation=>-100);
try $image->Blur(radius=>3,sigma=>99);
try $image->Normalize();
try $image->Equalize();
try $image->Sample("16x16");
try $image->Threshold();
try $image->Set(magick=>'mono');
($blob) = $image->ImageToBlob();

警告! ImageMagick $image 对象似乎包含有关已读入的图像文件的创建时间的信息.这意味着即使对于相同的图像,您获得的 blob 也会有所不同, 如果它是在不同时间检索的.为确保指纹保持不变,请使用 $image->getImageSignature() 作为最后一步.

edit: Warning! ImageMagick $image object seems to contain information about the creation time of an image file that was read in. This means that the blob you get will be different even for the same image, if it was retrieved at a different time. To make sure the fingerprint stays the same, use $image->getImageSignature() as the last step.

推荐答案

findimagedupes 很不错.例如,您可以运行findimagedupes -v 指纹图像"以使其打印感知哈希".

findimagedupes is pretty good. You can run "findimagedupes -v fingerprint images" to let it print "perceptive hash", for example.

这篇关于检测两个图像在视觉上是否相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆