数字图像处理Python语言实现-图像增强-对数增强

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/wujuxKkoolerter/article/details/96507128

对数图像增强

对数图像增强的计算公式如下:
(11-1) s = c log ( r + 1 ) s = c \log(r + 1) \tag{11-1}

其中 c c 为常数

Python实现的代码如下:

def log_enhance(src):
   
    scale = float(np.iinfo(src.dtype).max - np.iinfo(src.dtype).min)
    dst = np.log2(src.astype(np.float32) / scale + 1) * scale
    dst = np.clip(dst,0,255).astype(np.uint8)
    return dst

程序运行结果:

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/wujuxKkoolerter/article/details/96507128