MATLAB Answers

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

2 views (last 30 days)
Murat Kocaman
Murat Kocaman on 28 May 2018
Edited: DGM on 10 May 2021
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.

Accepted Answer

Image Analyst
Image Analyst on 28 May 2018
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.

More Answers (1)

DGM on 9 May 2021
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:
DGM on 10 May 2021
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!