Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3.  
  4. # load our input image
  5. image = cv2.imread('images/input.jpg')
  6.  
  7. # Let's make our image 3/4 of it's original size
  8. image_scaled = cv2.resize(image, None, fx=0.75, fy=0.75)
  9. cv2.imshow('Scaling - Linear Interpolation', image_scaled)
  10. cv2.waitKey()
  11.  
  12. # Let's double the size of our image
  13. img_scaled = cv2.resize(image, None, fx=2, fy=2, interpolation = cv2.INTER_CUBIC)
  14. cv2.imshow('Scaling - Cubic Interpolation', img_scaled)
  15. cv2.waitKey()
  16.  
  17. # Let's skew the re-sizing by setting exact dimensions
  18. img_scaled = cv2.resize(image, (900, 400), interpolation = cv2.INTER_AREA)
  19. cv2.imshow('Scaling - Skewed Size', img_scaled)
  20. cv2.waitKey()
  21.  
  22. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement