Ask Your Question
1

Which color matching functions does OpenCV use for its RGB/BGR color space?

asked 2015-09-01 15:53:13 -0600

kbanman gravatar image

I'm using OpenCV 3.0, but my question should be version agnostic. I'm wondering which of the many RGB color space OpenCV uses by default. That is, for images in the default representation, BGR, which RGB space does OpenCV use?

I suspect they are either the CIE 1931 XYZ functions:

CIE XYZ

or the CIE 1931 RGB functions:

CIE RGB


Heads up: this question is mirrored here. I'll make sure any knowledge is shared between them.

edit retag flag offensive close merge delete

Comments

1

For what I know, I would say that the type of RGB spaces doesn't matter as each channel is encoded on [0-255] values. Is it not only when displayed that RGB spaces matters ?

Eduardo gravatar imageEduardo ( 2015-09-02 03:45:05 -0600 )edit
1

Like @Eduardo said, for OpenCV it does not matter. The RGB space used is defined by your camera sensor and sensitivity to each color channel. OpenCV just processed the raw data that it receives.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-09-02 08:37:41 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2018-03-22 11:46:29 -0600

kdbanman gravatar image

@Eduardo and @StevenPuttemans are completely correct! I'll add some details below.

It turns out that color matching functions are a capture device and display device problem. Look at this relevant section of the sRGB wiki page

Due to the standardization of sRGB on the Internet, on computers, and on printers, many low- to medium-end consumer digital cameras and scanners use sRGB as the default (or only available) working color space. As the sRGB gamut meets or exceeds the gamut of a low-end inkjet printer, an sRGB image is often regarded as satisfactory for home use. However, consumer-level CCDs are typically uncalibrated, meaning that even though the image is being labeled as sRGB, one can't conclude that the image is color-accurate sRGB.

OpenCV can be used to convert to and from color spaces or derive color space coordinates with the right math. But OpenCV does not have a "default" set of color matching functions. If your camera captures in space X (say, CIE XYZ) and your display device or printer also displays in space X, then OpenCV can be used to process the data between with no consideration to the spaces. However, if the display device displays in a different space Y (say, Adobe RGB), then OpenCV can be used to translate the image from space X to space Y.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-09-01 15:41:41 -0600

Seen: 1,795 times

Last updated: Sep 01 '15