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일
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