if len(sys.argv) == 4: start = np.int_(sys.argv[2]) end = np.int_(sys.argv[3]) input_clip = VideoFileClip(fname).subclip(start, end) else: input_clip = VideoFileClip(fname) output_file = output_video_location + "/" + fname left_line = Line('left') right_line = Line('right') # Frame by frame visualization of lane line and road information output_clip = input_clip.fl_image(image_to_lane_visualization) # Write the output vide in a file output_clip.write_videofile(output_file, audio=False) # Main program -- DEBUG mode if DEBUG: # Go through the test files and output the intermediate pipeline steps into files for file in test_files: img = mpimg.imread(test_location + "/" + file) undist = undistort(img, mtx, dist) thresh = thresholding(undist) warped = warp(thresh, M) left_line = Line('left') right_line = Line('right') left_line.add_new_image(warped) right_line.add_new_image(warped) visualizer = RoadVisualizer([0, 255, 0], Minv) visualizer.set_lane_lines(left_line, right_line) final = visualizer.visualize(img) mpimg.imsave(output_image_location + "/final_" + file, final)