OpenCV学习(五)之高斯平滑滤波

#include "highgui.h"
#include "cv.h"

using namespace cv;

//simple Gaussian smoothing process
int main(int argc,char** argv)
{
	IplImage* inImg = cvLoadImage("lena.bmp");
	cvNamedWindow("in_Lena",CV_WINDOW_AUTOSIZE);
	cvShowImage("in_Lena",inImg);
	//param1--the size of the current image
	//param2--the pixel data type for each channel
	//param3--the current image has 3 channels,each channel has 8bit
	IplImage * outImg = cvCreateImage(cvGetSize(inImg),IPL_DEPTH_8U,3);
	cvSmooth(inImg,outImg,CV_GAUSSIAN,3,3);
	cvNamedWindow("out_Lena",CV_WINDOW_AUTOSIZE);
	cvShowImage("out_Lena",outImg);
	cvReleaseImage(&outImg);
	cvWaitKey(0);
	cvDestroyWindow("in_Lena");
	cvDestroyWindow("out_Lena");
}
注意cvCreateImage函数的用法和cvSmooth函数的使用方法~

你可能感兴趣的:(OpenCV)