In opencv2, Blur may be used to smooth the image. This method is the simplest way to calculate the mean.
SmoothAlso knownFuzzyIs a simple and frequently used image processing method.
Smooth Processing has many functions, but in many places we only focus on its noise reduction function.
OneFilter. The most common filter isLinearFilter.
void blur( const Mat& src, Mat& dst,Size ksize, Point anchor=Point(-1,-1),int borderType=BORDER_DEFAULT );
Parameters:
SRC: original image.
DST: target image.
Ksize: defines the size of the filter. Such as size (3, 3 ).
Anchor: Specifies the anchor position (smoothing point). If it is a negative value, the center of the core is the anchor. Omitted
Bordertype: used to infer edge pixels. Generally, the default value is border_default. Omitted
Example:
blur(src,dst,Size(3,3));
The opencv2 function gaussianblur performs Gaussian smoothing. Gaussian filtering is used to combine each pixel of the input arrayGaussian KernelConvolution: convolution and is used as the output pixel value.
void GaussianBlur( const Mat& src, Mat& dst, Size ksize,double sigmaX, double sigmaY=0,int borderType=BORDER_DEFAULT );
Parameters:
Sigmax: standard variance in the X direction. It can be set to 0 for Automatic Calculation by the system.
Sigmay: standard variance in the Y direction. It can be set to 0 for Automatic Calculation by the system.
Example:
GaussianBlur(src,dst,Size(9,9),0,0);
The opencv2 function medianblur performs the medianblur filtering operation. The medicv2 function filters the pixels of each pixel in the image using the neighborhood (the square area centered on the current pixel ).Median.
void medianBlur( const Mat& src, Mat& dst, int ksize );
The opencv2 function bilateralfilter performs bilateral filtering. Similar to Gaussian filter, a bilateral filter also assigns a weighting factor to each neighboring pixel. These weighting coefficients consist of two parts. The first part of the weighting method is the same as Gaussian filtering, and the second part of the weight is determined by the gray difference between the neighboring pixel and the current pixel.
void bilateralFilter( const Mat& src, Mat& dst, int d,double sigmaColor, double sigmaSpace,int borderType=BORDER_DEFAULT );
Parameters:
D: the diameter of the pixel's neighborhood.
Sigmacolor: standard variance of the color space.
Sigmaspace: standard variance (pixel unit) of the coordinate space ).
Example:
bilateralFilter ( src, dst, i, i*2, i/2 );
......