Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use push_back

The forum have some related post for how to use push_back. I can use it like

Mat mat = (Mat_<uchar>(2, 4) << 5, 6, 0, 4, 0, 1, 9, 9);
Mat mat2 = (Mat_<uchar>(2, 4) << 5, 77, 0, 4, 2, 3, 9, 6);
//success
mat.push_back(mat2);

But I note there are other two usage when I use F12 to see the definition. Such as

I think it supports vector, but I can not run it

//fail
vector<vector<uchar>> v1 = { { 5, 77, 0, 4 },{ 2, 3, 9, 6 } };
mat.push_back(v1);
//fail
vector<uchar> v2 = { 2, 3, 9, 6 };
mat.push_back(v2);

And another useage

But I cannot succeed to run it

mat.push_back(&mat2);

Can anybody tell me something? What have I missed something?

How to use push_back

The forum have some related post for how to use push_back. I can use it like

Mat mat = (Mat_<uchar>(2, 4) << 5, 6, 0, 4, 0, 1, 9, 9);
Mat mat2 = (Mat_<uchar>(2, 4) << 5, 77, 0, 4, 2, 3, 9, 6);
//success
mat.push_back(mat2);

But I note there are other two usage when I use F12 to see the definition. Such as

I think it supports vector, but I can not run it

//fail
vector<vector<uchar>> v1 = { { 5, 77, 0, 4 },{ 2, 3, 9, 6 } };
mat.push_back(v1);
//fail
vector<uchar> v2 = { 2, 3, 9, 6 };
mat.push_back(v2);

And another useage

But I cannot succeed to run it

//fail
mat.push_back(&mat2);

Can anybody tell me something? What have I missed something?

How to use push_back

Corss post here


The forum have some related post for how to use push_back. I can use it like

Mat mat = (Mat_<uchar>(2, 4) << 5, 6, 0, 4, 0, 1, 9, 9);
Mat mat2 = (Mat_<uchar>(2, 4) << 5, 77, 0, 4, 2, 3, 9, 6);
//success
mat.push_back(mat2);

But I note there are other two usage when I use F12 to see the definition. Such as

I think it supports vector, but I can not run it

//fail
vector<vector<uchar>> v1 = { { 5, 77, 0, 4 },{ 2, 3, 9, 6 } };
mat.push_back(v1);
//fail
vector<uchar> v2 = { 2, 3, 9, 6 };
mat.push_back(v2);

And another useage

But I cannot succeed to run it

//fail
mat.push_back(&mat2);

Can anybody tell me something? What have I missed something?

How to use push_back

Corss post here


The forum have some related post for how to use push_back. push_back. I can use it like

Mat mat = (Mat_<uchar>(2, 4) << 5, 6, 0, 4, 0, 1, 9, 9);
Mat mat2 = (Mat_<uchar>(2, 4) << 5, 77, 0, 4, 2, 3, 9, 6);
//success
mat.push_back(mat2);

But I note there are other two usage when I use F12 to see the definition. Such as

I think it supports vector, but I can not run it

//fail
vector<vector<uchar>> v1 = { { 5, 77, 0, 4 },{ 2, 3, 9, 6 } };
mat.push_back(v1);
//fail
vector<uchar> v2 = { 2, 3, 9, 6 };
mat.push_back(v2);

And another useage

But I cannot succeed to run it

//fail
mat.push_back(&mat2);

Can anybody tell me something? What have I missed something?

How to use push_back

Corss post here


The forum have some related post for how to use push_back. I can use it like

Mat mat = (Mat_<uchar>(2, 4) << 5, 6, 0, 4, 0, 1, 9, 9);
Mat mat2 = (Mat_<uchar>(2, 4) << 5, 77, 0, 4, 2, 3, 9, 6);
//success
mat.push_back(mat2);

But I note there are other two usage when I use F12 to see the definition. Such as

I think it supports push_back a vector into Mat, but I can not run itit normally

//fail
vector<vector<uchar>> v1 = { { 5, 77, 0, 4 },{ 2, 3, 9, 6 } };
mat.push_back(v1);
//fail
vector<uchar> v2 = { 2, 3, 9, 6 };
mat.push_back(v2);

And another useage

But I cannot succeed to run it

//fail
mat.push_back(&mat2);

Can anybody tell me something? What have I missed something?

How to use push_back

Corss post here


The forum have some related post for how to use push_back. I can use it like

Mat mat = (Mat_<uchar>(2, 4) << 5, 6, 0, 4, 0, 1, 9, 9);
Mat mat2 = (Mat_<uchar>(2, 4) << 5, 77, 0, 4, 2, 3, 9, 6);
//success
mat.push_back(mat2);

But I note there are other two usage when I use F12 to see the definition. Such as

I think it supports push_back a vector into Mat, but I can not run it normally

//fail
vector<vector<uchar>> v1 = { { 5, 77, 0, 4 },{ 2, 3, 9, 6 } };
mat.push_back(v1);
//fail
vector<uchar> v2 = { 2, 3, 9, 6 };
mat.push_back(v2);

Can anybody tell me something? What have I missed something?

click to hide/show revision 7
None

updated 2018-04-05 00:09:11 -0600

berak gravatar image

How to use push_back

Corss post here


The forum have some related post for how to use push_back. I can use it like

Mat mat = (Mat_<uchar>(2, 4) << 5, 6, 0, 4, 0, 1, 9, 9);
Mat mat2 = (Mat_<uchar>(2, 4) << 5, 77, 0, 4, 2, 3, 9, 6);
//success
mat.push_back(mat2);

But I note there are other two usage when I use F12 to see the definition. Such as

/** @brief Adds elements to the bottom of the matrix.
The methods add one or more elements to the bottom of the matrix. They emulate the corresponding
method of the STL vector class. When elem is Mat , its type and the number of columns must be the
same as in the container matrix.
@param elem Added element(s).
 */
template<typename _Tp> void push_back(const _Tp& elem);

/** @overload
@param elem Added element(s).
*/
template<typename _Tp> void push_back(const Mat_<_Tp>& elem);

/** @overload
@param elem Added element(s).
*/
template<typename _Tp> void push_back(const std::vector<_Tp>& elem);

/** @overload
@param m Added line(s).
*/
void push_back(const Mat& m);

I think it supports push_back a vector into Mat, but I can not run it normally

//fail
vector<vector<uchar>> v1 = { { 5, 77, 0, 4 },{ 2, 3, 9, 6 } };
mat.push_back(v1);
//fail
vector<uchar> v2 = { 2, 3, 9, 6 };
mat.push_back(v2);

Can anybody tell me something? What have I missed something?