title: Determine angle of rotation for a skewed 2D image
body: <p>I am trying to determine the angle of rotation required to fix the skew seen in a 2D image. I have a camera that is looking at a QR code taped to a wall. I am trying to find out how the camera should rotate left and right so that the camera is facing the qr code straight on.</p>
  
  <p>Assuming the y axis is the axis running up and down and x axis is left to right, if my camera is to the left of the qr code, then my code should instruct the camera to rotate around the y axis by a certain number of degrees so that it ends up facing the qr code straight on. I have the coordinates of the four corners of the qr code. I also know that the camera is sitting to the left of the qr code since the vertical qr code side closest to the camera is longer than the opposite vertical side (i.e. the qr code is skewed in the image being processed). </p>
  
  <p>I don't know how to find the angle though. Any help is appreciated! Image below shows qr code, and it's bounding box (x,y) points. </p>
  
  <p><a href="https://i.stack.imgur.com/TkNm4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TkNm4.png" alt="enter image description here"></a></p>