Fingerprints of image

指纹(fingerprint)技术:把一张图片合理的压缩成一个容量占用很小的方便计算相似度的数据集。保存每个图片的时候也保存那个指纹,要求:

  • 相同图片的指纹要一样
  • 类似图片的指纹也要类似
  • 完全不相同的图片指纹的差别很大

1) MD5: 一个微小的变化会是两个图片之间的MD5完全不一样

2) Google Image搜索:

步骤:

  1. 缩小尺寸——将图片缩小到8×8的尺寸,共64个像素
     去除图片的细节,只保留结构、明暗等基本信息,摒弃不同尺寸、比例带来的图片差异。
  2. 简化色彩
    将缩小后的图片,转为64级灰度。即所有像素点总共只有64种颜色
  3. 计算平均值
    计算所有64个像素的灰度平均值
  4. 比较像素的灰度
    将每个像素的灰度,与平均值进行比较。大于或等于平均值,=1;小于平均值,=0。
  5. 计算哈希值(指纹)
    上一步的比较结果,即一个64位的整数。1,0次序并不重要,只要保证所有图片都采用同样次序就行了。如, =  = 8f373714acfcf4d0
  6. 匹配
    比较两张图像,看看64位中有多少位是不一样的:如果不相同的数据位不超过5,就说明两张图片很相似;如果大于10,就说明这是两张不同的图片。

评价:

  • 优点是简单快速,不受图片大小缩放的影响 (最佳用途是根据缩略图,找出原图
  • 缺点是图片的内容不能变更,如在图片上加几个文字,它就认不出来了(实际应用中,往往采用更强大的pHash算法和SIFT算法,它们能够识别图片的变形。只要变形程度不超过25%,它们就能匹配原图。)

3)直方图作指纹

在图片里很多颜色是出现的概率是很小的,大部分颜色都集中于某些值中

  • 把每张图片缩放到统一的大小,这里可以是256×256, 并且统一成rgb模式
  • 统计每张图片的每个颜色的出现次数。那这里因为是rgb模式3*256=768 种颜色,生成直方图
  • 对两张图片的直方图进行比对。如果统计结果一致的话,相似度+1

评价:

  • 优点:对于图片角度变化的容忍度高
  • 缺点:颜色过分依赖,颜色或者图片光线变化稍大就检测不到

4)图片缩小指纹

findimagedupes.pl

  1. standardize image size by resampling to 160×160.
  2. grayscale it.
  3. blur it a lot. (gets rid of noise)
  4. normalize (spreads the intensity out as much as possible)
  5. equalize (make it as contrasty as possible): this is for those real dark pictures that someone has slapped a pure white logo on.
  6. resample down to 16×16.
  7. reduce to 1bpp: This basically uses a threshold to convert each pixel to either a white (0) or black (1) to 1 bit value.
  8. convert to raw mono
  9. Get the first 32 bytes of the raw image data. [the fingerprint]
  10. 匹配:XORs each fingerprint,相似度即结果中1的位数。 1 – xor(p1,p2)/256

评价:

缺点:大规模数据的话,性能会降低很多

5)”感知哈希算法”(Perceptual hash algorithm)

对每张图片生成一个”指纹”(fingerprint)字符串,然后比较不同图片的指纹。结果越接近,就说明图片越相似。byDr. Neal Krawetz

  1. Reduced to grayscale.
  2. Resize the image to 32×32.
  3. Compute the Discrete Cosine Transform (DCT) of the image. The DCT separates the image into a collection of frequencies and scalars.
  4. Just keep the top-left 8×8 of the DCT. While the DCT is 32×32, the top-left 8×8 represents the lowest frequencies in the picture.
  5. Compute the median value.
  6. Compute the hash from the DCT. Set the 64 hash bits to 0 or 1 depending on whether each of the 64 DCT values is above or below the median value.

评价:the most promising of all

 

via http://hackerlabs.org/blog/2012/07/30/organizing-photos-with-duplicate-and-similarity-checking/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: