PTGui Stereo Stitching

Written by Editor

February 1, 2020

PTGui is a well respected panorama stitching tool. However, at the moment it does not provide an “official” way to stitch stereo equirectangulars. There is a way though, it just requires a little extra work.

REFERENCES

Definitive Video “Stereo Stitching with PTGui” by Jim Watters

Single Lens Stereo Stitch with PTGUI by Wim Koornneef / Javi Baranano

Stereopanography

APPENDIX

Some of this information has been “lost” over the years. The original article where I learned to do this was on Nodal Ninja, but was deleted. I’m going to put the original text here so I at least have a copy.


 
       360hugh.co.uk
 360° Interactive Panoramas    

   One Camera 3D by Wim Koornneef 
 In a post by Javi Baranano he  describes the method using a single camera ahead of the NPP as  ‘Rotational capture’ and “…pure illusionism, because we are going to  deceive our cerebral cortex by showing two images with a different  parallax”.Hello Forum,
 In this tutorial Wim Koornnee will give some general instructions and explain step by step how to;
 – shoot the images,
 – make a left and right eye panorama with PTGui 9,
 – make an anaglyph panorama,
 – make an interactive 3D panorama,
 Wim will also tell a bit about the shape  of the mask for PTGui and at the end of the tutorial is a Links section  to download software.
 General instructions:
 
 Use a fisheye lens with a FOV of 180° with the camera in portrait position.
 Take care that there are no objects in the scene closer then 1 m to the lens.
 Only shoot outdoors when there is no wind at all.
 Avoid dynamic scenes, you really need a static or “frozen” scene.
 Use a sturdy tripod, a good panohead and level the panohead carefully.
 If your rotator has a little wobble, or your tripod or pole isn’t really  stable, then the tilt and roll can vary between shots and then you have  to use a different method for optimizing than described in this  tutorial.
 This is because the method I describe is based on a linked tilt and roll for all images for optimizing.
 How to shoot the images:
 1) Set the upper rail of your panohead  in the horizontal position (zero tilt) and shift your camera forwards on  the upper rail out of the NPP of the lens.
 When shooting in a room with objects relatively close by then shift  approximately 30 mm forwards, when shooting in a larger space then shift  between 30 and 60 mm and when shooting outside shift 60 mm or more.
 I suggest that you start with a  small shift to get familiar how to make 3D panoramas and try out larger  shifts later when you are more experienced.
 The more shift you use the more 3D depth you will get in your  panorama. Having too much 3D depth in a panorama is always a bad thing,  on the opposite, when having not as much as is possible 3D depth this  will be accepted by most people.
 2) Set your rotator to the proper number of images.
 Use the table below as a guide for the  number of shots needed for a given lens shift, using to much images is  never a problem, using not enough images will cause stitching errors.
 When shooting closer then 2 meter to objects you really need more images than stated in the table to avoid stitching errors.
 When shooting at 1 meter distance limit the forward shift to 40 mm and shoot 50 instead of 25 images.
      shift 20 mm  >  15 images
      shift 30 mm  >  20 images
      shift 40 mm  >  25 images
      shift 50 mm  >  30 images
      shift 60 mm  >  35 images
      shift 70 mm  >  40 images
      shift 80 mm  >  45 images
      shift 90 mm  >  50 images
      shift 100 mm  >  55 images
 3) Set the camera in M mode for a fixed  exposure of all images, set the white balance to a fixed setting and the  focus of the lens to Manual with a fixed distance setting.
 Shoot all images around and take care that you don’t move the gear by accident (use a remote control).
 Process the images for removing CA, enhancing sharpness and all other stuff you normally do with your fisheye images.
 How to make a left and right eye panorama (equirectangular) with PTGui 9:
 4) In PTGui Pro 9 you load all images, apply a lens calibrated template and setup your template for advanced use.
 Let PTGui automatically place the Control Points.
 Optimize for lens shift parameters “d”  and “e” and image parameters yaw, pitch and roll in steps with linked  roll and pitch for all images and remove all Control Points with errors  of 8 px or higher.
 Avoid optimizing for the image parameter pitch and the vertical lens  shift parameter “e” in the same step when you start optimizing as it  will give issues with high and wrong values.
 When the Control Point errors are all below 8 px and the pitch and the  vertical lens shift parameter are more or less normal then the  optimizing is done.
 5) Open the Mask window and the Panorama  Editor window, select the first image in the Mask window and draw a red  mask with a large unmasked part that looks like a half moon shape in  the right half of the fisheye image.
 You can see the result of your drawing in real time in the Panorama  Editor, please keep in mind that the shape of the mask is more important  then fine tuning of the edges of the mask.
 When the mask looks fine then save the mask as “left_mask”.
 Instead of drawing your own mask from  scratch you can also download the default mask that I used for this  tutorial (see the Links section at the end of this tutorial), resize it  to the image size of your camera and modify the shape of the mask in a  graphic application (e.g. Photoshop), after saving the mask you load it  in the first image.
 6) Open to the Source Images tab.
 Control-click (right mouse click) on the first image and copy the mask with the mouse menu.
 Select all images and paste the copied mask to all images with the mouse menu.
 Important, if there are moving  objects in the scene you have to manually mask them out of the image,  this can be a lot of work as you have to check every image for moving  cars, people, birds, etc.
 7) Go to the Create Panorama tab and set the settings just as you normally do for your camera and lens.
 Now save the template and name it whatever you like as long as the word “left” is in it.
 Create the panorama, this will be the left eye image (equirectangular).
 8) Open the mask that you saved earlier  in step 5 in a graphic application, flip the mask horizontal and save  the mask as “right_mask” in PNG format.
 You can re-use the masks for other 3D projects as long as you use  the same camera and lens (and the same zoom setting if you are using a  zoom fisheye lens).
 9) Go back to PTGui’s Mask window, select the first image again and load the “right_mask” image.
 Repeat step 6 and 7 but this time you save the template and the image with the word “right” in it.
 Create the panorama, this will be the right eye image.
 How to make an anaglyph panorama (equirectangular):
 10) For making a red/cyan anaglyph you  use the application StereoPhoto Maker (Windows only – free), for making  an amber/blue anaglyph you use ColorCode 3D Editor (Windows only – not  free).
 On OSX you can run StereoPhoto Maker with Wine for OSX (free) but for  ColorCode 3D Editor on OSX you need a emulator, e.g. Parallels or  Bootcamp.
 See the Links section for download links.
 To avoid stereo window violation the  left and right eye images must be to set to the proper zero parallax  point, this is the point where you will not see a colored edge at the  left and right side of an object when viewing the anaglyph without a  viewer.
 The setting of the zero parallax point is done by aligning the left  and right eye images to objects in the foreground of the scene, the  aligning procedure is different for StereoPhoto Maker and ColorCode 3D  Editor and therefore described in different steps.
 Continue with step 11 for making an amber/blue anaglyph panorama with ColorCode 3D Editor.
 Skip step 11 and go to step 12 for making a red/cyan anaglyph panorama with StereoPhoto Maker.
 11) Aligning and making of an amber/blue anaglyph with ColorCode 3D Editor.
 When using ColorCode 3D Editor you have  to align the left and right eye images in a graphic application, this is  because ColorCode 3D Editor is designed to work with rectangular images  and cannot wrap-shift images over the 0/360 border when aligning a 360°  panorama.
 When you use Photoshop for aligning then  open the left and right eye equirectangulars, copy one of the images on  top of the other one in a separate layer and reduce the Opacity of the  new layer to get both layers visible.
 Select the background layer (make sure that it is highlighted!) and with  the menu option “Filter”, the option “Others” and the sub menu “Offset”  you align the background layer in such a way that objects close to  nadir are on top of each other (only shift in a horizontal direction!).
 After deleting the copied layer and after flatten the image you save the aligned panorama.
 In ColorCode 3D Editor you open the aligned left and right eye images and set the gamma (try 1.2 for a start).
 Don’t use any other option unless you know what you are doing, the  reason for this is that most options of ColorCode 3D Editor can’t be  used for making 360 degree anaglyph’s!
 Inspect the anaglyph with your ColorCode 3D viewer on and save the  output as stereo image in PNG format when you are happy with the result.
 Continue with step 13.
 12) Aligning and making of a red/cyan anaglyph with StereoPhoto Maker.
 In StereoPhoto Maker you open the left and right eye images with the  File menu option “Open left/right images”, choose in the View menu the  option “Panorama Mode (360 degree)” and the option “Fit panorama height  to screen”.
 With the menu option “Stereo”, the  option “Color Anaglyph” and the submenu “Ghost-reduced Anaglyph” you get  a window with 2 histograms.
 Set the slider of the Contrast of the upper histogram to -20 [Lab] and  the slider of the Contrast of the lower histogram to +10 [RGB] and apply  the settings.
 Now the images must aligned in such a way that objects close by in nadir don’t have colored edges.
 Important, don’t put your red/cyan viewer on (otherwise you can’t  see the colored edges) and only align the images in a horizontal  direction with the left and right arrow keys on your keyboard.
 After aligning the images you put on your red/cyan viewer and check the overall brightness of the anaglyph.
 If the image is a little to dark then you need to compensate the gamma,  you do this with the menu Adjust and option Color adjustment, adjust the  gamma for the left and right image with the same numbers.
 After this you save the anaglyph panorama with the “File” menu option “Save Stereo Image …”.
 Important, do not save the anaglyph panorama as a normal JPEG image  because this will cause color ghosting in the anaglyph, only save as PNG  image (preferred) or as special ghost reduced JPEG file.
 How to make an interactive 3D panorama (Flash, HTML5, WebGL):
 13) Use the anaglyph panorama as input in your panorama software and process the image just as you do with any other panorama.
 Important, if your pano software has  an option to disable color subsampling for JPEG tiles then use this  option to avoid color ghosting in the output.
 When using Pano2VR v3.1 (or later version) color subsampling is  automatically disabled when setting the compression quality of the JPEG  tiles to 90% or higher.
 About the shape of the mask for PTGui:
 The default mask with a simple large  half moon shape will do fine in most situations but to get more or less  3D depth or to get 2D in nadir and zenith you can use small shaped  masks.
 Be careful when using a different mask then the default mask, with small  shaped masks it can happen, depending on the width of the mask and the  contrast of objects in the scene, that you get stains, brightness or  contrast errors in the output caused by the blender of PTGui (PTGui  blender, Enblend and Smartblend all have the same issues).
 When you have blender issues and really  needs to use a small shaped mask it is best to output the panorama as  layered Photoshop image (ignore the 2 or 4 GB warning of PTGui), open  the image in Photoshop, enlarge the canvas approx. 10% at one side (left  or right side), copy and shift the layers to the enlarged part to get a  seamless image, blend the panorama with Auto-blend, flatten the image,  reduce the canvas to the original size and shift the image if you want  to get the original position (see step 11 if you need to know how to  shift the image over the 0/360 border).
 The enlarging of the canvas and the copying of the layers is needed to  avoid a visible 0/360 seem as Auto-blend is not capable to wrap-blend  over the 0/360 degree borders of the image.
 Although the result with Auto-blend is most times very good even then it still can happen that the output has blender artifacts.
 If this is the case then you have to modify your masks or manually retouch the output.
 Bottom line, first try the default mask before you use a smaller shaped mask.
 Links section:
 Relevant Files Zipped
 ColorCode 3D:
 http://www.colorcode3d.com
 StereoPhoto Maker:
 http://stereo.jpn.org/eng/stphmkr
 Wine with Winebotler for OSX (only for StereoPhoto Maker, not for ColorCode 3D)
 http://winebottler.kronenberg.org
  
 
 
 
 

 

You May Also Like…

Apple Vision Pro Day

February 2, 2024 In 2017 I bought a used Oculus Rift DK2 from a startup here in the Bay Area. VR seemed like such an...

Apple Vision Pro Announcement

Apple Vision Pro Announcement

After years of rumors, leaks, and probably delays Apple has shared their new VR headset, or should we say their...

LiDAR Projects

LiDAR Projects

LIDAR capture has been a mainstay of self driving vehicles for years now. The technology has really benefited from the...

0 Comments