H,S,V components

19 ビュー (過去 30 日間)
Aysel Alimirzayeva
Aysel Alimirzayeva 2022 年 11 月 7 日
コメント済み: Aysel Alimirzayeva 2022 年 11 月 8 日
Hello.How can I display the H,S,V components separately in matlab on the example below?Please,canyou help me?

採用された回答

Maik
Maik 2022 年 11 月 7 日
編集済み: Maik 2022 年 11 月 7 日
Im = imread('peppers.png');
% Display RGB image
figure;imshow(Im);
% Convert RGB to HSV
hsvIm = rgb2hsv(Im);
% Display HSV channels
hChannel = hsvIm(:,:,1);
figure;imshow(hChannel);
sChannel = hsvIm(:,:,2);
figure;imshow(sChannel);
vChannel = hsvIm(:,:,3);
figure;imshow(vChannel);
  3 件のコメント
Maik
Maik 2022 年 11 月 7 日
Thanks changed it now. :)
Aysel Alimirzayeva
Aysel Alimirzayeva 2022 年 11 月 8 日
@Maik Thank you.

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

その他の回答 (2 件)

John D'Errico
John D'Errico 2022 年 11 月 7 日
trivial, really.
help rgb2hsv
RGB2HSV Convert red-green-blue colors to hue-saturation-value. H = RGB2HSV(M) converts an RGB color map to an HSV color map. Each map is a matrix with any number of rows, exactly three columns, and elements in the interval 0 to 1. The columns of the input matrix, M, represent intensity of red, green and blue, respectively. The columns of the resulting output matrix, H, represent hue, saturation and color value, respectively. HSV = RGB2HSV(RGB) converts the RGB image RGB (3-D array) to the equivalent HSV image HSV (3-D array). CLASS SUPPORT ------------- If the input is an RGB image, it can be of class uint8, uint16, single, or double. The output image is single when the input is single. For all other input data types, the output image is double. If the input is a colormap, the input and output colormaps are both of class double. See also HSV2RGB, COLORMAP, RGBPLOT. Documentation for rgb2hsv doc rgb2hsv Other uses of rgb2hsv codistributed/rgb2hsv gpuArray/rgb2hsv
So simply convert to HSV. Then you can use a tool like imshow
waves = imread('waves.jpg');
waves_HSV = rgb2hsv(waves);
imshow(waves_HSV(:,:,1))
title 'H channel'
imshow(waves_HSV(:,:,2))
title 'S channel'
imshow(waves_HSV(:,:,3))
title 'V channel'
Easy peasy.
  1 件のコメント
Aysel Alimirzayeva
Aysel Alimirzayeva 2022 年 11 月 8 日
@John D'Errico Thank you very much.

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


Image Analyst
Image Analyst 2022 年 11 月 7 日
hsvImage = rgb2hsv(rgbImage);
[hImage, sImage, vImage] = imsplit(hsvImage);
  1 件のコメント
Aysel Alimirzayeva
Aysel Alimirzayeva 2022 年 11 月 8 日

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

Community Treasure Hunt

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

Start Hunting!

Translated by