def identify_nearest_lane_point()

in spark_scripts/detect_scenes.py [0:0]


def identify_nearest_lane_point(x, y, lane_points):
    """
    Given an x,y coordinate in the image, identify closest lane point per lane
    """
    v = json.loads(lane_points)['lanes_clean']
    lanes = json.loads(v)

    nearest_pts = {}
    for idx, lane in enumerate(lanes):
        if lane:
            img_pts = lane['image_points']
            nearest_pts[idx] = get_nearest_image_point(x, y, img_pts)

    return nearest_pts