ColorPAL output interpretation
ismailk
Posts: 2
Hi,
After a long and painful learning process I've succesfully interfaced my ColorPAL #28380 with PIC18F4550.
Even though I've read literally all the blogs and posts about output interpretation and white balancing, I'm still confused.
Here is my code to get the output values and convert them to 0-255 range.
I've also posted my raw data from various color samples as attachment. If I get a balancing matrix from a white sample, and apply those coefficients to my readings they still doesn't make any sense.
Any advice would be much appreciated.
Thanks,
[h=3][/h]
After a long and painful learning process I've succesfully interfaced my ColorPAL #28380 with PIC18F4550.
Even though I've read literally all the blogs and posts about output interpretation and white balancing, I'm still confused.
Here is my code to get the output values and convert them to 0-255 range.
hexCharToInt(x[0]) * 256 + hexCharToInt(x[1]) * 16 + hexCharToInt(x[2]); int hexCharToInt(char c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; if (c >= 'A' && c <= 'F') return c - 'A' + 10; return -1; }
I've also posted my raw data from various color samples as attachment. If I get a balancing matrix from a white sample, and apply those coefficients to my readings they still doesn't make any sense.
Any advice would be much appreciated.
Thanks,
[h=3][/h]
Comments
Welcome to the forum!
That code will convert the ColorPAL output to its native 0 -1023 range. If your result is a byte, you will be losing the two msbs. IOW, 95 might well have been 95 + 256 or even 95 + 512.
-Phil
Ah, I see.
Cant believe I've made such an elementary mistake.