-
Notifications
You must be signed in to change notification settings - Fork 104
/
main.py
36 lines (25 loc) · 1020 Bytes
/
main.py
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
"""Departure Warning System with a Monocular Camera"""
__author__ = "Junsheng Fu"
__email__ = "[email protected]"
__date__ = "March 2017"
from lane import *
from moviepy.editor import VideoFileClip
if __name__ == "__main__":
demo = 1 # 1: image, 2 video
if demo == 1:
imagepath = 'examples/test3.jpg'
img = cv2.imread(imagepath)
img_aug = process_frame(img)
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(25, 9))
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
ax1.imshow(img)
ax1.set_title('Original Image', fontsize=30)
img_aug = cv2.cvtColor(img_aug, cv2.COLOR_BGR2RGB)
ax2.imshow(img_aug)
ax2.set_title('Augmented Image', fontsize=30)
plt.show()
else:
video_output = 'examples/project_video_augmented.mp4'
clip1 = VideoFileClip("examples/project_video.mp4")
clip = clip1.fl_image(process_frame) #NOTE: it should be in BGR format
clip.write_videofile(video_output, audio=False)