How to get the hue/saturation of a colourful images?

9 vues (au cours des 30 derniers jours)
ahmad Al sarairah
ahmad Al sarairah le 29 Déc 2019
Modifié(e) : Guillaume le 8 Jan 2020
I have a set of color images and I want to get the values of hue and saturation and brightness using matlab , But I want to get the values quickly for all the images because the number of images is too large.
thanks to all.

Réponses (2)

KALYAN ACHARJYA
KALYAN ACHARJYA le 29 Déc 2019
rgb2hsv and get the data
  4 commentaires
ahmad Al sarairah
ahmad Al sarairah le 29 Déc 2019
how do i save data in cell array?
KALYAN ACHARJYA
KALYAN ACHARJYA le 29 Déc 2019
Modifié(e) : KALYAN ACHARJYA le 29 Déc 2019
for i=1:...
variable_name{i}=data_to_be_save
end
See here

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 29 Déc 2019
Then inside the loop over k, call rgb2hsv(). If you want the means, do
hsvImage = rgb2hsv(rgbImage);
hmean(k) = mean2(hsvImage(:, :, 1))
smean(k) = mean2(hsvImage(:, :, 2))
vmean(k) = mean2(hsvImage(:, :, 3))
  5 commentaires
Image Analyst
Image Analyst le 7 Jan 2020
mean2() is a function in the Image Processing Toolbox that takes the mean of a 2-D array. It's basically the same as mean(array(:)).
Guillaume
Guillaume le 8 Jan 2020
Modifié(e) : Guillaume le 8 Jan 2020
Or since R2018b, you can also use mean(array, 'all'). There's not much need for mean2 anymore. You could also calculte the mean of all 3 channels at once as a 1x3 vector with:
hsvmean = squeeze(mean(hsvImage, [1, 2])); %requires R2018b or later

Connectez-vous pour commenter.

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by