Ask Your Question

alexander334's profile - activity

2017-01-05 08:32:06 -0500 answered a question RGB vs. BGR

You need to use BGR2GRAY unless you are sure that the image you are processing is in RGB format (usually OpenCV stores images in BGR format). The fomula for calculating grayscale which OpenCV uses assigns different weights to blue and red pixels. It is as follows (see the [[http://docs.opencv.org/master/de/d25/imgproc_color_conversions.html#color_convert_rgb_gray documentation]]:

Gray = 0.299 * Red + 0.587 * Green + 0.114 * Blue

Thus if you use RGB2GRAY on a BGR picture you will get the wrong grayscale values.