Page 500 - AI Ver 3.0 class 10_Flipbook
P. 500

Ans.
                    [1]:   import cv2
                           from matplotlib import pyplot as plt
                           import numpy as np
                           img = cv2.imread('D:/Dog.jpg',0)
                           plt.imshow(img, cmap = 'gray')
                           plt.title('My Pet')
                           plt.axis('off')
                           plt.show

                           <function matplotlib.pyplot.show(close=None, block=None)>
                                                               My Pet























                26.  Using the library: import cv2, matplotlib
                    Upload your own picture in your favorite dress and put a black box on the face and the hands.

                    [1]:   import cv2
               Ans.        from matplotlib import pyplot as plt
                           import numpy as np
                           img = cv2.imread('D:/Picture of myself.jpg')
                           print(img.shape)
                           img[500:1600,2200:3500]=[0,0,0]
                           img[2800:3700,2300:3300]=[0,0,0]
                           plt.imshow (cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
                           plt.title('Shaded Face')
                           plt.axis ('off')
                           plt.show()

                           (3755, 5632, 3)
                                                             Shaded Face






















                    498     Touchpad Artificial Intelligence (Ver. 3.0)-X
   495   496   497   498   499   500   501   502   503   504   505