• OpenCV (十一)图像金字塔


    图像金字塔:

    由一系列图片组成,图片由下到上逐渐变小

    上采样:

    下采样:

    高斯金字塔:

    高斯不同:

    图像金字塔代码:

    #include<opencv2/opencv.hpp>
    #include<iostream>
    
    using namespace cv;
    using namespace std;
    
    Mat src, dst, output;
    
    int main(int argc, char** argv) {
    	src = imread("D:/OpenCVprj/image/test3.jpg");
    	if (!src.data) {
    		cout << "Could not load image......
    " << endl;
    		return -1;
    	}
    	imshow("src", src);
    	//prraUp(src, dst, Size(src.cols*2, src.rows*2);
    	pyrDown(src, dst, Size(src.cols/2, src.rows/2));
    	imshow("dst", dst);
    	pyrDown(dst, output , Size(dst.cols / 2, dst.rows / 2));
    	imshow("output", output);
    
    
    	waitKey(0);
    	return 0;
    }
    

      

    高斯金字塔代码:

    #include<opencv2/opencv.hpp>
    #include<iostream>

    using namespace cv;
    using namespace std;

    Mat src, dst, output, gaussian_blur;

    int main(int argc, char** argv) {
    src = imread("D:/OpenCVprj/image/test3.jpg");
    if (!src.data) {
    cout << "Could not load image...... " << endl;
    return -1;
    }
    imshow("src", src);
    //prraUp(src, dst, Size(src.cols*2, src.rows*2);
    GaussianBlur(src, gaussian_blur, Size(7, 7), 5, 5);
    pyrDown(gaussian_blur, dst, Size(src.cols/2, src.rows/2));
    imshow("dst", dst);
    //pyrDown(dst, output , Size(dst.cols / 2, dst.rows / 2));
    //imshow("output", output);


    waitKey(0);
    return 0;
    }

    高斯不同代码:

    #include<opencv2/opencv.hpp>
    #include<iostream>
    
    using namespace cv;
    using namespace std;
    
    Mat src, dst, output, gaussian_blur, gaussian_blur_1;
    
    int main(int argc, char** argv) {
    	src = imread("D:/OpenCVprj/image/test3.jpg");
    	if (!src.data) {
    		cout << "Could not load image......
    " << endl;
    		return -1;
    	}
    	imshow("src", src);
    	//prraUp(src, dst, Size(src.cols*2, src.rows*2);
    	GaussianBlur(src, gaussian_blur, Size(7, 7), 5, 5);
    	GaussianBlur(src, gaussian_blur_1, Size(7, 7), 0, 0);
    	subtract(gaussian_blur, gaussian_blur_1, dst);
    	normalize(dst, dst, 255, 0, NORM_MINMAX);
    	//pyrDown(gaussian_blur, dst, Size(src.cols/2, src.rows/2));
    	//pyrDown(dst, output , Size(dst.cols / 2, dst.rows / 2));
    	//imshow("output", output);
    	imshow("dst", dst);
    
    	waitKey(0);
    	return 0;
    }
    

     

  • 相关阅读:
    27款经典的 CSS 框架分享
    50款非常棒的 jQuery 插件分享
    10个和 Flash 一样的 HTML5 应用演示
    Ajax 应用六个需要注意的事项
    推荐12个漂亮的 CSS3 按钮实现方案
    8个惊艳的JavaScript 为 HTML5 Canvas 提供硬件3D加速渲染应用实验
    向网页设计师推荐15个很棒的网站
    2011年度最佳 JQuery 插件分享
    javascript 技巧总结积累173231条(正在积累中)
    [转]烦人的BeforePropertieBeforeProperties,AfterProperties,properties.ListItem
  • 原文地址:https://www.cnblogs.com/haiboxiaobai/p/11238479.html
Copyright © 2020-2023  润新知