Search code examples
opencvgrayscale

How OpenCV convert image to grayscale?


I converted an image to grayscale, and then I wondered that was going on inside. I found 2 ways how it could be, but what is really going on inside? 2 ways:

Average the channels

This method involves taking the arithmetic average of the pixel values.

Сhannel-dependent luminance perception

It is more biological way. It involves the use of

0.2126 * R-value + 0.7152 * G-value + 0.0752 * B-value.

The method is based on the presence of cones in people`s eyes.

Source: www.kdnuggets.com.

But what is the OpenCV using for grayscale?


Solution

  • There are many ITU-R standards that define color conversions. OpenCV uses BT.709 and your formula is BT.601. For more check here https://mymusing.co/bt601-yuv-to-rgb-conversion-color/