NeoPixelBus
NeoPixelBus copied to clipboard
Add sRGB support and white calibration table.
Please add support for sRGB color space (classical table with x^2.2 pwm values) and white color calibration table to compensate different color intensities on chep cinese rgb strip.
Please provide more details.
What color problem are you seeing? Do you have pointers to discussions on the issue? Or are you just talking about gamma correction that is already supported?
OK what you call gamma correction is like sRGB support , i see your formula.
About white balance i didn't found anything , my strip are more blue (but i think is normal on cheap strip because red led is little shifted on orange). You can call white balance or Color temperature, if you like, and is a fixed correction in ratio between the three channels.
This is going to be specific to run of leds, so without the leds and without a color balance sensor I can't build a table/formula to correct it.
It would work similar to the gamma, but a seperate entry for channel.
White balance is a simple multiply constant applied to three channels to change relative weights, it's the user that needed to change or set it and it's the user that need the color balance sensor (or a very good eye)!
You are assuming the relative balance is the same linearly across all brightness's of each sub LED element (R, G, B); but you can't assume this.
PWM is on-off tecnology and intrinsecally time linear if switch on-off(in nanoseconds range for LED's) delay is neglegible , so Yes it's linear in our application.
Any news? :)
I have yet to come up with a solution that makes sense for me to implement versus the user to just do the work. A solution has to be no less understandable and no less complex in its use that a purely user supplied code.
Here is an example, this handles a static ratio across all levels, where the correction value of 255 in a channel means no change, and lower values means to lower the brightness.
class NeoColorBalance
{
public:
NeoColorBalance(RgbColor correction) :
_correction(correction)
{
}
RgbColor Correct(const RgbColor& original)
{
return RgbColor(original.R * _correction.R / 255,
original.G * _correction.G / 255,
original.B * _correction.B / 255);
}
private:
RgbColor _correction;
};
Now to support a table (modifications per level), then the user has to provide the equation or table, so they need to implement a class similar to the NeoGammaEquationMethod or NeoGammaTableMethod; but they could just call that class that they implement rather than some simple layering class and its less complex.
See NeoGammaDynamicTableMethod, allows the runtime creation of a table that matches an equation provided by the user.