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
/** @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?
please, NO SCREENSHOTS OF TEXT.
@berak I will keep that in mind.