Advertisement
brandblox

ImgLab-1-(18-9-24)

Sep 17th, 2024
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import numpy as np
  2. import cv2
  3.  
  4. # Load the image
  5. img = cv2.imread('peter.jpg',0)
  6.  
  7. # Display the original image
  8. cv2.imshow('Original image',img)
  9.  
  10. # Reduce the image size by 50%
  11. Reduced_img = cv2.resize(img,(0,0),fx=0.5,fy=0.5)
  12. cv2.imshow('Reduced image',Reduced_img)
  13.  
  14. # Upscale the image by 150%
  15. Upscaled_img = cv2.resize(img,(0,0),fx=1.5,fy=1.5)
  16. cv2.imshow('Upscaled image',Upscaled_img)
  17.  
  18. # Wait for the user to close the windows
  19. cv2.waitKey(0)
  20. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement