I know that in python (with opencv) an image is encoded with a matrix of integers.
If the image is black and white all information is inside a matrix HeightxWidth, where the int in position (i,j) gives the nuance of gray of the (i,j) th pixel.
When the image is colored, the colors are decomposed in three coordinates in the space of colors, hence all information is stored in a matrix HeightxWidthx3, because each pixel need 3 coordinate.
My question is how to convert given black-white image in BGR format, that is the format mainly used by opencv.
Thank you
Francesco