#include "stdafx.h"
#include <opencv2/opencv.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/core/core.hpp>
using namespace cv;
IplImage* doPyrDown(IplImage* in, int filter = CV_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);
return (out);
}


int _tmain(int argc, _TCHAR* argv[])
{
IplImage*  l =cvLoadImage("1.jpg");
cvNamedWindow("图像尺寸变换",CV_WINDOW_AUTOSIZE);
IplImage* g;
g=doPyrDown(l, CV_GAUSSIAN_5x5);
cvShowImage("图像尺寸变换", g);
cvWaitKey(0);
   cvReleaseImage(&l);
   cvDestroyWindow("图像尺寸变换");
return 0;

}


效果如下

Opencv图像尺寸变换






相关文章: