10. Smoothing.cpp 图像平滑处理
演示不同滤波器的效果。这些滤波器包括均值滤波、高斯滤波、中值滤波和双边滤波。每个滤波器都会在原始图像上应用,并显示滤波后的效果。
/**
* 文件 Smoothing.cpp
* 简单滤镜的样例代码
* 作者 OpenCV团队
*/
//引入所需库文件
#include <iostream>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
using namespace std;
using namespace cv;
//定义一些全局变量
int DELAY_CAPTION = 1500; //延迟时间
int DELAY_BLUR = 100; //模糊延迟时间
int MAX_KERNEL_LENGTH = 31; //最大滤镜核心大小
Mat src; Mat dst; // 定义两个Mat变量,src存储原始图像