Advertisement
brandblox

ImgLab-3-(18-9-24)

Sep 18th, 2024
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import numpy as np
  2. import cv2
  3.  
  4. img = cv2.imread('peter.jpg',0)
  5. cv2.imshow('Original image',img)
  6.  
  7. new_img1 = cv2.resize(img, None, fx=0.2, fy=0.2, interpolation=cv2.INTER_NEAREST)
  8. new_img2 = cv2.resize(img, None, fx=0.2, fy=0.2, interpolation=cv2.INTER_LINEAR)
  9. new_img3 = cv2.resize(img, None, fx=0.2, fy=0.2, interpolation=cv2.INTER_CUBIC)
  10. new_img4 = cv2.resize(img, None, fx=0.2, fy=0.2, interpolation=cv2.INTER_LANCZOS4)
  11.  
  12. cv2.imshow('New image 1', new_img1)
  13. cv2.imshow('New image 2', new_img2)
  14. cv2.imshow('New image 3', new_img3)
  15. cv2.imshow('New image 4', new_img4)
  16.  
  17. cv2.waitKey(0)
  18. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement