图像平滑,通过对图像数据与高斯核或者其他核函数进行卷积有效的减少图像的信息内容。
#include "highgui.h"
#include "cv.h"
void showchangeimage(IplImage *image)
{
cvNamedWindow("input-Image", CV_WINDOW_AUTOSIZE);
cvNamedWindow("output-Image", CV_WINDOW_AUTOSIZE);
cvShowImage("input-Image", image);
IplImage *out = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 3);
cvSmooth(image, out, CV_GAUSSIAN, 3, 3);
cvShowImage("output-Image", out);
cvReleaseImage(&out);
cvWaitKey(0);
cvDestroyAllWindows();
}
int main()
{
IplImage *image = cvLoadImage("opencvlogo.jpg");
showchangeimage(image);
cvReleaseImage(&image);
return 0;
}
下面是结果图: