title: Drawing Bounding Box for a rotated object
body: <p>I have a video stream where the objects( boxes) move in any direction and in any pose. I want to track each and every object. So this is what i did:</p>
  
  <p>1) I found the contours of the object</p>
  
  <p>2) drew bounded boxes around the objects.</p>
  
  <p>3) Calculated the centroid of the bounded box and tracked the objects.</p>
  
  <p>All these works fine. But the centroid of the bounded box is not exactly equal to the center of the object when the object rotates or is in some other pose.</p>
  
  <p>I want the bounded box also to rotate and fit to the shape of the box. When this happens the center of the bounded box is equal to the center of the object. This will also improve my tracking accuracy.</p>
  
  <p>See the picture attached: </p>
  
  <p>If Bounded box is not a solution, is there any there method to find the center of the object</p>
  
  <p>My object is always box shaped and also only the top surface of the object is seen on the video stream.</p>
  
  <p><a href="https://i.stack.imgur.com/C1q0b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C1q0b.png" alt="enter image description here"></a></p>