对含有大量噪声的图像进行阈值处理

问题描述 投票:0回答:1

我有一张带有血管的图像,其中带有很多不同的噪声。应用二进制阈值和 Otsu 阈值并不容易,因为这些简单的方法无法从灰色背景中提取血管。灰色背景不均匀。

有什么方法可以从图像中提取这些黑色血管吗? 我知道我们可以应用模糊(例如保留边缘的高斯模糊),但在这种情况下可能会发生船舶数据松散的情况。 对于图像质量感到抱歉,图像分辨率较小。

尝试过:使用不同内核的高斯模糊、二值/Otsu 阈值。 使用 Sobel 核提取边缘,但由于噪声,它发现了许多不同的“假”边缘。 即使用高斯模糊平滑图像。

image-processing filtering image-segmentation
1个回答
0
投票

应用强度阈值后,您的分割输出可能如下所示:

由于原始图像中存在噪声,输出中可以看到许多伪影。但值得注意的是,噪声占据的面积相对较小,因此可以利用面积阈值来 消除小尺寸的伪影。

这是供您使用的参考代码。

"""
Old_Seg: the binary segmentation output after applying intensity thresholding 
New_Seg: the binary segmentation output after using area thresholding 
th_area: the threshold of the area
height: image height
width: image width
""
contours, _ = cv2.findContours(np.uint8(Old_Seg), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
contours = [c for c in contours if cv2.contourArea(c) > 0]
output = np.zeros_like(np.uint8(Old_Seg))
cv2.drawContours(output, contours, -1, 255, -1)
New_Seg= np.zeros((height,width))
for j, contour in enumerate(contours):
    x,y,w,h = cv2.boundingRect(contour)
    area = cv2.contourArea(contour)
    if(area>th_area): // th_are
        New_Seg[y:y+h,x:x+w] = Old_Seg[y:y+h,x:x+w]
© www.soinside.com 2019 - 2024. All rights reserved.