Monday, 26 August 2013

How to copy elements of 2D matrix to 1D array vertically using c++

How to copy elements of 2D matrix to 1D array vertically using c++ References I have a 2D matrix and I want to copy its values to a 1D array vertically in an efficient way as the following way. Matrice(3x3) [1 2 3; 4 5 6; 7 8 9] myarray: {1,4,7,2,5,8,3,6,9} Brute force takes 0.25 sec for 1000x750x3 image. I dont want to use vector because I give myarray to another function(I didnt write this function) as input. So, is there a c++ or opencv function that I can use? Note that, I\'m using opencv library. Copying matrix to array is also fine, I can first take the transpose of the Mat, then I will copy it to array.

No comments:

Post a Comment