title: How can I convert Mat to Bitmap using OpenCVSharp?
body: <p>First, I tried this,</p>
  
  <pre><code>    public static Bitmap MatToBitmap(Mat mat)
      {
          return OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/xbY1M.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xbY1M.png" alt="enter image description here"></a></p>
  
  <p>So, then, I tried this,</p>
  
  <pre><code>    public static Bitmap MatToBitmap(Mat mat)
      {
          mat.ConvertTo(mat, MatType.CV_8U);
          return OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
      }
  </code></pre>
  
  <p>The image is completely black,</p>
  
  <p><a href="https://i.stack.imgur.com/whFAL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/whFAL.png" alt="enter image description here"></a></p>
  
  <pre><code>    public static Bitmap ConvertMatToBitmap(Mat matToConvert) 
      {            
          return new Bitmap(matToConvert.Cols, matToConvert.Rows, 4*matToConvert.Rows, System.Drawing.Imaging.PixelFormat.Format8bppIndexed, matToConvert.Data);
      }
  </code></pre>
  
  <p>This doesn't work either.</p>
  
  <p><a href="https://i.stack.imgur.com/vd5bt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vd5bt.png" alt="enter image description here"></a></p>