def calculateSteeringAngle(img, lines):
    if (len(lines) == 0):
        return (- 90)
    (height, width, _) = img.shape
    if (len(lines) == 1):
        (x1, _, x2, _) = lines[0]
        x_offset = (x2 - x1)
    else:
        (_, _, left_x2, _) = lines[0]
        (_, _, right_x2, _) = lines[1]
        camera_mid_offset_percent = 0.0
        mid = int(((width / 2) * (1 + camera_mid_offset_percent)))
        x_offset = (((left_x2 + right_x2) / 2) - mid)
    y_offset = int((height / 2))
    angle_to_mid_radian = math.atan((x_offset / y_offset))
    angle_to_mid_deg = int(((angle_to_mid_radian * 180.0) / math.pi))
    steering_angle = (angle_to_mid_deg + 90)
    return steering_angle
def calculateSteeringAngle(img, lines):
    if (len(lines) == 0):
        return (- 90)
    (height, width, _) = img.shape
    if (len(lines) == 1):
        (x1, _, x2, _) = lines[0]
        x_offset = (x2 - x1)
    else:
        (_, _, left_x2, _) = lines[0]
        (_, _, right_x2, _) = lines[1]
        camera_mid_offset_percent = 0.0
        mid = int(((width / 2) * (1 + camera_mid_offset_percent)))
        x_offset = (((left_x2 + right_x2) / 2) - mid)
    y_offset = int((height / 2))
    angle_to_mid_radian = math.atan((x_offset / y_offset))
    angle_to_mid_deg = int(((angle_to_mid_radian * 180.0) / math.pi))
    steering_angle = (angle_to_mid_deg + 90)
    return steering_angle