是将图像分为高斯金字塔和拉普拉斯金字塔,然后再重建
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace std;
using namespace cv;
int main()
{
Mat img1 = imread("D:\\Program Files\\1.jpg");
Mat img;
resize(img1, img, Size(400, 600));
if (img.empty())
{
cout << "图片读取失败";
return-1;
}
vector<Mat> Gauss, Lap,Gauss1;
int level = 3;
//原始图像放入高斯金字塔
Gauss.push_back(img);
for (int i = 0; i < level; i++)
{
Mat gauss;
//图像下采样,最上面的为0层
pyrDown(Gauss[i], gauss);
//放入金字塔
Gauss.push_back(gauss);
}
//拉普拉斯金字塔:就是高斯金字塔上层的下采样与下层差值
for (int i = Gauss.size() - 1; i > 0; i--)
{
Mat lap, down;
pyrUp(Gauss[i], lap);
Lap.push_back(Gauss[i - 1] - lap);
}
for (int i = Lap.size(); i > 0; i--)
{
Mat up;
pyrUp(Gauss[i], up);
Gauss1.push_back(up + Lap[i - 1]);
}
//输出两个金字塔的图像
for (int i = 0; i < Gauss.size(); i++)
{
string name = to_string(i);
imshow("G" + name, Gauss[i]);
imshow("L" + name, Lap[i]);
//输出重建后的图像
imshow("T" + name, Gauss1[i]);
}
waitKey(0);
return 0;
}
最后报错是 Size of input arguments do not match
有哪位懂图像金字塔方面的大佬可以帮一帮孩子呀
具体哪个函数调用报错啊?传入值和函数参数大小不匹配啊
也许对你有帮助:https://blog.csdn.net/it_xiangqiang/category_10993204.html