【发布时间】:2020-01-29 14:31:05
【问题描述】:
在这个SO answer 上建议我这个代码:
import SimpleITK as sitk
import numpy as np
# Create a noise Gaussian blob test image
img = sitk.GaussianSource(sitk.sitkFloat32, size=[240,240,48], mean=[120,120,24])
img = img + sitk.AdditiveGaussianNoise(img,10)
# Create a ramp image of the same size
h = np.arange(0.0, 255,1.0666666666, dtype='f4')
h2 = np.reshape(np.repeat(h, 240*48), (48,240,240))
himg = sitk.GetImageFromArray(h2)
print(himg.GetSize())
# Match the histogram of the Gaussian image with the ramp
result=sitk.HistogramMatching(img, himg)
# Display the 3d image
import itkwidgets
itkwidgets.view(result)
为什么我需要两张图像来做直方图均衡化?
因为我想做直方图均衡,这就是直方图匹配。在此article 中解释不同之处。
【问题讨论】:
-
我的同事指出他在下面的笔记本中为SimpleITK写了一个直方图均衡(搜索'histogram_equalization'函数):github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/…