Hugin Optimizer tab
hugin uses a photo alignment scheme where it adjusts image orientation and lens settings of source photos until the control points line-up, this process is called optimisation and the hugin Optimizer tab is where it is controlled. You actually create individual control points in the hugin Control Points tab, and manage them in the hugin Images tab and hugin Control Points table.
So to align photos you need some control points, a general rule is that optimising more parameters requires more control points.
- 1 Quick Optimizer
- 1.1 Positions (incremental, starting from anchor)
- 1.2 Positions (y,p,r)
- 1.3 Positions and View (y,p,r,v)
- 1.4 Positions and Barrel Distortion (y,p,r,b)
- 1.5 Positions, View and Barrel (y,p,r,v,b)
- 1.6 Everything
- 1.7 The Custom parameters below
Use the Optimize combo box to pick one of several pre-set optimisation schemes, then click the Optimize now! button to calculate the best available fit. One valid technique is to try each optimisation scheme in turn, starting at the top, until you are satisfied with the results.
The Optimisation result tells you how good the alignment is, large control point error distances indicate one of several things:
- Some control points are in the wrong place, look at the list in the hugin Control Points table and identify points with large distances and check they are set properly.
- If points are set correctly, there may be parallax errors caused by camera movement between shots. If so it may be necessary to decide which objects in the scene are important to have aligned and delete unrelated control points in the hugin Control Points tab.
- Otherwise you may not be optimising enough parameters. For example, the EXIF data retrieved from a JPEG file may not give a very accurate starting Field of View, in this case you should optimise view (v).
The following pre-set optimisation schemes are provided:
Positions (incremental, starting from anchor)
This is the simplest setting, and is probably sufficient for a lot of purposes. Only the relative orientation of images are optimised, lens parameters are left untouched, this works best if either of the following is true:
- The lens has minimal barrel distortion and the photo EXIF information supplies an accurate Field of View.
- Lens calibration has already been performed, saved to a file and loaded into the current project via the hugin Camera and Lens tab.
Note that to align any pair of photos, there should be at least two pairs of control points connecting them.
This is exactly the same as the incremental setting above except that all parameters are optimised at once, this may confuse the optimiser if the images are not already roughly in the right place. Don't use this setting.
Positions and View (y,p,r,v)
Note that for this too work you need at least three well-spaced pairs of control points between any pair of photos. With a 360 degree panorama it is usually beneficial to optimise the Field of View, even if you have already calibrated this beforehand.
Positions and Barrel Distortion (y,p,r,b)
This is the same as optimising Positions except that an attempt is made to discover the lens barrel distortion at the same time. Only the b parameter of the full lens correction model is varied by this optimisation scheme, as this is a reasonable approximation of the distortion of a typical lens.
Again you need at least three well-placed pairs of control points between any pair of photos.
Positions, View and Barrel (y,p,r,v,b)
Selecting Everything optimises every parameter in the full lens correction model, this will produce bizarre results unless you are using a calibrated panoramic head and lots of control points (the more points the better) - This is one way to perform lens calibration.
The Custom parameters below
The pre-set optimisation options are useful for most situations, but often it is necessary to switch to Custom parameters.
For example, when shooting hand-held panoramas, some of the position variation between shots can be resolved by using different d and e Image Center Shift parameters for each shot. Select The Custom parameters below and pick the d and e parameters for optimisation. Note that by default, lens settings are shared for all photos in the project, go to the hugin Camera and Lens tab and uncheck the link box for any you want to have different values in each photo.
The Image Orientation section shows the photo number and roll, pitch and yaw rotation/orientation values for all input photos (in parenthesis), the check mark indicates parameters that will be optimised.
The Lens Parameters section shows the lens number and the lens correction model parameters (in parenthesis) for each of the distinct lenses in the project. Only parameters that are linked in the hugin Camera and Lens tab are shown in parenthesis.
Note that normally all the photos in a project have the same lens, so there is usually only one row here.
edit script before optimizing
hugin actually creates a PTOptimizer script file which it passes to the panorama tools library for optimisation, select edit script before optimizing and you can tweak this file for each optimisation run.
This is something you would only do in obscure cases such as:
- Linking the positions of input photos. For example photos in a multi-row panorama taken with tripod can all be assumed to have the same roll, similarly photos in each row can be assumed to have the same pitch - This will help when there are few details available for setting control points.
- Optimising the g or t shear parameters of the lens correction model for scanned images is only possible by editing the script file.