哆啦的时光机
class Scalar_Template class for a 4-element vector derived from Vec.template<typename _Tp> class CV_EXPORTS Scalar_ : public Vec<_Tp, 4>{public://! various constructorsScalar_();Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);Scalar_(const CvScalar& s);Scalar_(_Tp v0);//! returns a scalar with all elements set to v0static Scalar_<_Tp> all(_Tp v0);//! conversion to the old-style CvScalaroperator CvScalar() const;//! conversion to another data typetemplate<typename T2> operator Scalar_<T2>() const;//! per-element productScalar_<_Tp> mul(const Scalar_<_Tp>& t, double scale=1 ) const;// returns (v0, -v1, -v2, -v3)Scalar_<_Tp> conj() const;// returns true iff v1 == v2 == v3 == 0bool isReal() const;};typedef Scalar_<double> Scalar;Being derived from Vec<_Tp, 4> , Scalar_ and Scalar can be used just as typical 4-element vectors. In addition, they can be converted to/from CvScalar . The type Scalar is widely used in OpenCV to pass pixel values.