-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmain.py
More file actions
48 lines (39 loc) · 1.15 KB
/
Copy pathmain.py
File metadata and controls
48 lines (39 loc) · 1.15 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
import calibration
import lane_finding
import cv2
import visualizer
image_size = (1280,720)
# PREPROCESSING: CAMERA CALIBRATION
cal_mtx,dist_coeff = calibration.calibrate()
# print(cal_mtx)
# print(dist_coeff)
# PROCESSING:
lane_finder = lane_finding.LaneFinder(cal_mtx,dist_coeff,image_size)
# ON TEST IMAGE
lane_finding.debug = False
# test_image = cv2.imread('test_images/test5.jpg')
# # visualizer.plot_colorspaces(test_image,'output_images/test_image/')
# # lane_finder.adjust_parameters(test_image)
# test_result = lane_finder.process_image(test_image)
# ON PROJECT VIDEO
lane_finding.debug = False
cap = cv2.VideoCapture('project_video.mp4')
fourcc = cv2.VideoWriter_fourcc(*'MP4V')
out = cv2.VideoWriter('output_video.mp4',fourcc, 60.0, image_size)
i = 0
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
i += 1
#print("Frame " + str(i))
result = lane_finder.process_image(frame)
out.write(result)
# cv2.imshow('frame2',frame2)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
# visualizer.plot_history(lane_finder)