def q3(): img1 = Image.open("img1.bmp") img2 = Image.open("img2.bmp") gray1 = qtl.rgb2gray(np.array(img1)) gray2 = qtl.rgb2gray(np.array(img2)) modded = qtl.square2Image(gray1, gray2, 100) Image.fromarray(modded).show()
def q2(): print "Part A:" img = Image.open("img1.bmp") print "Part B:" original = np.array(img) mod = np.copy(original) red = original[:,:,0] green = original[:,:,1] blue = original[:,:,2] mod[:,:,2] = red mod[:,:,0] = blue Image.fromarray(mod).show() raw_input() print "Part C:" Image.fromarray(green).show() raw_input() print "Part D:" Image.fromarray(red).show() raw_input() print "Part E:" Image.fromarray(qtl.rgb2gray(original)).show()