Here we can take a look at the basic structures of OpenCV. My question is what exactly is the scalar data type and when do I use it.
Here you can see its definition:
template<typename _Tp> class CV_EXPORTS Scalar_ : public Vec<_Tp, 4>
{
public:
Scalar_();
Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
Scalar_(const CvScalar& s);
Scalar_(_Tp v0);
static Scalar_<_Tp> all(_Tp v0);
operator CvScalar() const;
template<typename T2> operator Scalar_<T2>() const;
Scalar_<_Tp> mul(const Scalar_<_Tp>& t, double scale=1 ) const;
Scalar_<_Tp> conj() const;
bool isReal() const;
};
typedef Scalar_<double> Scalar;
Here you can see an example of how they use it.
Mat M(7,7,CV_32FC2,Scalar(1,3));
M.create(100,60,CV_8UC(15));
So my question is: why can't I use double
in this case? Or arrays?
Thank you in advance
source
share