I am using OpenCV for the color correction process. The problem is that after the color correction, the output range is, for example, 0-800 (0-255 is valid for the 8-bit image), and some normalization is needed. Clipping the data above 255 is wrong because a lot of the information would be lost. Another option (as far as I know) is to use MINMAX normalization, but the question is whether it should be done before or after Gamma correction. For the standard y=x^gamma, it doesn't matter, but from the inspection of the OpenCV code, I found that there is something more than the formula above
double sRGBBase_::fromLFuncEW(double& x)
{
if (x > beta)
{
return alpha * pow(x, 1 / gamma) - (alpha - 1);
}
else if (x >= -beta)
{
return x * phi;
}
else
{
return -(alpha * pow(-x, 1 / gamma) - (alpha - 1));
}
}
So my questions are:
- What is the correct process to normalize the color correction output to the range 0-255?
- If the correct process is MINMAX normalization, should it be run before or after Gamma correction?
- Should I use Gamma correction from the OpenCV or standard
y=x^2.2?
Thanks in advance