Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-164

Seeded Color Jitter

Problem

Apply brightness jitter to a grayscale image with a seeded RNG.

Seed the random module, draw factor = 1 - brightness + 2 * brightness * random.random(), then multiply each pixel by factor, rounding and clamping to [0, 255].

Test cases

case 1
in: [[[100,200],[0,50]],0.2,1]
expected: [[85,171],[0,43]]
case 2
in: [[[100,200],[0,50]],0.5,42]
expected: [[114,228],[0,57]]
case 3
in: [[[100,200],[0,50]],0,3]
expected: [[100,200],[0,50]]
Starter codePython
def color_jitter(image, brightness, seed):
    # Your code here
    pass

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