-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2_rescale.py
More file actions
35 lines (26 loc) · 847 Bytes
/
2_rescale.py
File metadata and controls
35 lines (26 loc) · 847 Bytes
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
import cv2 as cv
# img = cv.imread("Photos/cat.jpg")
# cv.imshow("Cat", img)
def rescaleFrame(frame, scale = 0.75):
# Images, videos and live video
width = int(frame.shape[1] * scale)
height = int(frame.shape[0] * scale)
dimensions = (width, height)
return cv.resize(frame, dimensions, interpolation=cv.INTER_AREA)
# resized_image = rescaleFrame(img)
# cv.imshow("Image", resized_image)
def changeRes(width, height):
# Live video
capture.set(3, width)
capture.set(4, height)
# Reading videos
capture = cv.VideoCapture("Videos/dog.mp4")
while True:
isTrue, frame = capture.read()
frame_resized = rescaleFrame(frame, scale=.2)
cv.imshow('Video', frame)
cv.imshow('Video Resized', frame_resized)
if cv.waitKey(20) & 0xFF == ord("d"):
break
capture.release()
cv.destroyAllWindows()