예제 #1
0
for i in range(num_frames):
    print("Retrieving frame#: ", i)
    img_p = vid.get_data(i)

    img = cal.undistort(img_p)
    #cv2.imshow("original frame", cv2.cvtColor(img_p, cv2.COLOR_BGR2RGB))
    #cv2.imshow("undistorted frame", cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
    #cv2.line(img1, (x1, y1), (x2, y2), color, thickness)
    #cv2.line(img1, (x3, y3), (x4, y4), color, thickness)
    #cv2.line(img1, (x2, y2), (x4, y4), color, thickness)

    #gray = cv2.cvtColor(img1, cv2.COLOR_RGB2GRAY)
    #warped = cv2.warpPerspective(img1,H,(img.shape[1], img.shape[0]))
    #cv2.imshow("frame", warped)

    frame_handler.process_frame(img)
    #cv2.imshow("h-binary",np.uint8(255*frame_handler.h_binary))
    cv2.imshow("s-binary", np.uint8(255 * frame_handler.s_binary))
    #cv2.imshow("x-gradient", np.uint8(255*(frame_handler.sobelx - np.min(frame_handler.sobelx))/(np.max(frame_handler.sobelx) - np.min(frame_handler.sobelx))))
    cv2.imshow("xgrad-binary", np.uint8(255 * frame_handler.gradx_binary))
    cv2.imshow("final binary", frame_handler.out_img)
    #cv2.imshow("warped", np.uint8(255*frame_handler.img_warped) )
    lane_tracker.track_lanes(frame_handler.img_warped, img)
    # updating the cropping line end-points in the frame-handler
    #frame_handler.crop_ll = lane_tracker.ll
    #frame_handler.crop_ul = lane_tracker.ul
    #frame_handler.crop_lr = lane_tracker.lr
    #frame_handler.crop_ur = lane_tracker.ur
    cv2.imshow("warped", np.uint8(lane_tracker.out_img))
    # yet another conversion for display purposes
    # (BGR2RGB - recall image was NOT opened with OpenCV becausde I had problems with ffmped