Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-009

Brightness Adjustment

Problem

Adjust the brightness of a grayscale image by adding delta to every pixel.

Output values are clamped to [0, 255] and returned as integers. delta may be negative.

Test cases

case 1
in: [[[0,100],[200,255]],50]
expected: [[50,150],[250,255]]
case 2
in: [[[10,20]],-20]
expected: [[0,0]]
case 3
in: [[[100]],0]
expected: [[100]]
case 4
in: [[[250,5]],10]
expected: [[255,15]]
Starter codePython
def adjust_brightness(image, delta):
    # Your code here
    pass

4 test cases · run your code against them in the editor