@preserve_shape<EOL>def add_shadow(img, vertices_list):
non_rgb_warning(img)<EOL>input_dtype = img.dtype<EOL>needs_float = False<EOL>if input_dtype == np.float32:<EOL><INDENT>img = from_float(img, dtype=np.dtype('<STR_LIT>'))<EOL>needs_float = True<EOL><DEDENT>elif input_dtype not in (np.uint8, np.float32):<EOL><INDENT>raise ValueError('<STR_LIT>'.format(input_dtype))<EOL><DEDENT>image_hls = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)<EOL>mask = np.zeros_like(img)<EOL>for vertices in vertices_list:<EOL><INDENT>cv2.fillPoly(mask, vertices, <NUM_LIT:255>)<EOL><DEDENT>red_max_value_ind = mask[:, :, <NUM_LIT:0>] == <NUM_LIT:255><EOL>image_hls[:, :, <NUM_LIT:1>][red_max_value_ind] = image_hls[:, :, <NUM_LIT:1>][red_max_value_ind] * <NUM_LIT:0.5><EOL>image_rgb = cv2.cvtColor(image_hls, cv2.COLOR_HLS2RGB)<EOL>if needs_float:<EOL><INDENT>image_rgb = to_float(image_rgb, max_value=<NUM_LIT:255>)<EOL><DEDENT>return image_rgb<EOL>
Add shadows to the image.

    From https://github.com/UjjwalSaxena/Automold--Road-Augmentation-Library

    Args:
        img (np.array):
        vertices_list (list):

    Returns: