diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp index 813c69fccc..fe76dedaa3 100644 --- a/modules/core/include/opencv2/core/core.hpp +++ b/modules/core/include/opencv2/core/core.hpp @@ -1069,8 +1069,9 @@ template class CV_EXPORTS MatOp_T_; typedef MatExpr_ >, Mat> MatExpr_Initializer; -template class MatIterator_; -template class MatConstIterator_; +template class CV_EXPORTS MatIterator_; +template class CV_EXPORTS MatConstIterator_; +template class CV_EXPORTS MatCommaInitializer_; enum { MAGIC_MASK=0xFFFF0000, TYPE_MASK=0x00000FFF, DEPTH_MASK=7 }; @@ -1327,6 +1328,8 @@ public: template explicit Mat(const Point_<_Tp>& pt); //! builds matrix from a 3D point template explicit Mat(const Point3_<_Tp>& pt); + //! builds matrix from comma initializer + template explicit Mat(const MatCommaInitializer_<_Tp>& commaInitializer); //! helper constructor to compile matrix expressions Mat(const MatExpr_Base& expr); //! destructor - calls release() @@ -2116,6 +2119,7 @@ public: template explicit Mat_(const Vec<_Tp, n>& vec); explicit Mat_(const Point_<_Tp>& pt); explicit Mat_(const Point3_<_Tp>& pt); + explicit Mat_(const MatCommaInitializer_<_Tp>& commaInitializer); Mat_& operator = (const Mat& m); Mat_& operator = (const Mat_& m); @@ -2349,7 +2353,7 @@ public: //! the operator that takes the next value and put it to the matrix template MatCommaInitializer_<_Tp>& operator , (T2 v); //! the conversion operator - operator Mat_<_Tp>() const; + //operator Mat_<_Tp>() const; //! another form of conversion operator Mat_<_Tp> operator *() const; void assignTo(Mat& m, int type=-1) const; diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp index efa0a34894..8691ab4722 100644 --- a/modules/core/include/opencv2/core/mat.hpp +++ b/modules/core/include/opencv2/core/mat.hpp @@ -262,7 +262,14 @@ template inline Mat::Mat(const Point3_<_Tp>& pt) ((_Tp*)data)[1] = pt.y; ((_Tp*)data)[2] = pt.z; } - + +template inline Mat::Mat(const MatCommaInitializer_<_Tp>& commaInitializer) + : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), + rows(0), cols(0), step(0), data(0), refcount(0), + datastart(0), dataend(0) +{ + *this = *commaInitializer; +} inline Mat::~Mat() { @@ -637,6 +644,12 @@ template inline Mat_<_Tp>::Mat_(const Point3_<_Tp>& pt) } +template inline Mat_<_Tp>::Mat_(const MatCommaInitializer_<_Tp>& commaInitializer) +: Mat(commaInitializer) +{ +} + + template inline Mat_<_Tp>::Mat_(const vector<_Tp>& vec, bool copyData) : Mat(vec, copyData) {} @@ -3707,12 +3720,6 @@ MatCommaInitializer_<_Tp>::operator , (T2 v) return *this; } -template inline MatCommaInitializer_<_Tp>::operator Mat_<_Tp>() const -{ - CV_DbgAssert( this->e.a1 == this->e.a1.m->end() ); - return *this->e.a1.m; -} - template inline Mat_<_Tp> MatCommaInitializer_<_Tp>::operator *() const { CV_DbgAssert( this->e.a1 == this->e.a1.m->end() );