Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV: append different vectors as one row

I have a cv::Mat1f vector which size is kxd. How can I fill it by appending k different 1xd vectors?

I want to do something like:

    int k = 3, d = 3;
    cv::Mat1f testMat(1,k*d);
    for(int i=0; i<k;i++){
        cv::Mat1f partial(1,d,i);
        testMat.push_back(partial);
    }
    std::cout<<testMat<<std::endl;

Notice that the example above is much simpler that my real case.