gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 21:09:38 26 4
gpt4 key购买 nike

我有一个图像,我正在对其进行均衡,然后使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com