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

조회 수: 3 (최근 30일)
ahmad Al sarairah
ahmad Al sarairah 2019년 12월 29일
편집: Guillaume 2020년 1월 8일
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.

답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 12월 29일
rgb2hsv and get the data
  댓글 수: 4
ahmad Al sarairah
ahmad Al sarairah 2019년 12월 29일
how do i save data in cell array?
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 12월 29일
편집: KALYAN ACHARJYA 2019년 12월 29일
for i=1:...
variable_name{i}=data_to_be_save
end
See here

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2019년 12월 29일
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
Image Analyst
Image Analyst 2020년 1월 7일
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 2020년 1월 8일
편집: Guillaume 2020년 1월 8일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 White에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by