How to find mean Hue and mean Saturation of an HSI image not HSV image?

19 views (last 30 days)
After converting RGB to HSI, I want to get the mean values for Hue,Saturation and Intensity. I got codes for HSV image i.e.,
hsv = rgb2hsv(segmented_images{2});
h = hsv(:,:,1);
s = hsv(:,:,2);
v = hsv(:,:,3);
binaryImage = v > 0.82 & v < 0.90;
meanHue = mean(h(HSI));
s = hsv(:,:,2);
avgS = mean(s(:));
meanIntensity = mean(i2(:));
Can anyone help me with HSI image
Image Analyst
Image Analyst on 28 Feb 2018
But your code never showed where you converted to HSI. You have only the HSV color space, not the HSI color space. My answer below shows how to get HSI rather than HSV like your subject line asked.

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 28 Feb 2018
The formulas can be found in Wikipedia:

DGM on 20 May 2022
Edited: DGM on 20 May 2022
MATLAB has no tools for HSI or HSL. There are tools on the File Exchange. The ones I use are here:
There are also others on the File Exchange, though be aware that Pascal Getreuer's popular Colorspace Transformations has a bug in the HSI path and will give the incorrect results unless you use the .mex version.
How do you find average component values in HSI, HSV, HSL, or any other polar model? You don't use mean() on hue. See this answer for a demonstration:


Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!