基于opencv的小波变换的实现代码

本文详细介绍了如何使用OpenCV库实现基于Haar和Symlet小波的多层分解,包括低通和高通滤波器的设置,以及下采样过程。提供了完整的C++代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文主要是实现的是harr,symlet小波的多层分解,分解之后可以取HL,LH分量。实现代码如下:

#include <iostream>
#include "wavedec1.h"
#include <math.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <string>
#include <vector>
//#include <stadio.h>
using namespace std;
using namespace cv;
Mat WDT(Mat & _src,string _wname,int _level)
{
Mat src;
_src.convertTo(src,CV_32F);
Mat dst = Mat::zeros(src.rows,src.cols,src.type());
int N =src.rows;
int D =src.cols;
Mat lowFilter, highFilter;
wavelet(_wname,lowFilter,highFilter);
int t=1 ;
int row=N;
int col=D;
while(t<=_level)
{
for (int i=0;i<row;i++)
{
Mat oneRow = Mat::zeros(1,col,src.type());
for (int j=0;j<col;j++)
{
oneRow.at<float>(0,j) =src.at<float>(i,j);
}

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值