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

Copy the Image to a Drive

                 The image copy can be created on the drive by using imwrite() function.

                    [1]:  import cv2 # import OpenCV
                          from matplotlib import pyplot as plt # import matplotlib
                          import numpy as np # import numpy
                          img = cv2.imread('D:/Cat.jpg')
                          roi =img[55:265,215:400] #img[range of y, range of x
                          resized = cv2.resize(img, (200,400))
                          cv2.imwrite('D:/Only face.jpg',roi)

                          True

                 Take a look at your folder. You will see the above two image files created.



                               Task                                                           21 st  Century   #Technology Literacy
                                                                                                  Skills


                   1.  Open Jupyter Notebook and write the python code to perform the given tasks:

                      a.  Open a picture of your favourite fruit and display it.





                      b.  Crop the picture and save it with a new name on the computer.






                      c.  Copy a picture to a drive in your system.







                      d.  Copy a portion of the picture on the another picture.





                      e.  Shading a portion of an image.









                                                                                    Advance Python (Practical)  477
   474   475   476   477   478   479   480   481   482   483   484