Mat::push_back
Adds elements to the bottom of the matrix.
C++: template<typename T> void Mat::push_back(const T& elem)
C++: void Mat::push_back(const Mat& m)
Parameters:
- elem – Added element(s).
- m – Added line(s).
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.
在为mat增加一行的时候,用到push_back。首先用vector存要加的数据,用push_back加入,编译没有问题,运行时抛出sigsegv错误。
我理解按照上述push_back的定义,他是可以接受vector的参数,并且由于编译没有问题,也更加使我相信这一点。可惜!
最后使用方法:先创建一个Mat(1, 16, CV_64F), 利用at()函数为其赋值。最后使用push_back加入。
Mat temp(1, 16, CV_64F);;
for (int j = 0; j < 10; j++)
{
temp.at<double>(0, j-1) = j;
}
origin.push_back(temp);