C# combined with OpenCV (7) filtering

Filter:

mean filter

Get the mean value in the constructed filter kernel and fill it into the middle area.

Using sliding window technology.

For example, in a 3*3 filter kernel, calculate the sum of 9 values ​​and then divide by 9 to obtain the mean.

Cv2.Blur(Src_Images, dstimage, new Size(3, 3));

 

median filter

Get the median value of all numbers in the filter kernel, which is a nonlinear calculation

 

Cv2.MedianBlur(Src_Images, dstimage, 3);

 

 

Gaussian filter

Each pixel is obtained by a weighted average of its own pixel value and that of the pixels in its neighborhood. The weighting coefficient is larger closer to the center and smaller further away from the center. In this way, the proportion of adjacent pixels can be increased, which can effectively filter out noise.

Get the intermediate value through calculation and bring it into Gaussian formula

Cv2.GaussianBlur(Src_Images, dstimage, new Size(3, 3), 1);

 

 

There are some other filtering algorithms

            //快速图像边缘滤波算法
            Cv2.EdgePreservingFilter(src1, dd, EdgePreservingMethods.RecursFilter, 60, 0.44f);
            //高斯双边模糊 去除噪音的同时保持边缘的清晰锐利
            Cv2.BilateralFilter(src1, dd, 0, 100, 10, BorderTypes.Reflect101);
            //边缘保留滤波算法  均值迁移模糊
            Cv2.PyrMeanShiftFiltering(src1, dd, 15, 50);

 

 //快速图像边缘滤波算法
            Cv2.EdgePreservingFilter(src1, dd, EdgePreservingMethods.RecursFilter, 60, 0.44f);

 

  //高斯双边模糊 去除噪音的同时保持边缘的清晰锐利
            Cv2.BilateralFilter(src1, dd, 0, 100, 10, BorderTypes.Reflect101);

 

  //边缘保留滤波算法  均值迁移模糊
            Cv2.PyrMeanShiftFiltering(src1, dd, 15, 50);

 

Guess you like

Origin blog.csdn.net/weixin_43852823/article/details/127746733