/*
参考博客:https://blog.csdn.net/akadiao/article/details/79779634
配置环境参考:https://blog.csdn.net/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
最新推荐文章于 2023-10-25 20:18:28 发布
这篇博客探讨了使用OpenCV和C++实现图像识别的过程,特别是通过pHash算法中的离散余弦变换(DCT)系数进行图像比较。尽管结果不是非常理想,但该方法仍具有一定的参考价值。
摘要由CSDN通过智能技术生成