Mat array[20] to unsigned short array

asked 2019-07-22 04:11:24 -0600

ymw gravatar image

updated 2019-07-22 04:14:34 -0600

hi, I am using following method to convert image pixel values to unsigned short array.

//////////////////
unsigned short *yc_in;

yc_in=( unsigned short *)malloc(442368*sizeof( unsigned short));

if (!yc_in  ) {
              free(yc_in);
         }

Mat gimg(576,768,CV_16UC1,yc_in);  
image.convertTo(gimg,CV_16UC1);
/////////////////////////////////////

how can I do the same thing with array of image efficiently. for example image[20]. ??? (I cannot use vector operations)

edit retag flag offensive close merge delete