python数字图像处理(8):对比度与亮度调整

图像亮度与对比度的调整,是放在skimage包的exposure模块里面

1、gamma调整

原理:I=Ig

对原图像的像素,进行幂运算,得到新的像素值。公式中的g就是gamma值。

如果gamma>1, 新图像比原图像暗

如果gamma<1,新图像比原图像亮

函数格式为:skimage.exposure.adjust_gamma(imagegamma=1)

gamma参数默认为1,原像不发生变化 。

from skimage import data, exposure, img_as_float
import matplotlib.pyplot as plt
image = img_as_float(data.moon())
gam1= exposure.adjust_gamma(image, 2)   #调暗
gam2= exposure.adjust_gamma(image, 0.5)  #调亮
plt.figure('adjust_gamma',figsize=(8,8))

plt.subplot(131)
plt.title('origin image')
plt.imshow(image,plt.cm.gray)
plt.axis('off')

plt.subplot(132)
plt.title('
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值