#include "cv.h"
#include "opencv/highgui.h"
int main(){
IplImage *img= cvLoadImage("C:\\lena.jpg");//读取图片
cvNamedWindow("Example1",CV_WINDOW_AUTOSIZE);
cvNamedWindow("Example2",CV_WINDOW_AUTOSIZE);
cvNamedWindow("Example3",CV_WINDOW_AUTOSIZE);
cvNamedWindow("Example4",CV_WINDOW_AUTOSIZE);
cvNamedWindow("Example5",CV_WINDOW_AUTOSIZE);
cvNamedWindow("Example6",CV_WINDOW_AUTOSIZE);
cvShowImage("Example1",img);//在Example1显示图片
// cvCopy(img,temp);
IplImage* temp=cvCreateImage( //创建一个size为image,三通道8位的彩色图
cvGetSize(img),
IPL_DEPTH_8U,3
);
cvSmooth(img,temp,CV_BLUR,3,3);//简单模糊
cvShowImage("Example2",temp);
cvSmooth(img,temp,CV_BLUR_NO_SCALE,3,3);//简单无缩放变化的模糊
cvShowImage("Example3",temp);
cvSmooth(img,temp,CV_MEDIAN,3,3);//中值模糊
cvShowImage("Example4",temp);
cvSmooth(img,temp,CV_GAUSSIAN,3,3);//高斯模糊
cvShowImage("Example5",temp);
cvSmooth(img,temp,CV_BILATERAL,1,150,240,480);//双边滤波
cvShowImage("Example6",temp);
cvWaitKey(0);//暂停用于显示图片
cvReleaseImage(&img);//释放img所指向的内存空间并且
cvDestroyWindow("Example1");
cvDestroyWindow("Example2");
cvDestroyWindow("Example3");
cvDestroyWindow("Example4");
cvDestroyWindow("Example5");
cvDestroyWindow("Example6");
return 0;
}