Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Mat to vector

I am trying to copy elements from a Mat to a vector. I tried the below method, but the vector has weird values which I am sure are actually the memory values.

                vector<int> vec;
                Mat v = preds[n];
                vec.assign(v.begin<int>(), v.end<int>());
                //cout<<v<<"\n";
                cout<<vec[k]<<"\n";

I also tried at but that doesn't return anything.