All problems
Gamma Auto from Mean
Problem
Choose the gamma correction that maps the image mean intensity to 0.5.
Compute gamma = log(0.5) / log(mean / 255) and round to 4 decimal places. Return 1.0 when the mean is 0 or 255.
Hint
Divide the mean by 255 before taking logarithms.
Test cases
case 1
in: [[[128,128],[128,128]]]
expected: 1.0057
case 2
in: [[[64,64],[64,64]]]
expected: 0.5014
case 3
in: [[[192,192],[192,192]]]
expected: 2.4427
case 4
in: [[[0,0]]]
expected: 1
Starter codePython
def auto_gamma(image):
# Your code here
pass4 test cases · run your code against them in the editor