I tried
ColorConvert[img, "Grayscale"]
to convert the RGB to Graylevel. I am wondering the detailed calculation by mathematica..
Gray level= square(R^2+G^2+B^2)?
or something else?
I tried
ColorConvert[img, "Grayscale"]
to convert the RGB to Graylevel. I am wondering the detailed calculation by mathematica..
Gray level= square(R^2+G^2+B^2)?
or something else?
We can obtain the exact values used by mathematica by making up a 3 pixel image with pure red,green,blue and converting it:
Note these are the "Rec. 601 luna coefficients" per http://en.wikipedia.org/wiki/Luma_%28video%29
Test this on a real image:
See How can I convert colors to grayscale? for insight into how the calculation might be being done.
The two images produced by the commands below are a close match, but you could figure out the exact scaling vector with a short program making multiple comparisons. A further test on a different image would ascertain whether
ColorConvert
uses the same vector all the time, or whether the image is analysed before conversion for an optimal grayscale appearance.