Last active
March 15, 2019 05:55
-
-
Save ChongyeWang/a4dff04578d5a99d911ad38518cf6704 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
# load our input image | |
image = cv2.imread('images/input.jpg') | |
# Let's make our image 3/4 of it's original size | |
image_scaled = cv2.resize(image, None, fx=0.75, fy=0.75) | |
cv2.imshow('Scaling - Linear Interpolation', image_scaled) | |
cv2.waitKey() | |
# Let's double the size of our image | |
img_scaled = cv2.resize(image, None, fx=2, fy=2, interpolation = cv2.INTER_CUBIC) | |
cv2.imshow('Scaling - Cubic Interpolation', img_scaled) | |
cv2.waitKey() | |
# Let's skew the re-sizing by setting exact dimensions | |
img_scaled = cv2.resize(image, (900, 400), interpolation = cv2.INTER_AREA) | |
cv2.imshow('Scaling - Skewed Size', img_scaled) | |
cv2.waitKey() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment