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

3 vues (au cours des 30 derniers jours)
Murat Kocaman
Murat Kocaman le 28 Mai 2018
Modifié(e) : DGM le 10 Mai 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.

Réponse acceptée

Image Analyst
Image Analyst le 28 Mai 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.

Plus de réponses (1)

DGM
DGM le 9 Mai 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 commentaires
Image Analyst
Image Analyst le 9 Mai 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.
DGM
DGM le 10 Mai 2021
Modifié(e) : DGM le 10 Mai 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
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by