title: openCV look up table for 16CU1
body: <p>I need to replace the value of a Mat 8UC1 [0,255] to values of a cv::Mat lookUpTable(1, 256, CV_16UC1); I check un this OpenCV <a href="http://docs.opencv.org/2.4/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html#the-core-function" rel="nofollow noreferrer">tutorial</a> an explanation which is the fastest method, however,  when Im checking the assigned values of the LUT in each position im only sabing 8-bits so Im lossing the other 8-bits. This is the source code:</p>
  <pre><code>  unsigned short int zDTableHexa[256]={0};
    .... get the values...
    cv::Mat lookUpTable(1, 256, CV_16UC1);
    uchar* p = lookUpTable.data;
    for( int i = 0; i &lt; 256; i++){
        p[i] = zDTableHexa[i];
        cout&lt;&lt;(int)p[i]&lt;&lt;&quot;:&quot;&lt;&lt;zDTableHexa[i]&lt;&lt;sizeof(p[i])&lt;&lt;&quot;:&quot;&lt;&lt;sizeof(zDTableHexa[i])&lt;&lt;endl;
    }
  </code></pre>
  <p>The printing result are:</p>
  <blockquote>
  <p>104:872<br />
  101:869<br />
  97:865<br />
  93:861<br />
  90:858<br />
  86:854<br />
  83:851<br />
  80:848<br />
  76:844<br />
  73:841<br />
  70:838<br />
  66:834<br />
  63:831</p>
  </blockquote>
  <p>When I check in binary is only the first 8-bits.
  I understand that the pointer is UCHAR(8bits) but how I can assign the full value?</p>