find out the orientation, length and radius of capped rectangular object
===

I have a image as shown as fig.1.![enter image description here][1] I am trying to fit this binary image with a capped rectangular (fig.2)![enter image description here][2]  to figure out:

1. the orientation (the angle between the long axis and the horizontal axis) 
2. the length (l) and radius (R) of the object. What is the best way to do it?
Thanks for the help.


  [1]: http://i.stack.imgur.com/aRIhm.png
  [2]: http://i.stack.imgur.com/eXzSk.png