how to change rgb to [ Hue1, Hue2, Sat1, Sat2, Val1, Val2 ]

조회 수: 1 (최근 30일)
truong  nhat quang
truong nhat quang 2015년 7월 15일
답변: DGM 2023년 3월 11일
% Color = [ Hue1, Hue2, Sat1, Sat2, Val1, Val2 ] ///// 1 is lower limit % and 2 is upper limit

답변 (1개)

DGM
DGM 2023년 3월 11일
The question is either incomplete or malformed; I can't tell which. You're asking how to change an RGB image to a range of HSV values.
On one hand, that description makes one think of the obvious.
inpict = imread('peppers.png');
hsvpict = rgb2hsv(inpict);
hsvmin = squeeze(min(hsvpict,[],[1 2]));
hsvmax = squeeze(max(hsvpict,[],[1 2]));
hsvrange = [hsvmin hsvmax]
hsvrange = 3×2
0 0.9991 0 1.0000 0.0353 1.0000
... but there's two problems with this. First is the fact that H is circular. Calculating the min and max alone does not tell us where the H content lies. Second, the question describes these as limits, suggesting that these are not properties of the image, but parameters for some operation applied to the image. I could guess that the actual question is How do I do color-based segmentation in HSV, but that was never asked, and it could just as easily be any number of other things.
Either way, we'll never know.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by