本文主要是实现的是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);
}<