img_hash.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #ifndef OPENCV_IMG_HASH_H
  5. #define OPENCV_IMG_HASH_H
  6. #include "opencv2/img_hash/average_hash.hpp"
  7. #include "opencv2/img_hash/block_mean_hash.hpp"
  8. #include "opencv2/img_hash/color_moment_hash.hpp"
  9. #include "opencv2/img_hash/marr_hildreth_hash.hpp"
  10. #include "opencv2/img_hash/phash.hpp"
  11. #include "opencv2/img_hash/radial_variance_hash.hpp"
  12. /**
  13. @defgroup img_hash The module brings implementations of different image hashing algorithms.
  14. Provide algorithms to extract the hash of images and fast way to figure out most similar images in
  15. huge data set.
  16. Namespace for all functions is cv::img_hash.
  17. ### Supported Algorithms
  18. - Average hash (also called Different hash)
  19. - PHash (also called Perceptual hash)
  20. - Marr Hildreth Hash
  21. - Radial Variance Hash
  22. - Block Mean Hash (modes 0 and 1)
  23. - Color Moment Hash (this is the one and only hash algorithm resist to rotation attack(-90~90 degree))
  24. You can study more about image hashing from following paper and websites:
  25. - "Implementation and benchmarking of perceptual image hash functions" @cite zauner2010implementation
  26. - "Looks Like It" @cite lookslikeit
  27. ### Code Example
  28. @include samples/hash_samples.cpp
  29. ### Performance under different attacks
  30. ![Performance chart](img_hash/doc/attack_performance.JPG)
  31. ### Speed comparison with PHash library (100 images from ukbench)
  32. ![Hash Computation chart](img_hash/doc/hash_computation_chart.JPG)
  33. ![Hash comparison chart](img_hash/doc/hash_comparison_chart.JPG)
  34. As you can see, hash computation speed of img_hash module outperform [PHash library](http://www.phash.org/) a lot.
  35. PS : I do not list out the comparison of Average hash, PHash and Color Moment hash, because I cannot
  36. find them in PHash.
  37. ### Motivation
  38. Collects useful image hash algorithms into opencv, so we do not need to rewrite them by ourselves
  39. again and again or rely on another 3rd party library(ex : PHash library). BOVW or correlation
  40. matching are good and robust, but they are very slow compare with image hash, if you need to deal
  41. with large scale CBIR(content based image retrieval) problem, image hash is a more reasonable
  42. solution.
  43. ### More info
  44. You can learn more about img_hash modules from following links, these links show you how to find
  45. similar image from ukbench dataset, provide thorough benchmark of different attacks(contrast, blur,
  46. noise(gaussion,pepper and salt), jpeg compression, watermark, resize).
  47. * [Introduction to image hash module of opencv](http://qtandopencv.blogspot.my/2016/06/introduction-to-image-hash-module-of.html)
  48. * [Speed up image hashing of opencv(img_hash) and introduce color moment hash](http://qtandopencv.blogspot.my/2016/06/speed-up-image-hashing-of-opencvimghash.html)
  49. ### Contributors
  50. Tham Ngap Wei, thamngapwei@gmail.com
  51. */
  52. #endif // OPENCV_IMG_HASH_H