cv.ImgHash - MATLAB File Help Go to online doc for cv.ImgHash
cv.ImgHash

Base class for Image Hashing algorithms

This module brings implementations of different image hashing algorithms. It provides algorithms to extract the hash of images and fast way to figure out most similar images in huge data set.

Supported Algorithms

You can study more about image hashing from the paper and websites listed in the references section.

Performance under different attacks

Performance chart

Speed comparison with PHash library (100 images from ukbench)

Hash Computation chart Hash comparison chart

As you can see, hash computation speed of img_hash module outperform PHash library a lot.

PS: I do not list out the comparison of Average hash, PHash and Color Moment hash, because I cannot find them in PHash.

Motivation

Collects useful image hash algorithms into OpenCV, so we do not need to rewrite them by ourselves again and again or rely on another 3rd party library (ex: PHash library). BOVW or correlation matching are good and robust, but they are very slow compare with image hash, if you need to deal with large scale CBIR (content based image retrieval) problem, image hash is a more reasonable solution.

More info

You can learn more about img_hash modules from following links, these links show you how to find similar image from ukbench dataset, provide thorough benchmark of different attacks (contrast, blur, noise (gaussion, pepper and salt), jpeg compression, watermark, resize).

Contributors

Tham Ngap Wei

References

[lookslikeit]:

Neal Krawetz. Looks Like It.

[tang2012perceptual]:

Zhenjun Tang, Yumin Dai, Xianquan Zhang. "Perceptual Hashing for Color Images Using Invariant Moments. Appl. Math, 6(2S):643S-650S, 2012.

[zauner2010implementation]:

Christoph Zauner. "Implementation and benchmarking of perceptual image hash functions". 2010.

Class Details
Superclasses handle
Sealed false
Construct on load false
Constructor Summary
ImgHash Constructor 
Property Summary
id Object ID 
Method Summary
  addlistener Add listener for event. 
Static   averageHash Calculates the average hash in one call 
Static   blockMeanHash Computes block mean hash of the input image 
Static   colorMomentHash Computes color moment hash of the input 
  compare Compare two hash values 
  compute Computes hash of the input image 
  delete Destructor 
  eq == (EQ) Test handle equality. 
  findobj Find objects matching specified conditions. 
  findprop Find property of MATLAB handle object. 
  ge >= (GE) Greater than or equal relation for handles. 
  gt > (GT) Greater than relation for handles. 
Sealed   isvalid Test handle validity. 
  le <= (LE) Less than or equal relation for handles. 
  listener Add listener for event without binding the listener to the source object. 
  lt < (LT) Less than relation for handles. 
Static   marrHildrethHash Computes average hash value of the input image 
  ne ~= (NE) Not equal relation for handles. 
  notify Notify listeners of event. 
Static   pHash Computes pHash value of the input image 
Static   radialVarianceHash Computes radial variance hash of the input image 
  typeid Name of the C++ type (RTTI) 
Event Summary
ObjectBeingDestroyed Notifies listeners that a particular object has been destroyed.