Beispiel #1
0
if export:
    # Fps of output video should be same as input
    fps = test_video.get(cv2.CAP_PROP_FPS)
    out = cv2.VideoWriter('output_images/output.avi', cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'), fps, (w, h))

while ret:

    # Undistort image
    undistorted = cv2.undistort(frame, intrinsic, dist)

    # Feed it to the lane
    lane.process(undistorted)

    # Mask the undistorted frame with lane highlight
    mask = lane.mask_frame(undistorted)

    # Draw vehicle position indicator
    mask = draw_car_and_lane(mask, lane.vehicle_center)

    # Visualize and write to video as video writing is enabled
    cv2.imshow("vid", mask)
    if export:
        out.write(mask)
    key = cv2.waitKey(delay)

    # Check for interrupts
    if key == 27:
        break
    elif key == 32:
        delay = 1 if delay == 0 else 0