添加项目文件。

This commit is contained in:
CaiXiang
2025-01-20 10:30:01 +08:00
parent 77371da5d7
commit 752be79e06
1010 changed files with 610100 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_AVERAGE_HASH_HPP
#define OPENCV_AVERAGE_HASH_HPP
#include "img_hash_base.hpp"
namespace cv {
namespace img_hash {
//! @addtogroup img_hash
//! @{
/** @brief Computes average hash value of the input image
This is a fast image hashing algorithm, but only work on simple case. For more details, please
refer to @cite lookslikeit
*/
class CV_EXPORTS_W AverageHash : public ImgHashBase
{
public:
CV_WRAP static Ptr<AverageHash> create();
protected:
AverageHash() {}
};
/** @brief Calculates img_hash::AverageHash in one call
@param inputArr input image want to compute hash value, type should be CV_8UC4, CV_8UC3 or CV_8UC1.
@param outputArr Hash value of input, it will contain 16 hex decimal number, return type is CV_8U
*/
CV_EXPORTS_W void averageHash(cv::InputArray inputArr, cv::OutputArray outputArr);
//! @}
}} // cv::img_hash::
#endif // OPENCV_AVERAGE_HASH_HPP

View File

@@ -0,0 +1,52 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_BLOCK_MEAN_HASH_HPP
#define OPENCV_BLOCK_MEAN_HASH_HPP
#include "img_hash_base.hpp"
namespace cv {
namespace img_hash {
//! @addtogroup img_hash
//! @{
enum BlockMeanHashMode
{
BLOCK_MEAN_HASH_MODE_0 = 0, //!< use fewer block and generate 16*16/8 uchar hash value
BLOCK_MEAN_HASH_MODE_1 = 1, //!< use block blocks(step sizes/2), generate 31*31/8 + 1 uchar hash value
};
/** @brief Image hash based on block mean.
See @cite zauner2010implementation for details.
*/
class CV_EXPORTS_W BlockMeanHash : public ImgHashBase
{
public:
/** @brief Create BlockMeanHash object
@param mode the mode
*/
CV_WRAP void setMode(int mode);
CV_WRAP std::vector<double> getMean() const;
CV_WRAP static Ptr<BlockMeanHash> create(int mode = BLOCK_MEAN_HASH_MODE_0);
protected:
BlockMeanHash() {}
};
/** @brief Computes block mean hash of the input image
@param inputArr input image want to compute hash value, type should be CV_8UC4, CV_8UC3 or CV_8UC1.
@param outputArr Hash value of input, it will contain 16 hex decimal number, return type is CV_8U
@param mode the mode
*/
CV_EXPORTS_W void blockMeanHash(cv::InputArray inputArr,
cv::OutputArray outputArr,
int mode = BLOCK_MEAN_HASH_MODE_0);
//! @}
}} // cv::img_hash::
#endif // OPENCV_BLOCK_MEAN_HASH_HPP

View File

@@ -0,0 +1,41 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_COLOR_MOMENT_HASH_HPP
#define OPENCV_COLOR_MOMENT_HASH_HPP
#include "img_hash_base.hpp"
namespace cv {
namespace img_hash {
//! @addtogroup img_hash
//! @{
/** @brief Image hash based on color moments.
See @cite tang2012perceptual for details.
*/
class CV_EXPORTS_W ColorMomentHash : public ImgHashBase
{
public:
CV_WRAP static Ptr<ColorMomentHash> create();
protected:
ColorMomentHash() {}
};
/** @brief Computes color moment hash of the input, the algorithm
is come from the paper "Perceptual Hashing for Color Images
Using Invariant Moments"
@param inputArr input image want to compute hash value,
type should be CV_8UC4, CV_8UC3 or CV_8UC1.
@param outputArr 42 hash values with type CV_64F(double)
*/
CV_EXPORTS_W void colorMomentHash(cv::InputArray inputArr, cv::OutputArray outputArr);
//! @}
}} // cv::img_hash::
#endif // OPENCV_COLOR_MOMENT_HASH_HPP

View File

@@ -0,0 +1,46 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_IMG_HASH_BASE_HPP
#define OPENCV_IMG_HASH_BASE_HPP
#include "opencv2/core.hpp"
namespace cv {
namespace img_hash {
//! @addtogroup img_hash
//! @{
/** @brief The base class for image hash algorithms
*/
class CV_EXPORTS_W ImgHashBase : public Algorithm
{
public:
class ImgHashImpl;
~ImgHashBase();
/** @brief Computes hash of the input image
@param inputArr input image want to compute hash value
@param outputArr hash of the image
*/
CV_WRAP void compute(cv::InputArray inputArr, cv::OutputArray outputArr);
/** @brief Compare the hash value between inOne and inTwo
@param hashOne Hash value one
@param hashTwo Hash value two
@return value indicate similarity between inOne and inTwo, the meaning
of the value vary from algorithms to algorithms
*/
CV_WRAP double compare(cv::InputArray hashOne, cv::InputArray hashTwo) const;
protected:
ImgHashBase();
protected:
Ptr<ImgHashImpl> pImpl;
};
//! @}
} } // cv::img_hash::
#endif // OPENCV_IMG_HASH_BASE_HPP

