图像处理之图像金字塔

• 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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值