Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Most efficient way to convert std::vector<cv::mat> to one line cv::Mat?

I have a std::vector<cv::Mat1f> mat, where each element is a row matrix. If you wander why, look here.

The only solution that came to my mind is:

cv::Mat1f final;
for(int i=0; i<mat.rows; i++){
    final.push_back( mat[i].row(0) );
}
    final.reshape(1,1);

Is there any more efficient solution for this?

Most efficient way to convert std::vector<cv::mat> to one line cv::Mat?

I have a std::vector<cv::Mat1f> mat, where each element is a row matrix. If you wander why, look here.

The only solution that came to my mind is:

cv::Mat1f final;
for(int i=0; i<mat.rows; i++){
    final.push_back( mat[i].row(0) );
}
    final.reshape(1,1);

Is there any more efficient solution for this?