A colour photo is a grid of pixels, each three numbers from 0 to 255: how much red, green and blue light it caught. Under an orange street lamp everything comes out orange: your eyes adjust and still see white snow, the camera doesn’t. Write fix(photo): take the light’s colour out of the photo and keep it as bright as it was. You aren’t told what the light was: all you have is the photo.
A snowman at night, as your eyes see it and as the camera sees it under an orange street lamp. The lamp changes each colour by its own amount, so taking the same orange off every pixel turns black blue. The goal is the photo it ends on. Your fix(photo) gets only the camera’s photo.
fix(photo)| photo | the camera's photo, a numpy array of shape (13, 16, 3): each pixel's red, green and blue, from 0 to 255 photo[y, x] is one pixel, photo[:, :, 0] all the reds | e.g. [[[90, 76, 52], [90, 76, 52], [90, 76, 52]… |
| returns | the photo with the light's colour taken out, as bright as it was, the same shape | |