I'm having trouble with the IMAQ RGBToColor2 VI for RGB to CIE La*b* conversion. For simple values such as 255, 255, 255 it works, but for other values it gives me different answers than other implementations of the conversion algorithm. For example the website http://www.easyrgb.com/index.php?X=CALC converts the RGB values 5, 50, 128 to 23.244, 19.428, -47.710. The Labview VI converts it to 126.408, -1.605, -41.324. I found a post on this forum which indicates that the luminance value is in the range 0-255 instead of 0-100, however even when I apply this scaling the luminance value is still not correct, and it does not explain the problems with the a* and b* values.
Can anyone help me with this please? Am I missing something in how I should use this VI? (The results by the way are from directly entering the RGB values using the VI front panel).
After I went through your problem and have contact with our support in VS I can say that our IMAQ vi is under test to make its problem to be solved. But if you still have the same problem you could use another vi which is given in my example as attachment. As you could see, this vi gives the same results as what you can get from the other softwares that you linked.
I hope that it would be helpful and if you have questions I will hear them.
Thanks very much. I hope that the debugging of the IMAQ VI will go well. In any case it helps a lot to have the problem confirmed.
Today I got the answer from our support in Canada which is given below.
Unfortunately, this is the expected behavior of that VI. As I mentioned earlier, R&D decided not to include the normalization step because most machine vision cameras don't apply a gamma correction.
The CAR I filed was just a suggestion to improve the help documentation to explain this. I also suggested that they add the option to apply normalization with the VI, but that's up to R&D to decide if they want to do that for a later release.
As I mentioned in my previous feedback, you can use that VI's that they provided for you.
I hope that you can go on and if you have questions, you can come back here.
Thanks for your reply. So if I understand correctly, the RGB->La*b* conversion assumes linear RGB as input?
It helps to understand why there is a difference in the results, thank you. We can then choose which method is most suitable for our application.
I was able to talk with R&D about this VI, and they said this is expected
behavior. There are different ways to do the conversion, and our VI happens to
do it differently. To convert from RGB to LAB there are conversions (first
convert to XYZ and then from XYZ to LAB).
To convert from RGB to XYZ typically two steps are performed as explained here.
The first step (linearization) is to remove non linearity introduced by gamma correction
and to normalize the RGB. However, VDM does not do this because we assume most
industrial color cameras don't apply gamma correction (typically this correction
is limited to consumer digital cameras).
I hope that it helps you.