Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
a.
Load Image and Give the title of image
#import required module cv2, matplotlib and numpy
import cv2 import matplotlib.pyplot as plt import numpy as np #Load the image file into memory img = cv2.imread('octopus.prng) #Display Image plt.imshow(img) plt.title('Octopus’) plt.axis('off') plt.show() b. Change the colour of image and change the image to grayscale
#import required module cv2, matplotlib and numpy
import cv2 import matplotlib.pyplot as plt #Load the image file into memory 174% imgev2.imread('octopus.png) #Chaning image colour image colour plt.imshow(cv2.cvtColor(img, cv2.COLOR BGR2RGB)) plt.title(Octopus) pltaxis('off') plt.show() c. Print the shape of the image