Question: A picture or image can be represented as a Numpy array of pixels, with dimensions H * W * C, where H is the height



A picture or image can be represented as a Numpy array of pixels, with dimensions H * W * C, where H is the height of the image, W is the width of the image, and C is the number of colour channels. Typically we will use an image with channels that give the the Red, Green, and Blue "level" of each pixel, which is referred to with the short form RGB. You will write Python code to load an image, and perform several array manipulations to the image and visualize their effects. [10] import matplotlib.pyplot as plt Part (c) -- 2pt Modify the image by adding a constant value of 0.25 to each pixel in the img and store the result in the variable img_add. Note that, since the range for the pixels needs to be between [0, 1], you will also need to clip img_add to be in the range [0, 1] using numpy.clip. Clipping sets any value that is outside of the desired range to the closest endpoint. Display the image using plt.imshow. Part (d) -- 2pt Crop the original image ( img variable) to a 130 x 150 image including Mochi's face. Discard the alpha colour channel (i.e. resulting img_cropped should only have RGB channels) Display the image
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
