I have a picture(RGB) and i wanna adjust color temperature, like in Lightroom. I try converting RGB to LAB and adjust B channel, but it's wrong. May be someone can help with sample code or algorithm of color temperature implementation? Like this:
rgb temperature(int temp, rgb color);
where value - temperature, color - input color (from image), return value - output color (adjusted)
Now, I use this algorithm. RGBtoLAB and LABtoRGB I took from: http://www.easyrgb.com/index.php?X=MATH&H=01#text1
for (int i = 0; i < img.pixCount; i++)
{
lab32f lab = RGBtoLAB(img.getPixel(i));
lab.b += temp.value; // -100..100
img.setPixel(i, LABtoRGB(lab));
}
Result images: