Beispiel #1
0
def process_image(image):
    image2 = image[:]
    image = OneDHWTLaneDetectorV2.crop_image(image)

    thresh = OneDHWTLaneDetectorV2.pre_process(image)

    ll_points = OneDHWTLaneDetectorV2.get_ll_spike_positions(thresh,
                                                             signal_row_start=Params.ROI_HEIGHT - 1, signal_row_end=0,
                                                             signal_col_start=0, signal_col_end=64,
                                                             row_thresh=40)

    rl_points = OneDHWTLaneDetectorV2.get_rl_spike_positions(thresh,
                                                             signal_row_start=Params.ROI_HEIGHT - 1, signal_row_end=0,
                                                             signal_col_start=(Params.ROI_WIDTH - 64),
                                                             signal_col_end=Params.ROI_WIDTH,
                                                             row_thresh=40)

    ll_points, rl_points = OneDHWTLaneDetectorV2.filter_cross_points(ll_points, rl_points)

    updated_ll_points = [tuple((a + Params.ROI_START_COL, b + Params.ROI_START_ROW)) for a, b in ll_points]
    updated_rl_points = [tuple((a + Params.ROI_START_COL, b + Params.ROI_START_ROW)) for a, b in rl_points]

    NumUtils.draw_lanes(image2, updated_ll_points, -60, -30, color=(0, 255, 0), thickness=2)
    NumUtils.draw_lanes(image2, updated_rl_points, 30, 60, color=(0, 0, 255), thickness=2)

    cv2.rectangle(image2, (Params.ROI_START_COL, Params.ROI_START_ROW), (Params.ROI_END_COL, Params.ROI_END_ROW),
                  (255, 255, 0))

    return image2