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
import cv2
imgcv2.imread('octopus.prng.(0))
print(img shape)
Result: (1920, 1357)
d. Display the maximum and minimum pixels of
image
import cv2
imgev2.imread('octopus.png'.0)
print(img.min())
print(img.max())
result: 0
255