Normalization image rgb

6.8k views Asked by At

I have a problem with normalization. Let me what the problem is and how I attempt to solve it.
I take a three-channel color image, convert it to grayscale and apply uniform or non-uniform quantization and the same thing. To this image, I should apply the normalization, but I have a problem even if the image and grayscale and always has three channels. How can I apply normalization having a three-channel image? Should the min and the max all be in the three channels? Could someone give me a hand?
The language I am using is processing 2.

P.S. Can you do the same thing with a color image instead use a grayscale image?

2

There are 2 answers

1
Adam Hughes On

You can convert between the 1-channel and 3-channel representations easily. I'd recommend scikit-image (http://scikit-image.org/).

from skimage.io import imread
from skimage.color import rgb2gray, gray2rgb

rgb_img = imread('path/to/my/image')
gray_img = rgb2gray(rgb_image)

# Now normalize gray image
gray_norm = gray_img / max(gray_img)

# Now convert back
rgb_norm = gray2rgb(gray_norm)
0
Mercury On

I worked with a similar problem sometime back. One of the good solutions to this was to:

  • Convert the image from RGB to HSI
  • Leaving the Hue and Saturation channels unchanged, simply normalize across the Intensity channel
  • Convert back to RGB

This logic can be applied accross several other image processing tasks, like for example, applying histogram equalization to RGB images.