#include <iostream>
#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

//均值滤波模糊处理
int demo_blur()
{
  char win1[] = "window1";
  char win2[] = "window2";
  Mat img1, img2;

  img1 = imread("D://images//4.jpg");
  if (img1.empty())
  {
    cout <<"could not found img..." << endl;
    return 0;
  }
  imshow(win1,img1);
  blur(img1,img2,Size(9,9),Point(-1,-1));
  imshow(win2, img2);
  return 0;
}

//高斯滤波
int demo_gaussian_blur()
{
  char win1[] = "window1";
  char win2[] = "window2";
  Mat img1, img2;

  img1 = imread("D://images//timg1.jpg");
  if (img1.empty())
  {
    cout << "could not found img..." << endl;
    return 0;
  }
  imshow(win1, img1);
  //blur(img1, img2, Size(9, 9), Point(-1, -1));
  GaussianBlur(img1, img2, Size(9, 9), 11, 11, 4);
  imshow(win2, img2);
  return 0;
}

//中值滤波
int demo_median_blur()
{
  char win1[] = "window1";
  char win2[] = "window2";
  Mat img1, img2;

  img1 = imread("D://images//2018092701.jpg");
  if (img1.empty())
  {
    cout << "could not found img..." << endl;
    return 0;
  }
  imshow(win1, img1);
  //blur(img1, img2, Size(9, 9), Point(-1, -1));
  //GaussianBlur(img1, img2, Size(9, 9), 11, 11, 4);
  medianBlur(img1, img2, 5);
  imshow(win2, img2);
  return 0;
}

//双边滤波
int demo_bilateral_filter()
{
  char win1[] = "window1";
  char win2[] = "window2";
  Mat img1, img2;

  img1 = imread("D://images//timg1.jpg");
  if (img1.empty())
  {
    cout << "could not found img..." << endl;
    return 0;
  }
  imshow(win1, img1);
  //blur(img1, img2, Size(9, 9), Point(-1, -1));
  //GaussianBlur(img1, img2, Size(9, 9), 11, 11, 4);
  //medianBlur(img1, img2, 5);
  bilateralFilter(img1, img2, 15, 100, 3, 4);
  imshow(win2, img2);
  return 0;
}

int main()
{
  //demo_blur();
  //demo_gaussian_blur();
  //demo_median_blur();
  demo_bilateral_filter();

  waitKey(0);
  return 0;
}

opencv3 图片模糊操作-均值滤波 高斯滤波 中值滤波 双边滤波的更多相关文章

  1. 【OpenCV】邻域滤波:方框、高斯、中值、双边滤波

    原文:http://blog.csdn.net/xiaowei_cqu/article/details/7785365 邻域滤波(卷积)   邻域算子值利用给定像素周围像素的值决定此像素的最终输出.如 ...

  2. [学习opencv]高斯、中值、均值、双边滤波

    http://www.cnblogs.com/tiandsp/archive/2013/04/20/3031862.html [学习opencv]高斯.中值.均值.双边滤波 四种经典滤波算法,在ope ...

  3. opencv-11-中值滤波及自适应中值滤波

    开始之前 在上一篇我们实现了读取噪声图像, 然后 进行三种形式的均值滤波得到结果, 由于我们自己写的均值滤波未作边缘处理, 所以效果有一定的下降, 但是总体来说, 我们得到的结果能够说明我们的算法执行 ...

  4. OpenCv高斯,中值,均值,双边滤波

    #include "cv.h" #include "highgui.h" #include <iostream> using namespace s ...

  5. OpenCV计算机视觉学习(4)——图像平滑处理(均值滤波,高斯滤波,中值滤波,双边滤波)

    如果需要处理的原图及代码,请移步小编的GitHub地址 传送门:请点击我 如果点击有误:https://github.com/LeBron-Jian/ComputerVisionPractice &q ...

  6. Python+OpenCV图像处理(七)—— 滤波与模糊操作

    过滤是信号和图像处理中基本的任务.其目的是根据应用环境的不同,选择性的提取图像中某些认为是重要的信息.过滤可以移除图像中的噪音.提取感兴趣的可视特征.允许图像重采样等等.频域分析将图像分成从低频到高频 ...

  7. Atitit   图像处理 平滑 也称 模糊, 归一化块滤波、高斯滤波、中值滤波、双边滤波)

    Atitit   图像处理 平滑 也称 模糊, 归一化块滤波.高斯滤波.中值滤波.双边滤波) 是一项简单且使用频率很高的图像处理方法 用途 去噪 去雾 各种线性滤波器对图像进行平滑处理,相关OpenC ...

  8. 学习 opencv---(8)非线性滤波:中值滤波,双边滤波

    正如我们上一篇文章中讲到的,线性滤波可以实现很多种不同的图像变换.然而非线性滤波,如中值滤波器和双边滤波器,有时可以达到更好的实现效果. 邻域算子的其他一些例子还有对 二值图像进行操作的形态学算子,用 ...

  9. python实现模糊操作

    目录: (一)模糊或平滑与滤波的介绍 (二)均值模糊 (1) 原理 (2)代码实现-----均值模糊函数blur() (三)中值模糊------mediaBlur函数 (四)高斯模糊------Gau ...

随机推荐

  1. libQt5Core.so: undefined reference to `dlclose@GLIBC_2.4'

    /******************************************************************************** * libQt5Core.so: u ...

  2. (六)js常见四大排序

    今天突然想回顾一下四大排序,虽然说在实战中没有用到,但是想回顾一下四大排序的思想   var arr = [23, 34, 11, 22, 19, 18];   1.冒泡排序: 冒泡排序的思路分析: ...

  3. linux 系统监控某目录下文件及文件夹的变化

    inotifywait 是一个可以实时监控文件变动的工具,它利用linux内核中的inotify机制实现监控功能. 查看内核版本 [root@Oracle ~]# uname -r 2.6.32-22 ...

  4. python学习之基本类型

    #我的第一个python程序 print("hello world"); #多行字符串 print("""\ Usage: thingy [OPTIO ...

  5. 调试VBA程序常用方法

    在中断模式下(ctrl+Break键),可以做: 1.执行    工具----选项----编辑器----勾选“自动显示数据提示” 则当用鼠标悬停在变量或表达式上时,会出现提示窗口,显示其名称和值! 2 ...

  6. gson在android中的应用

    首先需要建一个实体类 Person.java 来对应json 需要注意的是实体类中的变量名必须和json传过来的key值完全一样(大小写) public class Person { private ...

  7. sqlserver卸载

  8. Spring security 浅谈用户验证机制

    step1:首先ApplicationUserDetailsService需要实现UserDetailsService接口(在 org.springframework.security.core.us ...

  9. 【转】JMeter Tutorial的安装和具体操作

    1.下载Jmeter 下载地址:http://jmeter.apache.org/download_jmeter.cgi 目前最新版为2.9,其余文件如源代码等也可从如下官网下载: http://jm ...

  10. 杂项-操作系统-百科:Solaris

    ylbtech-杂项-操作系统-百科:Solaris Solaris (读作 /se'laris:/ 或者 /so'le:ris/)是Sun Microsystems研发的计算机操作系统.它被认为是U ...