This is a demo script to show how parse the lens data from a PTGui project file. In particular, parsing crop and lens shift is slightly complicated. This is because PTGui stores it in such way that the same data can be used for images in portrait and landscape orientation, and for any image size. To achieve this, shift and crop are normalized to the diagonal size of the image. Values are not stored as width/height but rather as sizes along the long and short edge of the uncropped image. For images in portrait orientation there is still an ambiguity in the direction of shift/crop, depending on whether the camera was rotated to portrait orientation clockwise or counterclockwise. This is solved by the 'portrait camera orientation' setting in the Lens Settings tab.
View the source of this web page and see parsePtsLensInfo() to learn more.