c++ - openCV look up table for 16CU1 -


i need replace value of mat 8uc1 [0,255] values of cv::mat lookuptable(1, 256, cv_16uc1); check un opencv tutorial explanation fastest method, however, when im checking assigned values of lut in each position im sabing 8-bits im lossing other 8-bits. source code:

  unsigned short int zdtablehexa[256]={0};   .... values...   cv::mat lookuptable(1, 256, cv_16uc1);   uchar* p = lookuptable.data;   for( int = 0; < 256; i++){       p[i] = zdtablehexa[i];       cout<<(int)p[i]<<":"<<zdtablehexa[i]<<sizeof(p[i])<<":"<<sizeof(zdtablehexa[i])<<endl;   } 

the printing result are:

104:872
101:869
97:865
93:861
90:858
86:854
83:851
80:848
76:844
73:841
70:838
66:834
63:831

when check in binary first 8-bits. understand pointer uchar(8bits) how can assign full value?

try

unsigned short* p = (unsigned short*) lookuptable.data; 

Comments