title: OpenCV keep background transparent during warpAffine
body: <p>I create a Bird-View-Image with the warpPerspective()-function like this:</p>
  
  <pre><code>warpPerspective(frame, result, H, result.size(), CV_WARP_INVERSE_MAP, BORDER_TRANSPARENT);
  </code></pre>
  
  <p>The result looks very good and also the border is transparent:
  <a href="https://i.imgur.com/gTMhcvb.jpg" rel="nofollow noreferrer">Bird-View-Image</a></p>
  
  <p>Now I want to put this image on top of another image "out". I try doing this with the function warpAffine like this:</p>
  
  <pre><code>warpAffine(result, out, M, out.size(), CV_INTER_LINEAR, BORDER_TRANSPARENT);
  </code></pre>
  
  <p>I also converted "out" to a four channel image with alpha channel according to a question which was already asked on stackoverflow:
  <a href="https://stackoverflow.com/questions/17480682/create-a-warped-image-with-transparent-border">Convert Image</a></p>
  
  <p>This is the code: <code>cvtColor(out, out, CV_BGR2BGRA);</code></p>
  
  <p>I expected to see the chessboard but not the gray background. But in fact, my result looks like this:</p>
  
  <p><a href="https://i.imgur.com/NMCdFEV.jpg" rel="nofollow noreferrer">Result Image</a></p>
  
  <p>What am I doing wrong? Do I forget something to do? Is there another way to solve my problem? Any help is appreciated :)</p>
  
  <p>Thanks!</p>
  
  <p>Best regards
  DamBedEi</p>