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

12 visualizzazioni (ultimi 30 giorni)
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
  2 Commenti
Sivasurya J
Sivasurya J il 28 Feb 2018
I got it... After converting RGB to HSI image H = HSI(:,:,1); S = HSI(:,:,2); I = HSI(:,:,3); meanH = mean(H(:)); meanS = mean(S(:)); meanI = mean(I(:)); It works...:)
Image Analyst
Image Analyst il 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.

Accedi per commentare.

Risposte (2)

Image Analyst
Image Analyst il 28 Feb 2018
The formulas can be found in Wikipedia: https://en.wikipedia.org/wiki/HSL_and_HSV#Lightness

DGM
DGM il 20 Mag 2022
Modificato: DGM il 20 Mag 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:

Categorie

Scopri di più su Modify Image Colors in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by