Convert full frame fish eye to equirectangular mathematically
<p>I want to convert a full-frame fisheye image to an equirectangular, so I can use it for panoramic stitching. I have used Hugin and libpano for this purpose and they work fine. Following image have been converted by hugin. I want to know the mathematical equations with which such or similar transformation can be achieved.</p>

<p><strong>Orignal Image</strong>
<a href="https://i.stack.imgur.com/3ua9Q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3ua9Q.jpg" alt="Full-Frame FishEye"></a> </p>

<p><strong>Converted Image</strong></p>

<p><a href="https://i.stack.imgur.com/WjkU7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WjkU7.jpg" alt="Converted Image"></a></p>