编程环境:windows下结合opencv库
//离散Haar小波变换
/*
dst深度为IPL_DEPTH_32F
nLayer为变换尺度
*/
void HaarWavelet(IplImage* src, IplImage* dst, int nLayer);
//离散Haar小波变换
/*
dst深度为IPL_DEPTH_32F
nLayer为变换尺度
*/
void HaarWavelet(IplImage* src, IplImage* dst, int nLayer)
{
if (!dst)
{
return;
}
if (((dst->width >> nLayer) << nLayer != dst->width)
|| ((dst->height >> nLayer) << nLayer != dst->height)
|| (dst->depth != IPL_DEPTH_32F)
|| (src->nChannels != 1)
|| (dst->nChannels != 1)
|| (nLayer <= 0))
{
return;
}
int x, y;
int nWidth = dst->width;
int nHeight = dst->height;
int nHalfWidth = nWidth / 2;
int nHalfHeight = nHeight / 2;
//图像数据的起始地址
float* *pfData = (float**)(malloc(sizeof(float*) * nHeight));
//保存计算过程中用到的行列数据
float* pfRow = (float*)(malloc(sizeof(float) * nWidth));
float* pfColumn = (float*)(malloc(sizeof(float) * nHeight));
C

本文介绍了在Windows操作系统中,利用OpenCV库进行图像处理的实践,特别是离散Haar小波变换的应用。通过编程实例,探讨了如何在实际操作中运用该变换进行图像分析。
最低0.47元/天 解锁文章
2702

被折叠的 条评论
为什么被折叠?



