如何在OpenCV中实现去除斑点? [英] How to implement despeckle in OpenCV?

查看:609
本文介绍了如何在OpenCV中实现去除斑点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在对比度较差的图像上进行直方图均衡,则其特征会变得更加明显。然而,还有大量的谷物/斑点/噪音。使用OpenCV中已有的模糊功能是不可取的 - 我将在稍后对图像进行文本检测,字母将变得无法识别。
那么应该应用哪些预处理技术?

If histogram equalization is done on a poorly-contrasted image then its features become more visible. However there is also a large amount of grains/speckles/noise. using blurring functions already available in OpenCV is not desirable - i'll be doing text-detection on the image later on and the letters will get unrecognizable. So what are the preprocessing techniques that should be applied?

推荐答案

将图像与内核进行卷积的标准模糊技术(例如,高斯模糊,盒式滤波器等)充当低通滤波器并扭曲高频文本。如果您还没有这样做,请尝试 cv :: bilateralFilter() cv :: medianBlur()。如果这些算法都不起作用,您应该研究其他边缘保留平滑算法

Standard blur techniques that convolve the image with a kernel (e.g. Gaussian blur, box filter, etc) act as a low-pass filter and distort the high-frequency text. If you have not done so already, try cv::bilateralFilter() or cv::medianBlur(). If neither of these algorithms work, you should look into other edge-preserving smoothing algorithms.

如果您想象图像是三维的空间,传统滤波用以像素为中心的圆中的所有滤波器的加权平均值替换每个像素的值。双边滤波也是如此,但使用以像素为中心的三维球体。由于明确定义的边缘看起来像一个平台,因此球体仅包含一个点,并且像素值保持不变。您可以获得有关双边滤波器和一些示例输出的更详细说明这里

If you imagine the image as a three-dimensional space, traditional filtering replaces the value of each pixel with the weighted average of all filters in a circle centered around the pixel. Bilateral filtering does the same, but uses a three-dimensional sphere centered at the pixel. Since a well-defined edge looks like a plateau, the sphere contains only one point and the pixel value remains unchanged. You can get a more detailed explanation of the bilateral filter and some sample output here.

这篇关于如何在OpenCV中实现去除斑点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