I have two Mat:
A:
size(1,640)
B:
size(640,480)
I want to copy A to B's first column so I use A.copyTo(B.col(0))
.But this failed. How to do it?
You were on the right track! Mat:col
is the matching tool to use :)
But beware, simply assigning one col to another one won't work as you may expect it, because Mat:col
just creates a new matrix header for the matrix column you specified and no real copy of the data.
Example code:
B.col( 0 ) = A.col( 0 ); // won't work as expected
A.col( 0 ).copyTo( B.col(0) ); // that's fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With