How to add row using cv::Mat push_back() [closed]

asked 2018-03-27 14:16:05 -0500

waschbaer gravatar image

I find a code as below:

cv::Mat m = cv::Mat::ones(4, 3, CV_64F);    // 3 cols, 4 rows
cv::Mat row = cv::Mat::ones(1, 3, CV_64F);  // 3 cols
m.push_back(row);

But I wondering do I have to explicit do the init for size and type before push_back? Thank you.

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by waschbaer
close date 2018-03-27 14:22:09.267180

Comments

m size is now 5 rows and 3 columns : you can use a debuuger

or :

m.push_back(row);
cout <<m.rows<<" "<<m.cols<<"\n";
LBerger gravatar imageLBerger ( 2018-03-27 14:19:09 -0500 )edit