-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrescale.py
More file actions
31 lines (24 loc) · 799 Bytes
/
rescale.py
File metadata and controls
31 lines (24 loc) · 799 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
import cv2 as cv
img=cv.imread("Photos\cat.jpg")
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)
def changeRes(width,height):
#live Video
capture.set(3,width)
capture.set(4,height)
resized_img=rescaleFrame(img)
cv.imshow('Catresized',resized_img)
cv.imshow('Cat',img)
capture=cv.VideoCapture('Videos/dog.mp4')
while True:
isTrue, frame=capture.read()
frame_resized=rescaleFrame(frame,scale=0.2)
cv.imshow('Video resized',frame_resized)
cv.imshow('Video',frame)
if cv.waitKey(20) & 0XFF==ord('d'):
break
cv.waitKey(0)