12-14-2024 08:24 AM
Bonjour,
Je veux récupérer les trois valeurs rgb de mes couleurs (index des couleurs que je donne en entrée à ma fonction)
mais quand j'utilise la fonction labview "color to RGB.vi", cela me retourne uniquement les valeurs de B et que des valeurs nulles pour R et G....Je ne comprends pas comment c'est possible que ma fonction soit ok que pour B?!
Est-ce que quelqu'un saurait identifier mon problème?
(J'ai mis des valeur d'exemple en entrée pour faire des tests)
12-14-2024 09:10 AM - edited 12-14-2024 09:13 AM
@Ginette wrote:
Translated by google:
Good morning,
I want to retrieve the three rgb values of my colors (index of the colors that I give as input to my function)
but when I use the labview function "color to RGB.vi", it only returns the values of B and only zero values for R and G....I don't understand how it is possible that my function is ok only for B?!
Can anyone identify my problem?
(I put example values as input to do tests)
(J'ai mis des valeur d'exemple en entrée pour faire des tests)
This is a very simple operation that can fit on a postage stamp. It looks like your "traces" are only in the range of x00..xFF, i.e. they only contain blue. If you have full color RGB values, they should be in the range x00000-xFFFFFF. IF your entries are actually indices into a colormap, you need to have the colormap.
We cannot debug blurry pictures. I can't even tell the division you are doing. Please attach your VI containing typical data in the controls.
12-14-2024 09:28 AM
@altenbach wrote:
This is a very simple operation that can fit on a postage stamp.
As an example, here's some simple code that can replace the entire while loop.
Also,
12-14-2024 09:44 AM
If each three U8 values are the RGB components, here's all you need:
I am sure you need to make modifications according to your exact requirements...
12-15-2024 06:13 AM
Thanks for your answer,
I need RGB values between 0 and 1, that's why i'm dividing by 255
But I initially only have indices (what I called traces) of my colors, so I'm using the "color to RGB.vi" from Labview, in order to get the value of each R,G and B. Which works but only for the B value....and no I do not have only blue colors, I have tried with many different indices, always returns 0 for my R and G.
I'm really confuse because the issue seems to come from the color vi, as my traces (the input) is correct, but not my output rgb values.
12-15-2024 09:48 AM - edited 12-15-2024 12:34 PM
A color is a U32 value where 24 bits are used, 8 each for R, G, and B. If the values are less than 255, it is obvious that R and G are zero and no voodoo or "tricks" can generate them out of thin air. Obviously, the output is NOT correct!
As I said, maybe you have a colormap. In that case there are only 256 RGB colors and the value is an index into that array. Can you explain where the original data comes from? What is upstream? If you unflatten from a image that has a colormap, you get an array of colors out, then just index into it using your "traces" as index. (These are "indices", not sure why you call them "traces")
(Again, your 255 was blurry and barely recognizable without zooming in. It would be much easier to attach VIs instead. We canny debug images)