-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideoPrediction.py
More file actions
26 lines (25 loc) · 857 Bytes
/
VideoPrediction.py
File metadata and controls
26 lines (25 loc) · 857 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
import warnings
warnings.simplefilter(action='ignore')
import cv2
from PIL import Image
from image_module import image_prediction as imp
from datetime import datetime
video_path = "./output/video/"+str(datetime.now())+".avi"
out = cv2.VideoWriter(".output/video/output.avi",cv2.VideoWriter_fourcc(*"MJPG"), 10,(640,480))
def video_predictor(path):
cap = cv2.VideoCapture(path)
length = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
n = 0
print("Begining Image Feed: ")
while True:
ret,image = cap.read()
if ret==False:
break
image = Image.fromarray(image)
image = image.resize((640, 480), Image.ANTIALIAS)
l = imp.prediction(image)
image_np = l[1]
fuzzy = l[0]
out.write(image_np)
n+=1
print("Frame ",n," Processed of",length)