def normalize(img):
    """
    Normalize an image array.

    Assume the image is stored as an array or matrix of uint8. Since the max
    value of uint8 is 255 we use 128 (255 / 2) as the constant in the
    formula below.

    Args:
        img: input image

    Returns:
        Normalized image
    """
    normalized_img = (img - 128) / 128

    return normalized_img