Making panoramas with Hugin and enblend on a Mac
Hugin is a cross-platform GUI that allows the user to “assemble a mosiac of photographs into a complete immersive panorama, stitch any series of overlapping pictures and much more.” Having long wanted to create panoramas but lacking the skills and time to make one that looks good, Hugin seemed like the perfect tool for me.
I went to the Hugin for OSX port page, navigated to the download section, and grabbed a copy. After downloading, I quickly realized that like most open source programs, the documentation on how to use Hugin was sorely lacking. I eventually learned how to do what I wanted to do through trial and error as well as reading numerous tutorials scattered around the web.
My first headache was getting Autopano to work, which is arguably the most important tool that Hugin can use. When it works, Autopano scans through the images you add to Hugin, finds where they overlap, and figures out the best way to stitch the images together. The version of Autopano linked within Hugin’s tools folder requires that the Mono environment be installed on your computer to work, so pick that up first.
After installing Mono, I noticed the following line in Hugin’s explanation on how to get Autopano working:
There are two ways of using Autopano-SIFT from HuginOSX. One is very easy, but does not always work, and hence not supported. The other should work as long as you set up autopano-sift correctly, but it involves editing shell script.
As usually happens, the very easy way did not work for me, so I had to do some minor shell script editing. After following the instructions and properly setting up the AUTOPANO_PATH
variable and changing every instance of “generatekeys.exe” to “generatekeys-sd.exe” in the autopano-complete.sh file, I thought I was ready to rock.
However, Hugin quickly let me know that my rocking was yet to happen. Instead, it gave me this error:
I double, triple, and quadruple checked my changes to the shell script, and I couldn’t find what I’d done wrong. I completely removed Autopano from my computer and downloaded a new copy to insure I hadn’t inadvertently changed something else.
Eventually, I realized that Autopano does not like it when the images you’ve added to Hugin have spaces in their path or filename. So after changing the folder and file names (in the example case seen in the error message above from “folder with spaces” to “folder”), my images were analyzed and properly linked.
I’m not going to go into the finer points of optimizing the panorama by adding vertical and horizontal lines or any other such thing - I do not have the experience or knowledge of Hugin to be considered a source on such things. But with the little experience that I do have, I was able to successfully turn thirteen separate images into this:
If you click on the image to see a larger version, you’ll see that the stitching areas between images are very visible, and very ugly. This is where Enblend comes in. Although Enblend can be run from within Hugin by selecting the “into a high quality TIFF file” option in Quick Stitcher, I recommend against it. Instead, export everything as multiple TIFF files.
Once this is complete, you can run the images through Enblend via the command line in Terminal. An example command would be:
/Applications/HuginOSX/tools/enblend/enblend -v -o \\ /Path/To/Save/Final/Pano/Image.tiff \\ /Path/To/Image/1.tiff \\ /Path/To/Image/2.tiff \\ /And/So/On.tiff
Enblend takes quite a while (can be many hours depending on image size, number of images, and processor speed) to do it’s stuff, and I prefer running it through the terminal so I can free up system resources by closing Hugin. There isn’t any sort of progress indicator or time remaining information in enblend, so I run it with the -v flag (verbose) to keep me from thinking my computer froze.
Enblend looks at the various parts of the TIFF files that overlap, and figures out how to blend them. It will blend images over a wide area in parts of the images where there is little variation in the surrounding area - like in skies and clouds - and will blend images in a very small area where people won’t notice a harsh transition - like in rocky areas or in tree trunks.
If you compare the image below to the image above, you’ll see how great a job enblend does:
For the next step, I played around with enblend’s exported TIFF image in Photoshop. I used the Stamp tool and Gaussian blur filter almost exclusively, and am pretty happy with the results. There are some areas I could spend more time in, like making the sky areas that I added look more uniform, but overall I think it looks pretty good for a first try.
My biggest gripe with the Hugin is its lack of documentation. There are numerous options and optimization modes that are not referenced anywhere in the help. Sure, I can look around online for most of the information, but it would save every new user a half-day’s worth of time if all of that information was put in the one place it should be - Hugin’s help file.
That’s not to say Hugin and its associated tools are bad, because they aren’t - they just lack the information necessary for new users to get up to speed in a short amount of time.
Some statistics from the project:
- Total pictures stitched: 13
- Final resolution of panorama: 17964 x 2529 pixels.
- Total time necessary for me to be at computer: ~30 mins.
- Total time my computer spent on processing the images: ~6 hours
In case you’re curious, the panorama shows what you can see from the top of Mt. Rose, the third highest peak in the Lake Tahoe Sierra. You can see some other pictures from the hike here.
/
I was having the same problem with spaces and couldn’t figure out what was going wrong. Thanks for clearing it up!
please remove the nostril photo, bastardo; i am now one step closer to rhinoplasty.
You really could have just used photostitch 3.1. It came in the box with your camera and requires about 3 clicks and a hair under 6 hours to stitch pictures.