title: Convert 2d array to mat3b
body: <p>I have an array of doubles ranging from 0 to 1. I can convert them to a <code>mat1d</code>, but I need a <code>mat3b</code>.</p>
  
  <p>What I have so far is:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>    double snapgrid[132][177];
      //stuff in here to populate snapgrid
      Mat1d image(132, 177);
      memcpy(image.data, snapgrid, 132 * 177 * sizeof(double));
      namedWindow("Display window", WINDOW_AUTOSIZE);
      imshow("Display window", image);
      waitKey(0);
  </code></pre>
  
  <p>This works and shows me the created image. Another function I'm trying to use next requires that image to be a <code>Mat3b</code>. I've tried a few methods of using <code>image.convertTo</code>, but am missing something. Any advice would be great.</p>
  
  <p>edit:
  I got it to not fault out, and I got my black image to improve by multiplying in the <code>convertTo</code>, so I think I'm there.</p>
  
  <p>What I now have is:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>    double snapgrid[132][177];
      //stuff in here to populate snapgrid
      Mat1d image(132, 177);
      Mat colorImage;
      memcpy(image.data, snapgrid, 132 * 177 * sizeof(double));
      image.convertTo(colorImage, CV_32F, 255.);
      cvtColor(colorImage, colorImage, COLOR_GRAY2BGR);
      namedWindow("Display window", WINDOW_AUTOSIZE);
      imshow("Display window", colorImage);
      waitKey(0);
  </code></pre>
  
  <p>My last question with this is: Is this the efficient way, or is this more of a slapped-together mess like I'm afraid it must look?</p>