title: How to calculate Angle of a square object with respect to image in 2D plane using camera?
body: <p>I have captured an image using a webcam, attached upside-down above a table horizontally. On the table, I have a square object or piece of card. I have successfully detected the object and found its center coordinates (centroid). Now I want to <strong>find the rotation angle</strong> of the object with respect to the image. Considering everything in the 2D image plane. How can I calculate the angle?
  This image represents what I trying to achieve:</p>
  <p><a href="https://i.stack.imgur.com/taqa3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/taqa3.jpg" alt="enter image description here" /></a></p>