title: Warping Perspective using arbitary rotation angle
body: <p>I have an image of a chessboard taken at some angle. Now I want to warp perspective so the chessboard image look again as if was taken directly from above. </p>
  
  <p>I know that I can try to use 'findHomography' between matched points but I wanted to avoid it and use e.g. rotation data from mobile sensors to build homography matrix on my own. I calibrated my camera to get intrinsic parameters. Then lets say the following image has been taken at ~60degrees angle around x-axis. I thought that all I have to do is to multiply camera matrix with rotation matrix to obtain homography matrix. I tried to use the following code but looks like I'm not understanding something correctly because it doesn't work as expected (result image completely black or white.</p>
  
  <p><img src="https://i.stack.imgur.com/tcZcS.jpg" alt="enter image description here"></p>
  
  <pre><code>import cv2
  import numpy as np
  import math 
  
  
  
  camera_matrix = np.array([[ 5.7415988502105745e+02, 0., 2.3986181527877352e+02],
                             [0., 5.7473682183375217e+02, 3.1723734404756237e+02], 
                             [0., 0., 1.]])
  
  distortion_coefficients = np.array([ 1.8662919398453856e-01, -7.9649812697463640e-01,
     1.8178068172317731e-03, -2.4296638847737923e-03,
     7.0519002388825025e-01 ])
  
  theta = math.radians(60)
  
  rotx = np.array([[1, 0, 0],
                 [0, math.cos(theta), -math.sin(theta)],
                 [0, math.sin(theta), math.cos(theta)]])   
  
  
  
  homography = np.dot(camera_matrix, rotx)
  
  
  im = cv2.imread('data/chess1.jpg')
  gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
  
  im_warped = cv2.warpPerspective(gray, homography, (480, 640), flags=cv2.WARP_INVERSE_MAP)
  cv2.imshow('image', im_warped)
  cv2.waitKey()
  pass
  </code></pre>
  
  <p>I also have distortion_coefficients after calibration. How can those be incorporated into the code to improve results?</p>