Partial Panoramas using ROI in PTViewer

From Wiki
Revision as of 14:32, 19 March 2005 by (Talk)

Jump to: navigation, search

Partial Panorama�s using ROI in PTViewer




== Gathering Information

Sample image

From the ROI picture we need to get some basic information :

  • Width in pixels (ROI Width) 800 px
  • Height in pixels (ROI Height) 541 px



Calculating the parameters for PTViewer

Sample overview

Since we know the ROI Width of the picture as well as the Horizontal Field of View (HFOV), we can calculate the field of view for 1 pixel. In this case 180� / 800 pixels = 0.2�/px

With that we can calculate the Vertical Field of View (VFOV) VFOV = 541 px * 0.2�/px = 108�


pwidth and pheight

To do that we first need to calculate the total size of the panorama image, of which the ROI image is a part of. The calculation is similar to the previous calculation but then the other way around. Since we know the degrees, we can calculate the number of pixels. Panorama Width (Pwidth) = 360� / 0.2�/px = 1800 px Panorama Height (Pheigth) = 180� / 0.2/px = 900 px

x and y offset

To calculate the x and y offset of where the picture needs to be placed we calculate the following

We know that the horizon in the large panorama is halfway. 900 px / 2 = 450 px By subtracting the horizon position we end up with the Y offset. Y Offset = 450 px � 227 px = 223 px

Similarly we can calculate the x offset. In most circumstances, you either don�t know, or don�t care about the direction the picture was taken. In that case it is good practice to place the ROI in the middle of the large pano where 0� is the middle of the picture. You can do this by taking half of the total panorama width 1800 px / 2 = 900 px And subtracting half the size of the picture (in this case 800 px / 2 = 400 px) X Offset = 900 px � 400 px = 500 px

== panmin, panmax, tiltmin and tiltmax To limit the freedom the user has in moving around your pano, you want to restrict the pan and tilt angles.


Because the ROI is horizontally in the middle, you may pan half the width of the image to the left and right, converted to degrees. Minimum pan = -800px/2 * 0.2�/px = -80� Maximum pan = 800px/2 * 0.2�/px = 80�

The minumum tilt is calculated as the position of the horizon, converted to degrees. Minimum tilt = -227px * 0.2�/px = -45.4� => 45� The maximum tilt is calculated as the height of the ROI minus the position of the horizon, converted to degrees. Maximum tilt = (541px � 227px) * 0.2�/px = 62.8� => 62�



Good luck.