How to find the inverse log contrast of an image in python

445 views Asked by At

I have tried the function math.exp(),but it is giving error

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

Here img is my input image.

1

There are 1 answers

3
kenfire On

Your error is :

OverflowError:Python int too large to convert to C long

You should look at those question:

In the last question there is a recommendation to use decimal module because your exp() function is returning a number with many decimals.

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