title: How to get a mask of the pixels that were warped "from no where" in cv2.warp methods?
body: <p>This code warps my images fine</p>
  
  <pre><code>    kp1, des1 = self._detector.detectAndCompute(static, None)
      kp2, des2 = self._detector.detectAndCompute(moving, None)
      matches = self._matcher.match(des1, des2)
  
      assert len(matches) &gt;= 4  # for perspective tform
      moving_pts = np.float32([kp1[m.queryIdx].pt for m in matches]).reshape(-1, 1, 2)
      static_pts = np.float32([kp2[m.trainIdx].pt for m in matches]).reshape(-1, 1, 2)
      tform, mask = cv2.findHomography(moving_pts, static_pts, cv2.RANSAC, 5.0)
      tform = self._force_translation_only(tform)
      matches_mask = mask.ravel().tolist()
  
      matches_image = cv2.drawMatches(static, kp1, moving, kp2, matches, None,
                                      flags=cv2.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS,
                                      matchesMask=matches_mask,
                                      matchColor=(0, 255, 0),)
  
      warped = cv2.warpPerspective(moving, tform, (static.shape[1], static.shape[0]), flags=cv2.WARP_INVERSE_MAP)
  </code></pre>
  
  <p>and yields the following</p>
  
  <p><a href="https://i.stack.imgur.com/vbJov.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vbJov.png" alt="warped"></a></p>
  
  <p>I would like a mask of the non black part, and of course doing <code>warped&gt;0</code> is not good enough, as it would not capture truly black data pixels.</p>
  
  <p>I'm sure there is a correct way to do this.</p>