title: create a warped image with transparent border
body: <p>I am trying to create a warped image where the border padding pixels are transparent. I know I can use the BORDER_CONSTANT = BORDER_TRANSPARENT. But this works by:</p>
  
  <blockquote>
    <p>In addition, it provides the method BORDER_TRANSPARENT . This means
    that the corresponding pixels in the destination image will not be
    modified at all. <a href="http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html?highlight=border_transparent" rel="nofollow">openCV manual</a></p>
  </blockquote>
  
  <p>So to make border pixels transparent, do I need to start with a transparent image. Like this example:</p>
  
  <pre><code>int cols;       // filled
  int rows;       // filled
  Mat myImage;    // filled
  Mat warpMatrix (3, 4, CV_32FC1); // filled
  
  Mat myWarpedImage;
  myWarpedImage.create((cols, rows, CV_8UC4, Scalar(0,0,0,0)); // set all pixels to black, alpha = 0
  
  warpPerspective(myImage, myWarpedImage, warpMatrix, Size(cols, rows), WARP_INVERSE_MAP, BORDER_TRANSPARENT);
  </code></pre>
  
  <p>This doesn't seem to work. My warped image still has black background with no transparency (when I check it some photo editing software like GIMP).</p>