title: Converting cv::Mat to unsigned int pixels
body: <p>I'm trying to convert cv::Mat to unsigned int buffer image, The conversion is not working, I get a black image</p>
  
  <pre><code>    Mat srcIm, edges;
      srcIm = imread("15016889798859437.jpg");
      cv::cvtColor(srcIm, srcIm, cv::COLOR_BGR2RGB);
      unsigned int *finalSrc = new unsigned int[srcIm.rows*srcIm.cols*3];
  
      unsigned char *input = (unsigned char*)(srcIm.data);
  
          for (int i = 0; i &lt; srcIm.rows; i++) {
              for (int j = 0; j &lt; srcIm.cols; j++) {
                   int r, g, b;
                  r = input[srcIm.step * j + i];
                  g = input[srcIm.step * j + i + 1];
                  b = input[srcIm.step * j + i + 2];
  
                  int rgb = ((r &amp; 0x0ff) &lt;&lt; 16) | ((g &amp; 0x0ff) &lt;&lt; 8) | (b &amp; 0x0ff);
  
                  finalSrc[i+ j*srcIm.rows] = rgb;
              }
          }
  
          cv::Mat videoFrame(srcIm.rows, srcIm.cols, CV_32SC1, finalSrc);
  </code></pre>
  
  <p>UPDATED CODE:</p>
  
  <p>Following the comments, I have solved the mistakes, but still I get white image. </p>
  
  <pre><code>unsigned int *finalSrc = new unsigned int[srcIm.rows*srcIm.cols];
  
      unsigned char *input = (unsigned char*)(srcIm.data);
  
      int cn = srcIm.channels();
  
      for (int i = 0; i &lt; srcIm.rows; i++)
      {
          for (int j = 0; j &lt; srcIm.cols; j++)
          {
              int r, g, b;
  
              r = input[(i * srcIm.cols * srcIm.channels()) + (j*srcIm.channels()) + 0];
              g = input[(i * srcIm.cols * srcIm.channels()) + (j*srcIm.channels()) + 1];
              b = input[(i * srcIm.cols * srcIm.channels()) + (j*srcIm.channels()) + 2];
  
              int rgb = ((r &amp; 0x0ff) &lt;&lt; 16) | ((g &amp; 0x0ff) &lt;&lt; 8) | (b &amp; 0x0ff);
  
          }
      }
  
      cv::Mat videoFrame(srcIm.rows, srcIm.cols, CV_32S, finalSrc);
  
  
      imshow("v", videoFrame);
  </code></pre>