/*
参考博客:https://blog.youkuaiyun.com/akadiao/article/details/79779634
配置环境参考:https://blog.youkuaiyun.com/qq_28584889/article/details/87914831
*/
#include <iostream>
#include <bitset>
#include <string>
#include <iomanip>
#include <cmath>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\core\core.hpp>
using namespace std;
using namespace cv;
#define PI 3.1415926
#define hashLength 64
/*
功能:获取DCT系数
n:矩阵大小
quotient: 系数
quotientT: 系数转置
*/
void coefficient(const int &n, double **quotient, double **quotientT){
double sqr = 1.0/sqrt(n+0.0);
for(int i = 0; i < n; i++){
quotient[0][i] = sqr;
quotientT[i][0] = sqr;
}
for(int i = 1; i < n; i++){
for(int j = 0; j < n; j++){
quotient[i][j] = sqrt(2.0/n)*cos(i*(j+0.5)*PI/n); // 由公式得到
quotientT[j
openCV与C++的图像识别(二)——pHash
最新推荐文章于 2025-02-23 02:04:12 发布