Hugin Tutorial: How to Stitch Your 360 Photos/Panoramas with Hugin
What's Hugin, and what does it do?
Hugin, pronounced ‘Hoogin’, is a very powerful open source panoramic image creator and editor.
Open Source means that any interested member of the community around it can add to features of the program and write code on top of what’s gone before. Also, in this case, open source means the program is free to download and use as much as you would like.
With Hugin, you can build large composite panoramas from multiple images with its stitching capabilities of both spherical scenes and flat format images, correct exposure levels, you can even stitch together sets of bracketed JPEG images into an HDR panorama.
What to expect from this tutorial & what you need before we start
After completing this tutorial you will be able to utilize Hugin to recenter (remap), level and size to the original resolution your 360 panoramic equirectangular images so that the main object of your image is front and center when viewed in scrubbable or immersive formats and save it in the image file format of choice.
For the purposes of this tutorial we shall be assuming that you have a equirectangular 2:1 image in 4k from a dedicated consumer level 360 camera such as the Madventure from Xiaomi or the Gear 360 from Samsung.
Download and prime Hugin
First of all, head to https://sourceforge.net/projects/hugin/files/latest/download and download the program. Once downloaded, install the software and open it. Once Hugin is open you will be presented with the main activity window:
Before beginning to edit images proper we need to change a few default settings so that editing goes as smooth as possible with as few pop ups and dialog boxes as possible to interrupt your workflow.
To do this, go to the menu: ‘File > Preferences’ and click on ‘Assistant’ and a set of checkboxes shall be shown. Deselect both ‘Automatically align images after loading’ and ‘Detect vertical lines’.
Now, click on the ‘Stitching’ tab and select the file format you prefer and then select ‘start stitching immediately’ and also ‘overwrite existing images’.
Finally, click the ‘OK’ button and your changes will be saved and you can now move on to actually utilizing the program to fine tune your images without having to stop to click ‘OK’ or ‘Cancel’ many times in the process of editing a single image.
The Hugin main window consists of many different options and areas, for now, we are only concerned with the top toolbar of icons. For the purposes of this tutorial the only buttons that will be being used are the new project button on the far left (the white page icon with the top right corner folded over) and the panorama viewing window (the blue colored representation of a landscape oriented panorama) fourth from right.
Editing a panorama
To begin editing an image, click upon the ‘Fast Preview panorama’ button shown below, fourth icon from the right and a new window will open, obscuring the main window.
In the panorama viewing window we can remap the image and adjust it so that the image is level and as such will be displayed correctly by the VeeR 360 photography service and as such easily manipulated by those consuming your content.
To open your image to begin editing, click upon the ‘1. Load image…’ button and navigate to the image you wish to edit and open it. Once opened Hugin shall populate the main area with your image and also the sphere on the left so that you can see how your image will look:
Click the ‘Move/Drag’ tab second from right and you may now drag at any chosen point your image around so that you can straighten it.
To center your image you may either drag the subject of your image to the center of the work area and then click and drag the image so that vertical lines are also vertical, or you can use the sphere projection on the left of the screen and manipulate your image by rotating the sphere in the chosen direction. Keep in mind that if you are using the rotation method, when you rotate the sphere to the left, your image will remap to the right. Rotating the sphere up or down has the same effect on your image. If you find that you wish to undo the last movement made then simply hit ‘ctrl+z’ to undo the last change.
Your image will show a warped line where the original image wraps around and joins itself, do no be alarmed. When Hugin remaps your image this will disappear, and you are left with a clean spherical format image.
Once you have moved the focus and leveled the image to how you want it you will result in something similar to this:
Now you have your image edited, return to the main window and click upon the ‘Stitcher’ tab and click on ‘Calculate Optimum Size’. This should change the figures to the original resolution of your image, which is the maximum clean resolution of the image.
If you want the image to be a different resolution or lower in size when exported, enter the resolution you require bearing in mind that to be recognized and displayed correctly it must conform to a 2:1 ratio where the width is twice the height of the image and that enlarging the image will lose some of its clarity. For ease of further processing something like 7000*3500 is a good size as many backends that you will upload to will do further image processing to ‘optimize’ your image.
Stitching and saving your file
Now click upon the ‘Stitch’ button at the bottom right. You will have to choose where to save the Hugin edit file ( .pto file) and also where to save the actual image file itself.
At this point, you are finished remapping the image file and your project will be passed off to be remapped and converted by the batch processor. You may now click on the new project button and edit another image whilst the first is being remapped, converted and saved.