Ask Your Question

cvtcolor RGB to XYZ

asked 2013-04-09 04:55:10 -0500

Nesbit gravatar image

updated 2020-11-07 03:02:01 -0500

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


image description


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).

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-04-09 05:44:08 -0500

I guess people do not know the basic search option in google anymore:

Basically, CIE XYZ is another color system compared to RGB. In order to transform an existing image from RGB to XYZ color system, you need to perform operations on the coëfficients of each color channel. Combining all these operations results in a operation matrix.

edit flag offensive delete link more



You misunderstood the question. Please read carefully any questions before answering.

Nesbit gravatar imageNesbit ( 2013-04-09 08:01:00 -0500 )edit

My apologies :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-09 08:19:45 -0500 )edit

Question Tools


Asked: 2013-04-09 04:55:10 -0500

Seen: 2,370 times

Last updated: Apr 09 '13