How the L C H Values Could Be Seen as a value on an Image
Show older comments
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
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.
lchpict=rgb2lch(rgbpict,'lab');
If you're trying to convert a tuple or color table, you'd need to reorient it along dim3.
Web Docs:
2 Comments
Image Analyst
on 9 May 2021
Maybe when he says "How the L C H Values Could Be Seen as a value on an Image" he means how to mouse around over the image and see a readout of the values. If so that can be done with the impixelinfo() function.
imshow(lchpict, []);
impixelinfo; % Mousing over image displays the values in a text label.
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
impixelinfo;
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.
Categories
Find more on Display Image in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!