2019-07-13(day038_由高斯金字塔构造拉普拉斯金字塔:高斯金字塔中,从第i层开始,Laplacian金字塔中的第i层为:高斯金字塔第i - 1层**减去**高斯金字塔中第i层放大到......

c++

#include"all.h"
using namespace std;
using namespace cv;

void pyramid_up1(Mat &image, vector<Mat> &pyramid_images, int level);
void laplaian_demo(vector<Mat> &pyramid_images, Mat &image);
void MyClass::day038() {
    Mat img = read(PATH + "images\\test.jpg");
    vector<Mat> vec;
    pyramid_up1(img, vec, 3);
    laplaian_demo(vec, img);
    waitKey(0);
}
void pyramid_up1(Mat &image, vector<Mat> &pyramid_images, int level) {
    Mat temp = image.clone();
    Mat dst;
    for (int i = 0; i < level; i++) {
        pyrDown(temp, dst);
        temp = dst.clone();
        pyramid_images.push_back(temp);
    }
}
void laplaian_demo(vector<Mat> &pyramid_images, Mat &image) {
    //laplaian金字塔每层都比gaussian金字塔大一倍
    Mat dst;
    for (int i = pyramid_images.size() - 1; i >= 0; i--) {
        if (i - 1 >= 0) {
            pyrUp(pyramid_images[i], dst, pyramid_images[i - 1].size());
            subtract(pyramid_images[i - 1], dst, dst);
            dst = dst + Scalar(127, 127, 127);
            imshow(format("laplaian_layer_%d", i), dst);
        }
        else {
            pyrUp(pyramid_images[i], dst, image.size());
            subtract(image, dst, dst);
            dst = dst + Scalar(127, 127, 127);
            imshow(format("laplaian_layer_%d", i), dst);
        }
    }

}

c++中的新知识点:
由高斯金字塔构造拉普拉斯金字塔:高斯金字塔中,从第i层开始,Laplacian金字塔中的第i层为:高斯金字塔第i - 1层减去高斯金字塔中第i层放大到第i - 1层大小的图片

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值