Image Processing getting HSV components from colored image

I am trying to the the hue, saturation and value images from an image (originally colored). I converted the image using rgb2hsv() function but I am confused about how to get the 3 images from there.
Thanks in advance!

 採用された回答

Walter Roberson
Walter Roberson 2017 年 10 月 11 日
編集済み: DGM 2025 年 1 月 29 日

1 投票

hsv = rgb2hsv(YourRGBImage);
h_image = hsv(:,:,1);
s_image = hsv(:,:,2);
v_image = hsv(:,:,3);

1 件のコメント

DGM
DGM 2025 年 1 月 29 日
編集済み: DGM 2025 年 1 月 29 日
(minor typo fix)
While I'm here:
Unlike other similar conversion tools, rgb2hsv() directly supports the output of a split image without manually splitting the channels as above or using imsplit().
% an RGB image
inpict = imread('peppers.png');
% method 1: manually split the image (any version)
hsvpict = rgb2hsv(inpict);
H = hsvpict(:,:,1);
S = hsvpict(:,:,2);
V = hsvpict(:,:,3);
% method 2: split the image using imsplit() (wouldn't have worked until R2018b)
hsvpict = rgb2hsv(inpict);
[H S V] = imsplit(hsvpict);
% method 3: get the channels directly from rgb2hsv() (any version)
[H S V] = rgb2hsv(inpict);
Again, that's really only a feature of rgb2hsv(). If you're using something else (e.g. rgb2lab(), rgb2ycbcr(), rgb2ntsc()), then you'll have to do method 1 or 2.

サインインしてコメントする。

その他の回答 (0 件)

質問済み:

2017 年 10 月 11 日

編集済み:

DGM
2025 年 1 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by