added an ability to make push_back to the empty matrix
This commit is contained in:
parent
3a1beb1c01
commit
0d7a37c1e7
modules/core
@ -675,7 +675,12 @@ template<typename _Tp, int m, int n> inline Mat::operator Matx<_Tp, m, n>() cons
|
|||||||
|
|
||||||
template<typename _Tp> inline void Mat::push_back(const _Tp& elem)
|
template<typename _Tp> inline void Mat::push_back(const _Tp& elem)
|
||||||
{
|
{
|
||||||
CV_Assert(DataType<_Tp>::type == type() && cols == 1
|
if( !data )
|
||||||
|
{
|
||||||
|
*this = Mat(1, 1, DataType<_Tp>::type, (void*)&elem).clone();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CV_Assert(DataType<_Tp>::type == type() && cols == 1
|
||||||
/* && dims == 2 (cols == 1 implies dims == 2) */);
|
/* && dims == 2 (cols == 1 implies dims == 2) */);
|
||||||
uchar* tmp = dataend + step[0];
|
uchar* tmp = dataend + step[0];
|
||||||
if( !isSubmatrix() && isContinuous() && tmp <= datalimit )
|
if( !isSubmatrix() && isContinuous() && tmp <= datalimit )
|
||||||
|
@ -585,6 +585,11 @@ void Mat::push_back(const Mat& elems)
|
|||||||
push_back(tmp);
|
push_back(tmp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if( !data )
|
||||||
|
{
|
||||||
|
*this = elems.clone();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
size.p[0] = elems.size.p[0];
|
size.p[0] = elems.size.p[0];
|
||||||
bool eq = size == elems.size;
|
bool eq = size == elems.size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user