MATLAB Answers

How the L C H Values Could Be Seen as a value on an Image

조회 수: 2(최근 30일)
Murat Kocaman
Murat Kocaman 2018년 5월 28일
편집: DGM 2021년 5월 10일
Hi All,
I am trying to check an image file to reach its color values and I could see RGB but while trying to check the commands for Lightness Chroma and Hue values I got the same error all the time. It is usually varargin error.
Is there anybody knows how to pass this error?
I am using:
disp(sprintf('RGB2LCH: unknown option %s',varargin{k}))
The document I referred to indicates that firstly convert it to L*a*b. I have already tried it but had the same error.

채택된 답변

Image Analyst
Image Analyst 2018년 5월 28일
I don't know what function you're using or what you're passing into it, so I can't answer your question without more info. In general you can convert RGB into some other color space and get the values of those other color space channels by specifying the row and column just like you do with the red, green, or blue channels.

추가 답변(1개)

DGM 2021년 5월 9일
I know this is ancient, but this is almost certainly MIMT, judging by that garbage error handling I used to use. Might as well leave the answer where the next person can hit it with a google search.
rgb2lch() handles unconstrained conversion of sRGB to LCHab. No need to convert anything first. Passing arguments other than the key strings described in the synopsis will get you that error.
If you're trying to convert a tuple or color table, you'd need to reorient it along dim3.
Web Docs:
  댓글 수: 2
DGM 2021년 5월 10일
Maybe. The output of rgb2lch() is scaled such that L is in the range [0 100], H is [0 360]. The displayrange parameter doesn't really work right except on single-channel images, so you'd have to do
imshow(lchpict(:,:,1), []); % view each channel individually
I doubt the OP needs the root problem solved anymore, but the invalid syntax was at least a part of the question I could address.

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

Community Treasure Hunt

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

Start Hunting!

Translated by