Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you want a 3 channel matrix which has the same value everywhere, you need to use a Scalar:

Mat (100, 100, CV_8UC3, Scalar(0,0,0));

or if you use a single channel Mat

Mat (100, 100, CV_8UC1, Scalar(0));

Also, you are questions are mixing stuff up. If you just have 1 single channel, its a grayscale image. So imagine the numbers from 0-255 to be the strength of the color gray. With 0 being black, weakest gray, and 255 being white, the strongest.

If you have 3 channels, its basically the same, just that each channel represents the strength of its respective color (red, green, blue). If all channels, have the same number (like (200, 200, 200)) its also just a grayscale image again.