Smotthing Images

Smoothing Image effectively reduces the information content of the image by convolving it with a Gaussian or other similar kernel function. OpenCV makes such convolutions exceptionally easy to do. We use cvSmooth function which has the following form :

Function parameters

void cvSmooth(const CvArr* src, CvArr* dst, int smoothtype=CV GAUSSIAN, int param1=3, int param2=0, double param3=0, double param4=0);

Program

#include "cv.h" 
#include "highgui.h" 
int main()
{
	IplImage* newImg;
	newImg = cvLoadImage("Desert1.jpg",1);
	IplImage* out = cvCreateImage(cvGetSize(newImg),IPL_DEPTH_8U,3);

	// Smoothing image
	cvSmooth( newImg, out, CV_GAUSSIAN, 3, 3 );

	// creating windows
	cvNamedWindow("Smooth", 1);
	cvNamedWindow("real", 1);

	// displaying windows
	cvShowImage("Smooth", out);
	cvShowImage("real", newImg);

	cvWaitKey(0);

	//destroying windows
	cvDestroyWindow("Smooth");
	cvDestroyWindow("real");

	//release the memory for the image
	cvReleaseImage( &out ); 
	cvReleaseImage( &newImg );

	return 0;
}

Output

Untitled