python - 如何从直方图均衡图像中去除噪声?

标签 python image opencv image-processing

我有一个图像,我正在对其进行均衡,然后使用 clahe 直方图,如下所示:

self.equ = cv2.equalizeHist(self.result_array)
clahe = cv2.createCLAHE(clipLimit=100.0, tileGridSize=(8,8))
self.cl1 = clahe.apply(self.equ)

这是我得到的结果:

enter image description here

我想去掉所有的黑点,这是噪音。最终,我试图提取出上图中黑色的血管,在尝试这样做时,噪声使提取不准确。

最佳答案

我论文的很大一部分是关于减少图像中的噪声,我使用了一种技术来减少图像中的噪声,同时保留图像中信息的锐利边缘。我在这里引用自己的话:

An effective technique for removing noise from fringe patterns is to filter the image using sine-cosine filtering [reference]. A low-pass filter is convolved with the two images that result from taking the sine and cosine of the fringe pattern image, which are then divided to obtain the tangent, restoring the phase pattern but with reduced noise. The advantage of this technique is that the process can be repeated multiple times to reduce noise while maintaining the sharp details of the phase transitions.

这是我使用的代码:

import numpy as np
from scipy import ndimage

def scfilter(image, iterations, kernel):
    """
    Sine‐cosine filter.
    kernel can be tuple or single value.
    Returns filtered image.
    """
    for n in range(iterations):
        image = np.arctan2(
        ndimage.filters.uniform_filter(np.sin(image), size=kernel),
        ndimage.filters.uniform_filter(np.cos(image), size=kernel))
    return image

那里,image 是一个表示图像的 numpy 数组,线性重新缩放以将黑色置于 0 处,将白色置于 2 * pi 处,并且kernel 是应用于数据的统一过滤器的图像像素大小。不需要太多的迭代就能看到积极的结果,可能在 5 到 20 次之间。

希望对您有所帮助:)

关于python - 如何从直方图均衡图像中去除噪声?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36691020/

相关文章:

python - 将列表的输出格式化为列

python - 如何将图像保存为变量?

javascript - 图像的随机位置

javascript - 如何使用 javascript 将图像从 PNG 转换为 JPEG?

jquery - 淡入淡出图像加载但不用于缓存

Python 自引用 for 循环

python - Django正则表达式匹配长url

opencv - 你如何从图像中剪出一张脸?

python - 下载适用于 Pycharm 的 OpenCV

ios - 拟合一条线 - MatLab 不同意 OpenCV