rpi_assignments/assignment_2/03_lane_detection_show.py

35 lines
713 B
Python
Raw Permalink Normal View History

2023-10-19 07:40:45 +00:00
import numpy as np
import cv2
names = ['input.mp4', 'output.mp4']
window_titles = ['input', 'output']
cap = [cv2.VideoCapture(i) for i in names]
frames = [None] * len(names);
gray = [None] * len(names);
ret = [None] * len(names);
while True:
for i,c in enumerate(cap):
if c is not None:
ret[i], frames[i] = c.read();
for i,f in enumerate(frames):
if ret[i] is True:
#gray[i] = cv2.cvtColor(f, cv2.COLOR_BGR2GRAY)
#cv2.imshow(window_titles[i], gray[i]);
cv2.imshow(window_titles[i], frames[i]);
if cv2.waitKey(1) & 0xFF == ord('q'):
break
for c in cap:
if c is not None:
c.release();
cv2.destroyAllWindows()