两幅图像的对比度调整

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

我有两张对比度不同的图片。我怎样才能让第二张图片有相同的对比度?有什么技术可以做到这一点吗?直方图匹配技术是否适用于这个目的?

image-processing itk medical simpleitk
1个回答
0
投票

使用SimpleITK 直方图匹配图像过滤器:

import SimpleITK as sitk

# read images
im_ref = sitk.ReadImage("/path/to/reference/image")
im_orig = sitk.ReadImage("/path/to/image/to/be/modified")

# apply histogram matching
histogram_match = sitk.HistogramMatchingImageFilter()
histogram_match.SetThresholdAtMeanIntensity(True)  # useful if a lot of background pixels
im_matched = histogram_match.Execute(im_orig, im_ref)

# write output
sitk.WriteImage(im_matched, "/path/for/output/image")
© www.soinside.com 2019 - 2024. All rights reserved.