### (Solved) : Wili Help Test Code Different Test Images Image1 Abcjpg Image2 Defjpg Import Matplotlibpyp Q35538544 Image Processing/Python/Data Science   # This wili help test the code with different test images image1-‘abc.jpg image2 “def.jpg import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np Part 2- Transforming images (15 points) In this part, we will use linear combinations of two images to transform one image to another. Given two images A and B, define a linear combination of the images as : p.A + (1-p).B where p is a value (think of p as a probability between 0 and 1, For example, if p = 0, then we only show image B, and if p=1, then we only show image A. For all other values of p, the two images are transposed on each other. When p is closer to 0, you will mostly notice image B, and if p is closer to 1, you will mostly notice image A. When p is in the middle, the intensity of the pixles will be equally divided between the two images. In this case, define the matrix p A as, each entry of A is multiplied (or scaled by) p Task 2.1 First we will learn how to scale an image by some value p that is between 0 and 1. Write the code to form the matrix p.A for any p, and plot the image. Start with p-0.5 and change it to see how the intensity of the image changes ## BEGIN SOLUTION import numpy as np p-0.6 Show transcribed image text # This wili help test the code with different test images image1-‘abc.jpg image2 “def.jpg
import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np
Part 2- Transforming images (15 points) In this part, we will use linear combinations of two images to transform one image to another. Given two images A and B, define a linear combination of the images as : p.A + (1-p).B where p is a value (think of p as a probability between 0 and 1, For example, if p = 0, then we only show image B, and if p=1, then we only show image A. For all other values of p, the two images are transposed on each other. When p is closer to 0, you will mostly notice image B, and if p is closer to 1, you will mostly notice image A. When p is in the middle, the intensity of the pixles will be equally divided between the two images. In this case, define the matrix p A as, each entry of A is multiplied (or scaled by) p Task 2.1 First we will learn how to scale an image by some value p that is between 0 and 1. Write the code to form the matrix p.A for any p, and plot the image. Start with p-0.5 and change it to see how the intensity of the image changes ## BEGIN SOLUTION import numpy as np p-0.6