How to generate panoramic images

This is a basic guide on how to generate panoramic images. A lot of the online guides I have read have vanished so I decided to create this. This guide uses hugin enblend, autopano-sift and gimp.

Contents

Installation

Firstly you need to get and install the software. All the software I use is open source, free and available on Windows and Linux. I cannot explain how to install them so you'll need to figure this bit out for yourselves. I am using gentoo, which has this software in portage. They are very easy to download and install for Windows too. Most have simple exe installers.

Preparation

With my solution you dont need to do alot of prepartation with your source images. The main thing is to rotate any of your images if its needed.

I normally create directory containing just the image file which will make up the panoramic image. This allows you to keep a copy of the source images and temporary files which are needed to create the panoramic image. This allows you to go back and regenerate or tweak the images later on.

Auto Keypoint Generation

Now that you have your images you need to process the images. The creation of keypoints in one image maps the exact same point in other images which show the same part of the scene. You can do this manually in Hugin by adding the images and going through every image and looking for every other image and looking for common keypoints. The easier way is to use autopano to generate some automatically.

So now is the time to start Autopano-sift. You should see a UI which looks something like this :

Click on the Add images button and select all the images which make up your panoramic scene.

Press the select button to choose where you want the pto file to be written. I normally put the file in the directory which I setup containing just the source panoramic images.

Now click on the Advanced options tab. In the Keypoint matching box select 20 in the pull down list.

My second tab looks like this :

Now simply press Compute and wait for the process to finish

After its finished press Exit

Refinement and optimisation

Now you have a pto which knows about your images and has lots of keypoints generated. Open Hugin and open the pto file. It should look something like this :

Go straigh to the Optimizer tab and click optimize now. A dialog will popup like this :

The lower the standard deviation number is the better your source images were. Press Yes button to apply changes.

Now we may need to do some refinements. Click on the preview panorama button on the toolbar. A new window will appear showing you what the end output should look like. You may need to press the update button to see the result, or you can press auto which will mean it automatically updates when you change something. You may need to press center and fit to get the preview looking correct.

You can see from my preview that my image looks quite good just with the automatic keypoints, but it has a slight bend in the image which I didnt have when taking them. We can correct this by creating some more keypoints by hand in the correct locations.

The reason the image bends like this is because there are many more keypoints generated for the land part of the image than in the sky, so the sky gets stretched. We need to tell Hugin that when I took the pictures the camera was always horizontal to the horizon. There are also cases when verticals are not quite vertical, these can be fixed in the same way.

In the preview you can see that the left most image and right most image are the two which are more off horizontal than the rest. Close the preview window and click on the Control Points tab.

In this tab, select the image which was on the right of the preview window. Make it appear in both the left half and right half of the control points tab. Like so :

Now we simply need to add one control point to both views of the image to tell Hugin it should be kept horizontal. Add the control point to the left image on the horizon here the center split, then add the corresponding horizonal point on the right image near the center split. Like so :

You may get a warning saying it cant find the corresponding point when you click the second point. This is ok. It was trying to find common points within the two images, but as you click on very different parts of the image, it cant find them. Afterwards you should see the new control point in the bottom of the Control Points window and it should say Alignment horizontal

Now go to the far right image. Select it in both views in the Control Point UI and add another horizontal line with the horizon. As before.

Now go back to the Optimizer tab and press Optimize Now again. Open the preview window once its finished. Press the update, center and fix buttons and look at the new results. In my case that was all that was needed and the preview looked like this :

Now we can move on to creating the output images.

Stitching

This is the easy bit. Simply select the Stitcher tab. Press the Calculate Field of View button, then press the Calculate Optimal Size.

Open the preview window again and check that the end result is what you expect. You may need to move the sliders on the bottom and right of the window to ensure that the whole panoramic image is visible. I always move the sliders to ensure there is a black band around the whole image. Like this :

Ensure the Nona stitcher is selected and the rest of the settings are like this :

Press the Stitch Now button and enter out as the filename.

Blending

You should now have a directory which look something like this :

Avoriaz 016.jpg  Avoriaz 019.jpg  out0000.tif  out0003.tif  pano.pto
Avoriaz 017.jpg  Avoriaz 020.jpg  out0001.tif  out0004.tif  
Avoriaz 018.jpg  Avoriaz 021.jpg  out0002.tif  out0005.tif  

Your source images, pto file and the stitched tif files.

Now we use enblend to create a large tif from all the individual tif files. To this you simply need to type the following in a terminal/console.

enblend -a -l 20 -o out.tif out000*

After some time you should end up with a large tif file, out.tif

Cropping

Start up Gimp and load the out.tif file. Drag some guides from the top and position one at the top and one at the bottom of the image where you want to crop it. Now drag two more guides from the left and position on the left and right of the image where you want to crop the image. You should then have something like this :

Now select a rectangle along the guide lines. Copy the region and paste as a new image. You now get your end image. Like this :

Now you can save it as tif, jpg whatever. You may want to also save some half/quarter size versions for use on websites etc.

Comments

Comment

Name:
Email:

Comment:

CAPTCHA Image