Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cvtcolor RGB to XYZ

In modules/imgproc/src/color.cpp, line 678:

static const int coeffs0[] =
        {
            1689,    1465,    739,
            871,     2929,    296,
            79,      488,     3892
        };

Could anybody tell me where this matrix comes from?

I guess it was somehow computed from

image description

and

image description

(see http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html)

but how and why?

Thank you for your help.

cvtcolor RGB to XYZ

In modules/imgproc/src/color.cpp, line 678:

static const int coeffs0[] =
        {
            1689,    1465,    739,
            871,     2929,    296,
            79,      488,     3892
        };

Could anybody tell me where this matrix comes from?

I guess it was somehow computed from

image description

and

image description

(see http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html)

but how and why?

Thank you for your help.

Update (posted this as an answer but not allowed because I'm a new member):

OK I hope somebody can have a better answer.

It is actually

image description

(in the code, 16 is defined as the shift)

This is for defining cv::RGB2XYZ_i that will be used in the case the input data are integer ('i' for integer).

I guess the main reason for such a conversion is PRECISION (for cv::RGB2XYZ_f, this conversion is not needed, please refer to the source code for details).

cvtcolor RGB to XYZ

In modules/imgproc/src/color.cpp, line 678:

static const int coeffs0[] =
        {
            1689,    1465,    739,
            871,     2929,    296,
            79,      488,     3892
        };

Could anybody tell me where this matrix comes from?

I guess it was somehow computed from

image description

and

image description

(see http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html)

but how and why?

Thank you for your help.

Update (posted this as an answer but not allowed because I'm a new member):

OK I hope somebody can have a better answer.

It is actually

image description

(in (correction: 2^12 instead of 2^16, sorry. In the code, 16 16 is defined as the shift)

This is for defining cv::RGB2XYZ_i that will be used in the case the input data are integer ('i' for integer).

I guess the main reason for such a conversion is PRECISION (for cv::RGB2XYZ_f, this conversion is not needed, please refer to the source code for details).

cvtcolor RGB to XYZ

In modules/imgproc/src/color.cpp, line 678:

static const int coeffs0[] =
        {
            1689,    1465,    739,
            871,     2929,    296,
            79,      488,     3892
        };

Could anybody tell me where this matrix comes from?

I guess it was somehow computed from

image description

and

image description

(see http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html)

but how and why?

Thank you for your help.

Update (posted this as an answer but not allowed because I'm a new member):

OK I hope somebody can have a better answer.

It is actually

image description

(correction: 2^12 instead of 2^16, sorry. In the code, 1612 is defined as the shift)

This is for defining cv::RGB2XYZ_i that will be used in the case the input data are integer ('i' for integer).

I guess the main reason for such a conversion is PRECISION (for cv::RGB2XYZ_f, this conversion is not needed, please refer to the source code for details).

cvtcolor RGB to XYZ

In modules/imgproc/src/color.cpp, line 678:

static const int coeffs0[] =
        {
            1689,    1465,    739,
            871,     2929,    296,
            79,      488,     3892
        };

Could anybody tell me where this matrix comes from?

I guess it was somehow computed from

image description

and

image description

(see http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html)

but how and why?

Thank you for your help.

Update (posted this as an answer but not allowed because I'm a new member):

OK I hope somebody can have a better answer.

It is actually

image description

(correction: 2^12 instead of 2^16, sorry. In the code, 12 is defined as the shift)

This is for defining cv::RGB2XYZ_i that will be used in the case the input data are integer ('i' for integer).

I guess the main reason for such a conversion is PRECISION (for cv::RGB2XYZ_f, this conversion is not needed, please refer to the source code for details).