-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResize.py
35 lines (24 loc) · 924 Bytes
/
Resize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''
https://www.geeksforgeeks.org/image-resizing-using-opencv-python/?ref=lbp
cv2.INTER_AREA: This is used when we need to shrink an image.
cv2.INTER_CUBIC: This is slow but more efficient.
cv2.INTER_LINEAR: This is primarily used when zooming is required. This is the default interpolation technique in OpenCV.
'''
import cv2
import numpy as np
import matplotlib.pyplot as plt
image = cv2.imread( 'images/WestPoint.jpeg')
# image = cv2.imread( '.venv/images/demoImages/known/Bill Barr.jpg')
# Loading the image
half = cv2.resize(image, (0, 0), fx = 0.1, fy = 0.1)
bigger = cv2.resize(image, (1050, 1610))
stretch_near = cv2.resize(image, (780, 540),
interpolation = cv2.INTER_LINEAR)
Titles =["Original", "Half", "Bigger", "Interpolation Nearest"]
images =[image, half, bigger, stretch_near]
count = 4
for i in range(count):
plt.subplot(2, 2, i + 1)
plt.title(Titles[i])
plt.imshow(images[i])
plt.show()