图像处理之图像金字塔

来源:互联网 发布:远程网络连接器 编辑:程序博客网 时间:2024/06/04 23:22
• Usually we need to convert an image to a size different than its original. For this, there are two possible options:
1. Upsize the image (zoom in) or
2. Downsize it (zoom out).
• Although there is a geometric transformation function in OpenCV that -literally- resize an image (resize, which we will show in a future tutorial), in this section we analyze first the use of Image Pyramids, which are widely 
applied in a huge range of vision applications.

摘自Opencv文档

• 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)

这里仅介绍高斯金字塔:




#include "cv.h"#include "highgui.h"using namespace std;using namespace cv;int main(int argc,char *argv[]){Mat src,temp,dst;src=imread("src.jpg");temp=src;dst=temp;while(1){char c=(char)waitKey(0);if (c==27) break;else if (c=='u') pyrUp(temp,dst,Size(temp.cols*2,temp.rows*2));else if (c=='d') pyrDown(temp,dst,Size(temp.cols/2,temp.rows/2));imshow("dst",dst);temp=dst;}return 0;}

0 0
原创粉丝点击