opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
79.4k stars 55.86k forks source link

Color space ambiguities #18813

Open mildsunrise opened 4 years ago

mildsunrise commented 4 years ago

I'm opening this to put all color space-related issues (#15717, #4973, #13066) in one place. The current state of things in the color conversion API is (as far as I know):

kevineor commented 3 years ago

There's a class in the mcc contrib module that permits colorspace conversions (differents RGB colorspaces, and CIE colorspaces, linear or not), but it's not available to the API. May be interesting to expose them ?

hmaarrfk commented 4 months ago

I'm wondering if there would be any appetite for to extend COLOR_BayerBG2GRAY to provide an option to

COLOR_BayerBG2GRAY_BT709

To be specific, this would set the coefficients to be something like: 0.2126, 0.7152, and 0.0722.

My understanding from the code is that the numbers that would have to change

const unsigned G2Y = 9617;
const int R2Y = 4899;
const int B2Y = 1868;

from their values defined by BT.709

const unsigned G2Y = 11717; // 11717.12
const int R2Y = 3483;  // 3483..025
const int B2Y = 1183;  // 11.82.82

We mainly use opencv's implementation since it is much faster than any that we have seen in the wild.

Thank you for consider.

I'm happy to discuss this in a different issue as well.