title: How to show the whole image when using OpenCV warpPerspective
body: <p>I have 2 test images here. My is question is, how to map the square in first image to the quadrilateral in the second image without cropping the image.</p>
  
  <p>Image 1:
  <img src="https://i.stack.imgur.com/yfod7.png" alt="image 1"></p>
  
  <p>Image 2:
  <img src="https://i.stack.imgur.com/Fe3Ug.png" alt="image 2"></p>
  
  <p>Here is my current code using openCV warpPerspective function.</p>
  
  <pre><code>import cv2
  import numpy as np
  
  img1_square_corners = np.float32([[253,211], [563,211], [563,519],[253,519]])
  img2_quad_corners = np.float32([[234,197], [520,169], [715,483], [81,472]])
  
  h, mask = cv2.findHomography(img1_square_corners, img2_quad_corners)
  im = cv2.imread("image1.png")
  out = cv2.warpPerspective(im, h, (800,800))
  cv2.imwrite("result.png", out)
  </code></pre>
  
  <p>Result:
  <img src="https://i.stack.imgur.com/ntfYY.png" alt="result"></p>
  
  <p>As you can see, because of dsize=(800,800) parameter in the warpPerspective function, I can't get full view of image 1. If I adjust the dsize, the square won't map properly. Is there any way to resize the output image so that I can get whole picture of image 1?</p>