We are using HEX values to drive the neopixels using setPixelColor() and we're noticing some large discrepancies between what we see on our screen to what the strip produces. For example, we are using aRGB (255,255,225,53) hex #ffe135 which is a banana yellow, but the strip produces a color closer to white with subtle hues of red.
We are using a global setBrightness and never changing brightness so it's non-destructive in that manner.
Is it a byproduct of using LED's to simulate color? I was expecting them to be closer than they currently are. The example image is hard to capture, but the middle is the color we see on our monitor/phone, the others are crude pictures in total darkness against a white paper. Cheers.
Large color disparity between lcd and neopixel strip
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 11
- Joined: Tue Mar 25, 2014 12:57 am
Large color disparity between lcd and neopixel strip
- Attachments
-
- neopixel_example.jpg (228.13 KiB) Viewed 287 times
-
- Posts: 11
- Joined: Tue Mar 25, 2014 12:57 am
Re: Large color disparity between lcd and neopixel strip
I forgot to mention that full RED, YELLOW, and BLUE look great. It's the in between, especially with yellows, that look really off. We also debugged the color conversion that is happening and the RGB to HEX is correct.
-
- Posts: 11
- Joined: Tue Mar 25, 2014 12:57 am
Re: Large color disparity between lcd and neopixel strip
Solved! We ended up using a look up table and it seems to have fixed the color issues we were having. Banana yellow now appears to be banana yellow! WOOHOO!
The lut was found on this forum post: http://forums.adafruit.com/viewtopic.php?f=47&t=26591
I've posted the code we used below:
protected int[] GAMMA_TABLE = new int[] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7,
7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11,
11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16,
16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22,
23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30,
30, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39,
40, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 49, 50,
50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 61, 62,
62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99,100,101,102,104,105,106,107,108,
109,110,111,113,114,115,116,117,118,120,121,122,123,125,126,127
};
Color col = new Color();
col.R = (byte)GAMMA_TABLE[(int)color.Color.R];
col.G = (byte)GAMMA_TABLE[(int)color.Color.G];
col.B = (byte)GAMMA_TABLE[(int)color.Color.B];
The lut was found on this forum post: http://forums.adafruit.com/viewtopic.php?f=47&t=26591
I've posted the code we used below:
protected int[] GAMMA_TABLE = new int[] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7,
7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11,
11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16,
16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22,
23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30,
30, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39,
40, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 49, 50,
50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 61, 62,
62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99,100,101,102,104,105,106,107,108,
109,110,111,113,114,115,116,117,118,120,121,122,123,125,126,127
};
Color col = new Color();
col.R = (byte)GAMMA_TABLE[(int)color.Color.R];
col.G = (byte)GAMMA_TABLE[(int)color.Color.G];
col.B = (byte)GAMMA_TABLE[(int)color.Color.B];
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Large color disparity between lcd and neopixel strip
Ah, glad you could preemptively fix it.
Since that gamma table is for the LPD8806 strip, the max brightness is 127. If it'll help, here's a table that supports the full brightness range of the NeoPixel strip:
Since the table is in PROGMEM, you need to use pgm_read_byte() to fetch elements, e.g.:
Where 'foo' is the original (un-corrected) brightness (0-255) and 'bar' is the gamma-corrected result (also 0-255).
Since that gamma table is for the LPD8806 strip, the max brightness is 127. If it'll help, here's a table that supports the full brightness range of the NeoPixel strip:
Code: Select all
uint8_t gamma[] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
90, 92, 93, 95, 96, 98, 99,101,102,104,105,107,109,110,112,114,
115,117,119,120,122,124,126,127,129,131,133,135,137,138,140,142,
144,146,148,150,152,154,156,158,160,162,164,167,169,171,173,175,
177,180,182,184,186,189,191,193,196,198,200,203,205,208,210,213,
215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255 };
Code: Select all
bar = pgm_read_byte(&gamma[foo]);
Please be positive and constructive with your questions and comments.