当前位置:网站首页>OpenCV 6.4 中值滤波器的使用
OpenCV 6.4 中值滤波器的使用
2022-07-02 06:28:00 【Villanelle#】
非线性滤波器
前几节介绍的均值滤波器、高斯滤波器均为线性滤波器,即用邻域像素的加权累加值替换像素值。
本节主要介绍非线性滤波器,其没有内核,且不能进行卷积运算,但也是通过识别邻域像素值来确定输出的像素值的。
常用的非线性滤波器有中值滤波器,中值滤波器把当前像素和其邻域组成集合,计算集合的中间值作为当前像素值,它在消除椒盐噪声方面非常有效。
cv::Mat image = cv::imread("salted.bmp");
cv::Mat median;
cv::medianBlur(image, median, 5);
cv::imshow("image", image);
cv::imshow("median blur", median);



可以很明显的看出,中值滤波器在消除噪声方面非常高效,可以很好的识别异常的黑色或白色像素进而将其替换,而均值滤波器会很大程度上受到噪声影响。
此外中值滤波器有利于保留边缘的尖锐度,但会洗去均质区域中的纹理,会有良好的视觉效果,类似水墨风格。
cv::medianBlur函数的使用
函数签名
CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize );
- 参数分别为:输入图像,输出图像,滤波器尺寸。
- 可以通过修改不同的滤波器尺寸实现不同的效果。下图是将滤波器尺寸改为9时的效果。

边栏推荐
- Real world anti sample attack against semantic segmentation
- [learning notes] matlab self compiled Gaussian smoother +sobel operator derivation
- MySQL优化
- I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
- 包图画法注意规范
- What if the laptop task manager is gray and unavailable
- Media query usage
- 【MnasNet】《MnasNet:Platform-Aware Neural Architecture Search for Mobile》
- C # connect to MySQL database
- 【FastDepth】《FastDepth:Fast Monocular Depth Estimation on Embedded Systems》
猜你喜欢

Array and string processing, common status codes, differences between PHP and JS (JS)

【Batch】learning notes

Replace self attention with MLP

Mmdetection trains its own data set -- export coco format of cvat annotation file and related operations

open3d学习笔记三【采样与体素化】

【DIoU】《Distance-IoU Loss:Faster and Better Learning for Bounding Box Regression》

What if the laptop can't search the wireless network signal

How to wrap qstring strings

【DIoU】《Distance-IoU Loss:Faster and Better Learning for Bounding Box Regression》

【MobileNet V3】《Searching for MobileNetV3》
随机推荐
针对语义分割的真实世界的对抗样本攻击
【MagNet】《Progressive Semantic Segmentation》
Graph Pooling 简析
Embedding malware into neural networks
Open3d learning note 4 [surface reconstruction]
【双目视觉】双目立体匹配
[CVPR‘22 Oral2] TAN: Temporal Alignment Networks for Long-term Video
Eklavya -- infer the parameters of functions in binary files using neural network
jetson nano安装tensorflow踩坑记录(scipy1.4.1)
【TCDCN】《Facial landmark detection by deep multi-task learning》
open3d学习笔记二【文件读写】
【Cascade FPD】《Deep Convolutional Network Cascade for Facial Point Detection》
【Wing Loss】《Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks》
What if the laptop task manager is gray and unavailable
On the back door of deep learning model
Prompt 范式简述
[learning notes] matlab self compiled Gaussian smoother +sobel operator derivation
Handwritten call, apply, bind
open3d学习笔记四【表面重建】
w10升级至W11系统,黑屏但鼠标与桌面快捷方式能用,如何解决