Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

copy vector of mat to vector of mat

$
0
0
(This is related to [this](http://answers.opencv.org/question/79889/copy-small-part-of-mat-to-another/) ) I have a `vector src` which is filled with data. It's size is `src.resize( N )` I have another vector dest; I am declaring it's size to be `dest.resize( N )` 1) What is the right way to copy src to dest?Just `dest=src`? 2) If I want to copy to dest ,only the 1st row and all columns of src vector, then what size the dest vector should be? dest = src; src[0]( Range(0, 1),Range::all() ).copyTo( dest[0](Range::all(), Range::all() ) ); //for the 1st array of vector If ,for example src is 4x4 , then ,since I want to keep only 1st row and all columns,the dest size should be 1x4. Is there a way to do this ?Using the `src[0]( Range(0, 1),Range::all() ).copyTo( dest[0](Range::all(), Range::all() ) )`? Or,another idea , is to have the dest the same size with src ,but fill all the rest elements with zero for example? =====UPDATE================ I figured this: dest[0] = src[0 ]( Range(0, 1),Range::all() ); for first row and all columns. ( I can't make it an answer yet ,but if there is another way please share )

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>