View File

@@ -0,0 +1,64 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_MARR_HILDRETH_HASH_HPP
#define OPENCV_MARR_HILDRETH_HASH_HPP
#include "img_hash_base.hpp"
namespace cv {
namespace img_hash {
//! @addtogroup img_hash
//! @{
/** @brief Marr-Hildreth Operator Based Hash, slowest but more discriminative.
See @cite zauner2010implementation for details.
*/
class CV_EXPORTS_W MarrHildrethHash : public ImgHashBase
{
public:
/**
* @brief self explain
*/
CV_WRAP float getAlpha() const;
/**
* @brief self explain
*/
CV_WRAP float getScale() const;
/** @brief Set Mh kernel parameters
@param alpha int scale factor for marr wavelet (default=2).
@param scale int level of scale factor (default = 1)
*/
CV_WRAP void setKernelParam(float alpha, float scale);
/**
@param alpha int scale factor for marr wavelet (default=2).
@param scale int level of scale factor (default = 1)
*/
CV_WRAP static Ptr<MarrHildrethHash> create(float alpha = 2.0f, float scale = 1.0f);
protected:
MarrHildrethHash() {}
};
/** @brief Computes average hash value of the input image
@param inputArr input image want to compute hash value,
type should be CV_8UC4, CV_8UC3, CV_8UC1.
@param outputArr Hash value of input, it will contain 16 hex
decimal number, return type is CV_8U
@param alpha int scale factor for marr wavelet (default=2).
@param scale int level of scale factor (default = 1)
*/
CV_EXPORTS_W void marrHildrethHash(cv::InputArray inputArr,
cv::OutputArray outputArr,
float alpha = 2.0f, float scale = 1.0f);
//! @}
}} // cv::img_hash::
#endif // OPENCV_MARR_HILDRETH_HASH_HPP

View File

@@ -0,0 +1,41 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_PHASH_HPP
#define OPENCV_PHASH_HPP
#include "img_hash_base.hpp"
namespace cv {
namespace img_hash {
//! @addtogroup img_hash
//! @{
/** @brief pHash
Slower than average_hash, but tolerant of minor modifications
This algorithm can combat more variation than averageHash, for more details please refer to @cite lookslikeit
*/
class CV_EXPORTS_W PHash : public ImgHashBase
{
public:
CV_WRAP static Ptr<PHash> create();
protected:
PHash() {}
};
/** @brief Computes pHash value of the input image
@param inputArr input image want to compute hash value,
type should be CV_8UC4, CV_8UC3, CV_8UC1.
@param outputArr Hash value of input, it will contain 8 uchar value
*/
CV_EXPORTS_W void pHash(cv::InputArray inputArr, cv::OutputArray outputArr);
//! @}
} } // cv::img_hash::
#endif // OPENCV_PHASH_HPP

View File

@@ -0,0 +1,58 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_RADIAL_VARIANCE_HASH_HPP
#define OPENCV_RADIAL_VARIANCE_HASH_HPP
#include "img_hash_base.hpp"
namespace cv {
namespace img_hash {
//! @addtogroup img_hash
//! @{
/** @brief Image hash based on Radon transform.
See @cite tang2012perceptual for details.
*/
class CV_EXPORTS_W RadialVarianceHash : public ImgHashBase
{
public:
CV_WRAP static Ptr<RadialVarianceHash> create(double sigma = 1, int numOfAngleLine = 180);
CV_WRAP int getNumOfAngleLine() const;
CV_WRAP double getSigma() const;
CV_WRAP void setNumOfAngleLine(int value);
CV_WRAP void setSigma(double value);
// internals
std::vector<double> getFeatures();
cv::Mat getHash();
Mat getPixPerLine(Mat const &input);
Mat getProjection();
protected:
RadialVarianceHash() {}
};
/** @brief Computes radial variance hash of the input image
@param inputArr input image want to compute hash value,
type should be CV_8UC4, CV_8UC3, CV_8UC1.
@param outputArr Hash value of input
@param sigma Gaussian kernel standard deviation
@param numOfAngleLine The number of angles to consider
*/
CV_EXPORTS_W void radialVarianceHash(cv::InputArray inputArr,
cv::OutputArray outputArr,
double sigma = 1,
int numOfAngleLine = 180);
//! @}
}} // cv::img_hash::
#endif // OPENCV_RADIAL_VARIANCE_HASH_HPP