[Solved] How to convert RGB to grayscale by using color dimensions [closed]

The converting function that you are referring to does the same – it weights the R,G and B channel values of each pixel, and takes the sum. Since OpenCV uses the BGR colorspace on reading images, your conversion function will be something like this- def rgbToGray(img): grayImg = 0.0722*img(:,:,1) + 0.7152*img(:,:,2) + 0.2126*img(:,:,3) return grayImg … Read more