1 | initial version |
I was able to solve the problem. I just need to figure out how to loop:
import numpy as np
import cv2
cap = cv2.VideoCapture('C:\Sample3.mp4')
def rescale_frame(frame, percent=30):
width = int(frame.shape[1] * percent/ 100)
height = int(frame.shape[0] * percent/ 100)
dim = (width, height)
return cv2.resize(frame, dim, interpolation =cv2.INTER_AREA)
while True:
ret ,frame = cap.read()
if type(frame) == type(None):
break
frame25 = rescale_frame(frame, percent=25)
cv2.imshow('frame25',frame25)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()