Assignment 1.1: Image Transformation in Python
Images: https://drive.google.com/drive/folders/1yCfFEXnEinsWBNejbDgEsziCHdESol1D?usp=share_link Code: import numpy as np import matplotlib.pyplot as plt im = np.arange(256) im = im[np.newaxis,:] im = np.repeat(im,100,axis=0) plt.imshow(im,cmap='gray') Processing Grayscale images im = plt.imread(r'albert-einstein_gray.jpg') type(im) im.shape im.dtype plt.imshow(im,cmap='gray') im im[23,300] im2 = im.copy() im2[23,100] = 200 im2[23:100,40:100] = 255 plt.imshow(im2,cmap='gray') im2[300:400,40:100] = 0 plt.imshow(im2,cmap='gray') # Quiz Solution im = plt.imread(r'albert-einstein_gray.jpg') im3 = im.copy() im3[330:430,300:400] = 255 #for left eye im3[330:430,440:540] = 255 #for right eye plt.imshow(im3, cmap='gray') plt.imsave(r'albert-einstein_gray_modified.jpg',im2,cmap='gray') # pip install opencv-contrib-python Grayscale Images in OpenCV import cv2 img = cv2.imread(r'albert-einstein_gray.jpg',cv2.IMREAD...