Hugin tutorial — Stitching flat scanned images
This tutorial covers another non-panoramic usage of Hugin — Taking two or more partial scanned images of a large object, such as an LP cover, map or poster, and stitching them seamlessly into a single final image.Note: This tutorial is based on the 2010.2.0 version of Hugin, although your version may differ, the underlying principle will remain the same. The rest of this article assumes that you are familiar with basic photographic stitching using Hugin.
Here is a page that is too big to fit in the scanner and has to be scanned in two parts. These can be assembled in the gimp, but each scan is rotated differently and it is nearly impossible to line them up.You can download the two photos used in this example (scan-1.jpg, scan-2.jpg) and try it yourself.
Start by launching Hugin, use the Assistant 1. Load images.. button and select the scanned images you want to assemble.Panorama Tools expects images to be photographs taken with a camera. Obviously this is not the case, but in fact a scanned image is very similar to a simple Rectilinear photo taken with a 'perfect' camera — A camera with zero pitch, zero yaw and zero lens distortion.
We don't know the FOV (Field of view) of this imaginary camera, but it doesn't matter since the picture is the same regardless (setting any mid-range value between 5 and 40 degrees would probably be ok). Just enter 10 in the HFOV(v): text box, and select OK. You will have to do this for each image.
Switch to the Control points tab. Add a series of control points for each pair of images, just as you would when stitching two photos together.
Tip: You you need at least two control-points per pair of images, but more points will allow the optimizer to find a better alignment. I'm lazy, so the control points for this tutorial were generated automatically by autopano-sift-C.
Switch to the Camera and Lens
You need to stop Hugin from assuming that all the pictures were
the same camera, so you need to asign a different lens to
Do this by selecting one picture and hitting the New
lens button. If you have more than two images, set New lens for all the images, such
that each image has a different lens number.
Now select the Optimizer tab. We are not doing a standard panorama. For this project we can use the Mosaic mode, so change the Optimize setting to The Custom parameters below and then set r,X,Y,Z for all images other than the anchor image, select Optimize now!Note, that you could also optimize by setting r,v,d,e for all images other than the anchor.
When it is done you will need to Apply the changes.
Now is a good time to use the
Window to check that everything is going to be ok.
Select Projection and set
to rectlinear, then drag the
window sliders to set suitable fields of view.
Select Move/Drag to
position the image using Mosaic mode,
and then select Crop and drag
the inside of the cropping rectangle to adjust the crop.
That's it, you can use the Stitcher
tab to create a permanent output file as usual.
In the Stitcher tab select calculate Optimal Size, set your outputs and then Stitch Now...
We have used Calculate Optimal
Size for this example because the images have been scanned from printed
material and the optimal size will minimize any pattern effects that
might occur if the resulting stitch is scaled down.
Other things you might want to experiment with are:
Rotational alignment — Horizontal and vertical control points can be used to get the overall rotation perfect. See other tutorials for tips on using these types of control points.
You are not limited to stitching two scans at a time, you can assemble as many as you like in single or multiple rows.
A similar method can be used to stitch photos of a surface taken from different viewpoints and distances (such as a mural), this is a subject for another tutorial.
Tip: All lens distortion needs to be corrected beforehand, as d and e parameters interfere with the a, b and c lens correction parameters.
Below is a final version stitched with nona and enblend. There has been no manual re-touching, however the join is completely invisible.
About this picture
The Grammar of Ornament by Owen Jones, was published in 1856 and is a landmark of Victorian architecture, printing and design. The final chapter; Leaves and flowers from nature was extremely influential in the development of the Arts and crafts and Art Nouveau movements.
Created March 2005. Updated May 2005.
Updated for Hugin 2010.2, Nov 2010 by Terry