Opencv的线性滤波和非线性滤波

线性滤波 :方框滤波   均值滤波  高斯滤波

非线性滤波: 中值滤波  双边滤波

这几个滤波都是起模糊作用 去除噪点

不废话了 下面是代码

 1 #include <opencv2/opencv.hpp>
 2 #include<iostream>
 3 #include<string>
 4 using namespace cv;
 5 using namespace std;    
 6 
 7 int main()
 8 {
 9     Mat picture;  //Original picture from cammmera
10     Mat img;     //The  picture which has been done
11     VideoCapture capture(0);
12     while (1)
13     {
14         capture >> picture;
15 //        boxFilter(picture, img, -1, Size(15, 14));         //方框滤波(线性)
16 //      blur(picture, img, Size(25, 25));                   //均值滤波(线性)
17 //        GaussianBlur(picture, img, Size(9, 9),0,0);           // 高斯滤波0,0代表标准偏差(线性)
18 //        medianBlur(picture, img, 7);                       //中指滤波  数字为孔径的线性尺寸 奇数 3 7 5 9 .......
19         bilateralFilter(picture, img, 25, 25 * 2, 25);     // 双边滤波 每个像素领域的直径  颜色空间sigma值越大表示越宽广的颜色混合到一起 产生较大的半相等颜色区域
20                                                            //坐标空间的sigma值数值越大意味着越远的像素会相互影响
21 
22         imshow("Original Picture", picture);
23         imshow("Dealed picture", img);
24         waitKey(10);
25     }
26     return 0;
27 }

关于滤波今天就这么多了

Waiing longer..........

猜你喜欢

转载自www.cnblogs.com/Loving-Q/p/11919570.html