MATLAB Answers

How to get the hue/saturation of a grayscale image?

190 views (last 30 days)
Jayzel Castro
Jayzel Castro on 24 Jan 2014
Commented: Raka Mukherjee on 23 Jan 2020 at 11:20
Will I still able to get the hue/saturation of an image if the picture is already a grayscale? Can I use the HSV for getting the hue?

  0 Comments

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 24 Jan 2014
Here is how to get the hue and saturation image for a grayscale image:
hueImage = zeros(size(grayscaleImage));
saturationImage = zeros(size(grayscaleImage));
Of course, they are both all zero for a monochrome, grayscale image. Why would they not be? Were you expecting something different?

  11 Comments

Show 8 older comments
Image Analyst
Image Analyst on 22 Jan 2020 at 12:54
"How is that possible if I have R G and B channels" <== Well, why did you create the RGB image in the first place from the binary image? Just don't make it. Use the original binary image, or the grayscale image from where that binary image came from.
Walter Roberson
Walter Roberson on 22 Jan 2020 at 18:15
When you copy the same values to the r, g, and b color planes, then the result is a grayscale image. Every pixel will be gray, unless you want to define pure black or pure white as not being "gray" for your purposes.
Raka Mukherjee
Raka Mukherjee on 23 Jan 2020 at 11:20
Thank you so much. I have got it now. :)

Sign in to comment.

More Answers (1)

Jayzel Castro
Jayzel Castro on 27 Jan 2014
Thank you for the answers I understand it now :)

  0 Comments

Sign in to comment.

Sign in to answer this question.