如何在python中找到图像的逆对数对比度

时间:2017-08-31 09:46:34

标签: python-2.7 math logarithm exp

我已经尝试了函数math.exp(),但是它给出了错误

NewImg[j,k]=a*math.exp(img[j,k])
OverflowError:Python int too large to convert to C long

此处img是我的输入图片。

1 个答案:

答案 0 :(得分:0)

您的错误是:

OverflowError:Python int too large to convert to C long

你应该看看这些问题:

在上一个问题中,建议使用decimal module因为exp()函数返回的小数位数很多。

from decimal import Decimal
NewImg[j,k]= Decimal(a*math.exp(img[j,k]))