使用cvPyrDown()创建一幅宽度和高度均为输入图像一半尺寸的图像
void doPyrDown(void) { IplImage *in=cvLoadImage("lena.jpg"); int filter = IPL_GAUSSIAN_5x5; assert(in->width%2 == 0 && in->height%2 == 0); IplImage *out=cvCreateImage(cvSize(in->width/2, in->height/2), in->depth, in->nChannels); cvPyrDown(in, out); cvNamedWindow("in"); cvNamedWindow("out"); cvShowImage("in", in); cvShowImage("out", out); cvWaitKey(0); cvReleaseImage(&in); cvReleaseImage(&out); cvDestroyAllWindows(); }
########################################################
将现有的图像在每个维度上放大两倍
cvPyrUP(
IplImage *src,
IplImage *dst,
IplFilter filter=CV_GAUSSIAN_5x5
);
void imagePyrUp(void) { IplImage *src=cvLoadImage("lena.jpg"); IplImage *dst=cvCreateImage(cvSize(src->width*2, src->height*2), src->depth, src->nChannels); cvPyrUp(src, dst); cvNamedWindow("src"); cvNamedWindow("dst"); cvShowImage("src", src); cvShowImage("dst", dst); cvWaitKey(0); cvReleaseImage(&src); cvReleaseImage(&dst); cvDestroyAllWindows(); }