Stitching 360 degree panoramas with Hugin

In my last post, I talked about stitching panoramas with Photoshop. There is an open source application named Hugin that can do the same and more. It is dedicated panorama stitching software, so there are many more options available to you.

This guide uses Hugin 2016.2.0.

Hugin supports basic panorama stitching, the same as Photoshop. But where it really shines is 360 degree panoramas. With a panorama viewer like Pannellum, you can view panos much more easily on the web. Here's how you can create one:

  1. Take a set of 360 degree panoramic photos. This is the same as a regular panorama, you just end up rotating 360 degrees. You can also stack multiple strips to get a bigger vertical field of view.

  2. Open Hugin.

  3. Go to Interface -> Expert hugin control panel

  4. In the lower left quadrant of the window, click Load Images. Choose the images you want to stitch.

  5. Under Feature Matching, Select Cpfind (multirow/stacked) finding control points

  6. Click Create Control Points. This may take a few minutes.

  7. Under Optimize, for Geometric, keep Positions (incremental, starting from anchor). Click Calculate. This should be fairly quick. Once it's done, click Yes.

  8. For Photometric optimization, keep Low dynamic range. Click Yes.

  9. Click on the Stitcher tab. hugin stitching tab

  10. Leave projection as Equirectangular. This is the projection 360 degree panorama viewers are expecting.

  11. If you want, you can change the canvas size. Clicking Calculate Optimal Size makes the panorama as big as if the original images were not resized at all. You probably don't want this to be bigger than 10,000 pixels wide.

  12. If you like, you can click "Fit crop to images". This will trim any whitespace off the final panorama. This is useful if you have e.g. a hole in the sky directly above the camera.

  13. Select the output format you want. It defaults to TIF, which can give very big image sizes. JPG is a nice alternative for smaller files.

  14. Click Stitch! This may take a while, if the output size is large.

  15. Your panorama is ready. While the raw image doesn't look like a panorama, your 360 pano viewer of choice will re-warp it back to its original state.

Happy shooting!