Explore Library
Code QuizIntermediate

RGB to Grayscale Conversion

A luminance conversion applies the standard weights to the wrong color channels.

Codepython
import numpy as np

R = img[:, :, 0]
G = img[:, :, 1]
B = img[:, :, 2]

# Convert RGB to grayscale using luminance weights
gray = 0.114 * R + 0.587 * G + 0.299 * B

What is the bug in this grayscale conversion?