Skip to main content

Image Normalization

Normalizing an Image across Different Axes

How does it look when we normalize an image over spatial dimensions instead of color channels?

In [1]:
from IPython.display import display
from tensorflow.keras.preprocessing import image
from tensorflow.keras.utils import normalize

img = image.load_img('dog.jpg')
display(img)

x = image.img_to_array(img)
assert x.shape[-1] == 3, "Not a RGB image with channels last."

# Normalize per row.
display(image.array_to_img(normalize(x, axis=0)))

# Normalize per column.
display(image.array_to_img(normalize(x, axis=1)))

# Normalize per color channel.
display(image.array_to_img(normalize(x, axis=2)))
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

Comments

Comments powered by Disqus