def pad_image(img, crops):
    """
    Function recomputes the image and the objects masks
    when the image is padded.
    """
    left_crop = crops[0]
    top_crop = crops[1]
    right_crop = crops[2]
    bottom_crop = crops[3]
    left_crop = left_crop * (img.shape[0] - 1)
    right_crop = (1.0 - right_crop) * (img.shape[0] - 1)
    top_crop = top_crop * (img.shape[1] - 1)
    bottom_crop = (1.0 - bottom_crop) * (img.shape[1] - 1)
    img = img[round(left_crop):round(right_crop) + 1, round(top_crop):round
        (bottom_crop) + 1, :]
    return img
