block_mean_hash.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_BLOCK_MEAN_HASH_HPP
  5. #define OPENCV_BLOCK_MEAN_HASH_HPP
  6. #include "img_hash_base.hpp"
  7. namespace cv {
  8. namespace img_hash {
  9. //! @addtogroup img_hash
  10. //! @{
  11. enum BlockMeanHashMode
  12. {
  13. BLOCK_MEAN_HASH_MODE_0 = 0, //!< use fewer block and generate 16*16/8 uchar hash value
  14. BLOCK_MEAN_HASH_MODE_1 = 1, //!< use block blocks(step sizes/2), generate 31*31/8 + 1 uchar hash value
  15. };
  16. /** @brief Image hash based on block mean.
  17. See @cite zauner2010implementation for details.
  18. */
  19. class CV_EXPORTS_W BlockMeanHash : public ImgHashBase
  20. {
  21. public:
  22. /** @brief Create BlockMeanHash object
  23. @param mode
  24. */
  25. CV_WRAP void setMode(int mode);
  26. CV_WRAP std::vector<double> getMean() const;
  27. CV_WRAP static Ptr<BlockMeanHash> create(int mode = BLOCK_MEAN_HASH_MODE_0);
  28. protected:
  29. BlockMeanHash() {}
  30. };
  31. /** @brief Computes block mean hash of the input image
  32. @param inputArr input image want to compute hash value, type should be CV_8UC4, CV_8UC3 or CV_8UC1.
  33. @param outputArr Hash value of input, it will contain 16 hex decimal number, return type is CV_8U
  34. @param mode
  35. */
  36. CV_EXPORTS_W void blockMeanHash(cv::InputArray inputArr,
  37. cv::OutputArray outputArr,
  38. int mode = BLOCK_MEAN_HASH_MODE_0);
  39. //! @}
  40. }} // cv::img_hash::
  41. #endif // OPENCV_BLOCK_MEAN_HASH_HPP