Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Scalar is a typedef for Scalar_<double>, which inherits from template<class _Tp> Vec<4,_Tp> ...

lol, now seriously: think of it as a Vec with variable size(up to 4 values), there can be Scalar(0), Scala(3,3,3), or Scalar(31,12,3,14);

it's mostly used to pass Color values, ranges, or similar in opencv

in your example above, a 2x2 rgb Mat is created and all pixels are set to Scalar(0,0,255) (blue)

Scalar is a typedef for Scalar_<double>, which inherits from template<class _Tp> Vec<4,_Tp> ...

lol, now seriously: think of it as a Vec with variable size(up to 4 values), there can be Scalar(0), Scala(3,3,3), or Scalar(31,12,3,14);

it's mostly used to pass Color values, ranges, or similar in opencv

in your example above, a 2x2 rgb Mat is created and all pixels are set to Scalar(0,0,255) (blue)