title: OpenCV-Android: Import .png preserving transparency of empty areas
body: <p>I am currently trying to transform an input .png file to a OpenCV:Mat, preserving its transparency on empty areas. Working on eclipse, using openCV4Android. </p>
  
  <p>I've tried this (using a Drawable):</p>
  
  <p><strong><em>Inputs:</em></strong></p>
  
  <ul>
  <li>icon.png is a resource file that is correctly loaded as RGBA (4 channels).</li>
  <li><p>Mat mcSprite (global field).</p>
  
  <pre><code>onCameraFrame method{
  try {
      mcSprite = Utils.loadResource(this, R.drawable.icon);
      System.out.println(mcSprite.empty());
  } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  Imgproc.resize(mcSprite, mZoomWindow, mZoomWindow.size());
  }
  </code></pre></li>
  </ul>
  
  <p>The resulting image:</p>
  
  <p><img src="https://i.stack.imgur.com/McnV4.png" alt="Black Zones"></p>
  
  <p><strong><em>PS: If i import using:</em></strong></p>
  
  <p>mcSprite = Utils.loadResource(this, R.drawable.icon , <strong>-1</strong>);</p>
  
  <pre><code>&gt;0 Return a 3-channel color image.
  =0 Return a grayscale image.
  &lt;0 Return the loaded image as is (with alpha channel).
  </code></pre>
  
  <p><em>no image</em> is displayed.</p>