There are two different kinds of smoothing types in the image. One is color image, and the other is grayscale image. It has been proved that both types can
#include <cv.h>
#include #include <cxcore.h>
int param1=1;
int param2=1;
Iplimage *img;
Iplimage *image;
Iplimage *DST;
void Switch_callback (int position)
{
int m_param1=param1*2+1;
int m_param2=param2*2+1; Mask size must be an odd number greater than or equal to 1
Cvsmooth (IMAGE,DST,CV_GAUSSIAN,M_PARAM1,M_PARAM2);
Cvsmooth (IMG,DST,CV_GAUSSIAN,M_PARAM1,M_PARAM2);
Cvshowimage ("Smooth Demo", DST);
}
void Main ()
{img=cvloadimage ("2.bmp", 1);
Image=cvcreateimage (Cvgetsize (IMG), ipl_depth_8u,1); Here is the conversion of grayscale images. Then Gaussian smoothing for grayscale images
Dst=cvcreateimage (Cvgetsize (IMG), ipl_depth_8u,1);
Cvcvtcolor (Img,image,cv_bgr2gray);
Dst=cvcreateimage (Cvgetsize (IMG), ipl_depth_8u,3); Gaussian smoothing of images directly for color images
Cvnamedwindow ("Smooth Demo", 1);
Cvcreatetrackbar ("Param1", "Smooth Demo", ¶m1,99,switch_callback);
Cvcreatetrackbar ("Param2", "Smooth Demo", ¶m2,99,switch_callback);
while (1)
{
if (Cvwaitkey (15) ==27)
Break
}
Cvreleaseimage (&IMG);
Cvreleaseimage (&image);
Cvreleaseimage (&DST);
Cvdestroywindow ("Smooth Demo");
}
Use of sliders in OpenCV