Ask Your Question
1

cvtcolor RGB to XYZ

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

Nesbit gravatar image

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

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

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

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

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

http://en.wikipedia.org/wiki/CIE_1931_color_space

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

Comments

1

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

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

My apologies :)

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

Question Tools

Stats

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

Seen: 2,991 times

Last updated: Apr 09 '13