Home > OS >  How OpenCV convert image to grayscale?
How OpenCV convert image to grayscale?

Time:03-21

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?

CodePudding user response:

RGB[A] to Gray:Y←0.299⋅R 0.587⋅G 0.114⋅B

Source: docs.opencv.org.

CodePudding user response:

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/

  • Related