There are two common kinds of image pyramids:
– Gaussian pyramid: Used to downsample images
– Laplacian pyramid: Used to reconstruct an upsampled image from an image lower in the pyramid (with
less resolution)

• In this tutorial we’ll use the Gaussian pyramid

Imagine the pyramid as a set of layers in which the higher the layer, the smaller the size.

Notice that it is important that the input image can be divided by a factor of two (in both dimensions).
Otherwise, an error will be shown.
– Finally, we update the input image tmp with the current image displayed, so the subsequent operations

are performed on it.

#include <opencv.hpp>using namespace cv;
/// Global variables
Mat src, dst, tmp;
char* window_name = "Pyramids Demo";
/**
* @function main
*/
int main(int argc, char** argv)
{/// General instructionsprintf("\n Zoom In-Out demo \n ");printf("------------------ \n");printf(" * [u] -> Zoom in \n");printf(" * [d] -> Zoom out \n");printf(" * [ESC] -> Close program \n \n");/// Test image - Make sure it s divisible by 2^{n}src = imread("beauty.jpg");if (!src.data){printf(" No data! -- Exiting the program \n");return -1;}tmp = src;dst = tmp;/// Create windownamedWindow(window_name, CV_WINDOW_AUTOSIZE);imshow(window_name, dst);/// Loopwhile (true){int c;c = waitKey(10);if ((char)c == 27){break;}if ((char)c == 'u'){pyrUp(tmp, dst, Size(tmp.cols * 2, tmp.rows * 2));printf("** Zoom In: Image x 2 \n");}else if ((char)c == 'd'){pyrDown(tmp, dst, Size(tmp.cols / 2, tmp.rows / 2));printf("** Zoom Out: Image / 2 \n");}imshow(window_name, dst);tmp = dst;}return 0;
}

beauty.jpg

Image Pyramids相关推荐

  1. 人体姿态估计--Learning Feature Pyramids for Human Pose Estimation

    Learning Feature Pyramids for Human Pose Estimation ICCV2017 Torch: https://github.com/bearpaw/PyraN ...

  2. OpenCV Image Pyramids影像金字塔

    OpenCV Image Pyramids影像金字塔 Image Pyramids影像金字塔 目标 理论 影像金字塔Image Pyramids 高斯金字塔 代码 解释 载入图片 建立视窗 环形 结果 ...

  3. Exploring Pyramids【动态规划——区间DP】

    Exploring Pyramids UVALive - 3516 题目传送门 题目大意:给你一个字符串,其代表的是机器人来回走过的路径,机器人总是先走左边再走右边,问有多少种情况. 解决方法:设输入 ...

  4. 金字塔c_双语阅读:The Pyramids 古埃及金字塔(MP3)

    The Pyramids 古埃及金字塔 Built 4,000 years ago, the three great pyramids at Giza, in the Egyptian desert ...

  5. LA3516 Exploring Pyramids

    f(i,j)表示 si  si+1.. sj对应的子树个数. 状态转移 f(i,j)=sum{f(i+1,k-1)*f(k,j)}    i+2<=k<=j   且si=sk=sj 边界条 ...

  6. 摄像头定位:ICCV2019论文解析

    摄像头定位:ICCV2019论文解析 SANet: Scene Agnostic Network for Camera Localization 论文链接: http://openaccess.the ...

  7. 3D目标检测论文阅读多角度解析

    3D目标检测论文阅读多角度解析 一.前言 CNN(convolutional neural network)在目标检测中大放异彩,R-CNN系列,YOLO,SSD各类优秀的方法层出不穷在2D图像的目标 ...

  8. OpenCV-Python形态变换、图像金字塔、轮廓属性、直方图

    OpenCV基础 1. Morphological Transformations(形态变换) 2. Image Pyramids(图像金字塔) 3. Contours(轮廓) 4. 轮廓的特性进阶 ...

  9. OpenCV 【十九】图像金字塔/基本的阈值操作/实现自己的线性滤波器

    目录 1.part one 图像金字塔 1.1原理 1.1.1图像金字塔 1.1.2高斯金字塔 1.2代码 1.3运行结果 2.part two 基本的阈值操作¶ 2.1原理 2.1.1阈值化的类型: ...

  10. TermCriteria模板类

    学习写vo过程中遇到的 类功能:模板类,作为迭代算法的终止条件. 构造函数: TermCriteria(int type,int maxCount,double epsilon); 参数说明: typ ...

最新文章

  1. Ubuntu系统版本升级(提前版)
  2. 悟透delphi 第十章 操作界面与操作逻辑
  3. wireshark如何对指定ip进行嗅探
  4. Serverless:云函数 + 小马BI,将报表极速搬上云
  5. mysql映射文件_Mybatis SQL映射文件
  6. Qt学习笔记-仿大佬读取setting文件(简单工厂模式)
  7. eclipse插件开发(三) 简易4页签编辑器(源码 | 设计 | JS | CSS)配色修复JS多行注释问题
  8. 文章采集伪原创工具_伪原创文章技巧(如何提高伪原创文章的原创度)
  9. 002..NET MVC实现自己的TempBag
  10. poj1274 匈牙利算法 二分图最大匹配
  11. 【C++沉思录】代理类
  12. 1004-史丰收速算
  13. 【饥荒脚本】饥荒控制台代码自动输入
  14. Servlet 使用getRequestDispatcher进行请求转发页面未跳转 后台也未报错的问题的解决方法
  15. windows环境下 ipfs的搭建与使用
  16. 纳米孔Nanopore-16S数据分析学习笔记
  17. android AMS
  18. laravel5.0学习系列1之 路由
  19. sublime3怎么设置中文很简单
  20. 双栈路由Linux,Linux模拟IPV6双栈路由器实现方案

热门文章

  1. windows 核心编程下的内存映射文件
  2. java实现梯度异步通知,BIO原理及代码实现
  3. c语言 如何调用void函数,在C中从main调用void*函数
  4. 电脑键盘灯怎么打开_电脑开机后黑屏键盘灯也不亮,教你一招搞定 建议收藏...
  5. android canvas_Android实现自定义阴影效果
  6. 恋舞ol服务器维护中,《恋舞OL》更新维护公告
  7. NGN学习笔记5——IMS技术
  8. HDU 2176:取(m堆)石子游戏(Nim博弈)
  9. DaRT启动光盘使用详解
  10. linux下淘宝安全控件问题