I recently finished up a month of travel. In addition to seeing great friends and beautiful places, I used my travels as an opportunity to learn how to use a DSLR. I mean really learn, beyond just the point-and-shoot basics we all know. So I borrowed an old Nikon D40 from a friend and sort of just dove in. Turns out, it’s not very difficult to go from n00b to novice, and it’s even easier to take a lot of photos…but that’s a story for another day.
One of the challenges I (unwittingly) set for myself was creating panoramas,
like the one above. It seems straightforward in theory - shoot a series of
overlapping photos and then combine them using software. Afterall, most modern
smart phones have panorama modes built into their camera apps. However, as I
soon learned, it can very easily turn into a deep, interesting trap rabbit
hole of techniques and details.
This post is a summary of my findings from figuring out how to create panoramas from individual photos, and then uploading them to Facebook as “Photo Spheres”1. This wasn’t as simple as I expected it to be, so I wanted to record my insights and process, for my future self and anyone else who is silly enough to try for themselves.
One last aside - I work predominantly on Ubuntu with FOSS, so this is written using entirely open source tools. This is definitely possible using Photoshop (heck, it’s probably much easier), but YMMV.
There’s effectively two components to my process:
This section focuses on part A.
Since I was just starting out with a borrowed camera, I wasn’t very sophisticated in my setup for taking the panorama shots. I shot hand-held, and used the horizon as my reference as I swept my camera across the scene, taking pictures periodically. Of course, there are some very fancy rigs out there to buy for your tripod, and there are even some clever techniques for better hand-held shots (google “philopod” if you’re curious).
Nevertheless, I found I was able to produce decent panoramas, once I learned how to keep the exposure and white balance the same in every picture.
ProTip #1 – Consider using the AutoExposure-Lock feature of your camera when taking a photo series for a panorama. It makes the resulting panorama look more natural and contiguous, at the cost of some places potentially being under- or over-exposed.
I didn’t have many problems with parallax, since I was taking mostly wide-angle landscape panoramas. But I now know that I can reduce parallax effects by rotating the camera about its “no-parallax point”.
For stitching, the best open source tool I found2 is Hugin. Hugin is actually a front end GUI for the Panorama Tools.
Now, Hugin is an amazing tool and can be used to do a tremendous amount of things. And so, here is where the hole really starts. Between trying to figure out how to use the tool and being distracted by learning what people do with the tool, I spent way too long here. And every time I revisit this, I seem to lose more time3. But, even I have limits to how deep down the rabbit hole I’ll go. So, here I’ll be focusing on the practical findings, and leaving some questions unanswered…because…I just need to move on 😵
So, without further adieu, here’s the CliffsNotes4 for creating panoramas in Hugin:
Okay, so now you have a choice, depending on what sort of panorama you want to produce. Typically, you’ll want to produce a Photo Sphere, which is a much cooler way to show off your panorama. In that case, proceed to the next section now.
However, sometimes you just want a flat, cropped panorama. I typically opt for this when the estimated horizontal FOV6 is ≤160° or I’m just stitching together a couple photos (not really a panorama). To do this, we continue from above:
That’s it - you should have a nice, clear panorama to post as you like!
Instead, you might want to post your panorama as a Photo Sphere. To do so, you just need to massage it into a size and shape that Facebook will accept and recognize as a 360° image8.
First, you need to make your panorama fit into one of seven predefined sizes (determined by horizontal and vertical FOV):
Go back to the ‘Projection’ tab and note the estimated horizontal and vertical FOV values. Then find the row in the following table that best matches those values. Enter the FOV values from the table into Hugin. The Image Size and Command you’ll use next.
H FOV | V FOV | Image Size (px) | Command |
---|---|---|---|
120° | 86° | 6000x5343 | |
150° | 86° | 6000x4274 | |
180° | 86° | 6000x3562 | |
240° | 86° | 6000x2671 | |
300° | 86° | 6000x2137 | |
360° | 86° | 6000x1781 | |
360° | 65° | 6000x1217 |
Go to the ‘Crop’ tab and click on the button next to the crop dimensions to ‘reset crop to maximal possible area’. The result should be your panorama embedded in an overall image which covers the desired FOV.
Switch back to ‘Advanced’ interface.
Go to ‘Stitcher’ tab and…
This should result in something that looks like the following:
Now, you need to set the metadata correctly on your image so that it declares
itself as a Photo Sphere. This can be done with
the exiftool command line
tool. You’ll notice in the table above I’ve provided the appropriate commands to
run for each FOV. Copy the appropriate command and run it in your terminal9. Be
sure to replace path/to/image.jpg
with the appropriate path to your image.
Finally! You’re ready to upload to facebook…or are you? Well, you are, but Facebook imposes the following restrictions:
If you follow all those steps, then it should totally work and you will end up with an awesome Photo Sphere to share with all your friends.
That’s it! I hope if you made it this far you found this guide useful, or at least insightful…
If I have time, I’d like to investigate the following areas: