I need to build code for this question.
First we need to understand what the vignette looks like in isolation, without the clutter of a beautiful scene. For this, a picture of a flat surface of a single colour that is evenly lit (such as a white wall or plain blue sky during mid-day) is obtained and used as a “vignette profile”. You are given the following vignette profile image.
In this image, the pixels towards the center of the image have higher RGB values (i.e. brighter pixels) than the pixels that are away from the center. The image is also black and white, so red, green and blue values of any given pixel are the same. You must not modify this image.
We need to use the vignette profile image from step #1 as a filter for our normal photos captured by our camera so that the vignette can be removed. For this you need to divide the photo image (with vignette) by the vignette profile image. As the pixels in the vignette image have RGB values that are smaller (darker) towards its edges, dividing the original image's corresponding pixels by a small number will make them brighter
These are the hints
Hint 1: This requires you to perform your operations on your images, pixel by pixel. I.e. you cannot do it in a single step.
Hint 2: The first challenge for you will be keeping the RGB values resulting from the division within the 0-255 range for each channel, as valid RGB values are between 0 (darkest) and 255 (brightest).
Edit:
Sample code:
def runA1(picture): myFile = pickAFile() picture = makePicture(myFile)
myFile2 = pickAFile()
picture2 = makePicture(myFile2)
for x in range(0,getWidth(picture)):
for y in range(0,getHeight(picture)):
px = getPixel(picture,x,y)
color = getColor(px)
color = makeLighter(color)
setColor(px,color)
for x in range(2,getWidth(picture)):
for y in range(2,getHeight(picture)):
px = getPixel(picture,x,y)
color = getColor(px)
color = makeDarker(color)
setColor(px,color)
show(picture2)