title: Save bitmap converted to mat on Android
body: <p>I'm testing the consumption of memory ram with openCV. 
  I want to convert a generated bitmap with the method <code>view.getDrawingCache()</code> to mat and save it with the OpenCV <code>imWrite</code> method. Using this result is empty file.</p>
  
  <pre><code>childView.buildDrawingCache();
  mat=new Mat(childView.getMeasuredHeight(),width, CvType.CV_8U);  
  Utils.bitmapToMat(Bitmap.createBitmap(childView.getDrawingCache()),mat);
  MatOfInt matInt=new MatOfInt();
  matInt.fromArray(Imgcodecs.CV_IMWRITE_PNG_COMPRESSION, 0);
  Imgcodecs.imwrite(cacheFile.getPath() + "/" + name + ".png", image, matInt);
  </code></pre>
  
  <p>On the other hand if I save the <code>bitmap</code> in memory of the system and charge it with the <code>imRead()</code> method and save it with <code>imWrite()</code> if that generates the file correctly.</p>
  
  <pre><code>Bitmap bmp=Bitmap.createBitmap(childView.getDrawingCache());
  cacheFile.createNewFile();
  FileOutputStream fos = new FileOutputStream(cacheFile);
  bmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
  fos.flush();
  fos.close();
  
  MatOfInt matInt=new MatOfInt();
  matInt.fromArray(Imgcodecs.CV_IMWRITE_PNG_COMPRESSION, 0);
  Mat mat=Imgcodecs.imread(mapCacheViews.get(getFinalTweetAdapter().getItem(i).id))
  Imgcodecs.imwrite(cacheFile.getPath() + "/" + name + ".png", mat, matInt);
  </code></pre>
  
  <p>If the generated bitmap exits the same in both cases, that the first is not    nothing and the second is saved perfectly? Best regards</p>