Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::Scalar can store a maximum of 4 channels, each containing a double-precision floating point value.

https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L630-L657

It does not remember how many channels it was initialized with. It will always be 4 channels.

A default-constructed Scalar is already initialized with all-zeroes. This is because it has a user-defined constructor that does not require any arguments, and its body does exactly what you'd expect. Code:

https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L2063-L2067