Page 501 - AI Ver 3.0 class 10_Flipbook
P. 501
27. Using the library: import cv2, matplotlib
Upload an image of a banana tree and change the color of the tree in the image and save it in your drive.
Ans. [1]: import cv2
from matplotlib import pyplot as plt
import numpy as np
img = cv2.imread('D:/Banana Tree.jpg',0)
plt.imshow(img, cmap = ‘gray’)
plt.title('Banana Tree')
plt.axis('off')
plt.show
cv2.imwrite('E:\Banana tree after color change.jpg',img)
Banana Tree
Python Practical Questions 499

