[d80138]: tutorials / scans / en.shtml  Maximize  Restore  History

Download this file

169 lines (157 with data), 8.1 kB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Hugin tutorial &#8212; Stitching flat scanned images</title>


  <style media="screen" type="text/css" title="Screen style sheet">
@import url(/css/normal.css);
  <link rel="icon" href="/css/icon.png" type="image/png" /></head><body>
<!--#include virtual="/ssi/menu.html"-->
<div class="content">
<h1>Hugin tutorial &#8212; Stitching flat scanned images</h1>
<p><strong>This tutorial covers another non-panoramic usage of Hugin
&#8212; 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.</strong></p>
<em>Note: This tutorial is based on the 2010.2.0 version of Hugin,
although your version may differ, the underlying principle will remain
same. The rest of this article assumes that you are familiar with <a href="../two-photos/">basic photographic stitching</a> using Hugin.</em>
<p>Here is a page that is too big to fit in the scanner and has to be
in two parts. These can be assembled in the gimp, but each scan is
differently and it is nearly impossible to line them up.</p>
<p><a href="scan-1.jpg"><img alt="top part of scan" src="scan-1-small.jpg" /></a> <a href="scan-2.jpg"><img alt="bottom part of scan" src="scan-2-small.jpg" /></a></p>
<p>The solution is to use <a href="http://hugin.sourceforge.net/">Hugin</a>
and <a href="http://panotools.sourceforge.net/">Panorama Tools</a> to
rotate and align the
pieces perfectly.</p>
<p>Start by launching Hugin, use the <big><strong>Assistant 1. Load
images..</strong></big> button and select the scanned images you want
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 <em>Rectilinear</em> photo taken with
a 'perfect' camera &#8212; A camera with zero <em>pitch</em>,
zero <em>yaw</em> and zero <em>lens distortion.<br />
</em>We don't know the <em>FOV (Field of view)</em> 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 <big><strong>10</strong></big> in the <big><strong>HFOV(v):</strong></big>
text box, and select OK. You will have to do this for each image.
<p><img style="width: 800px; height: 663px;" alt="add image" src="shot-1new.jpg" /><br />
<br />
Switch to the <big><strong>Control points</strong></big> tab.
Add a series of control points for each pair of images, just as you
would when <a href="../two-photos/en.shtml">stitching two photos
<p><em>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 <strong>autopano-sift-C</strong>.</em></p>
<p><img style="width: 800px; height: 663px;" alt="control points" src="shot-3new.jpg" /><br />
Switch to the <big><strong>Camera and Lens</strong></big>
tab.<br />
<p>You need to stop Hugin from assuming that all the pictures were
taken with
the same camera, so you need to asign a different <em>lens</em> to
each image.
Do this by selecting one picture and hitting the <big><strong>New
lens</strong></big> button. If you have more than two images, set <span style="font-weight: bold;">New lens</span> for all the images, such
that each image has a different lens number.<br />
<p><img style="width: 800px; height: 662px;" alt="new lens" src="shot-4new.jpg" /><br />
<p>Now select the <big><strong>Optimizer</strong></big> tab. We are
not doing a standard panorama. For this project we can use the Mosaic mode, so change the
<big><strong>Optimize</strong></big> setting to <big><strong>The Custom parameters below </strong></big>and then set <span style="font-weight: bold;">r,X,Y,Z</span> for all images other than the anchor image,&nbsp; select <big><strong>Optimize
now!</strong></big></p>Note, that you could also optimize by setting r,v,d,e for all images other than the anchor.<br />
<p><img style="width: 800px; height: 548px;" alt="optimise" src="shot-5anew.jpg" /><br />

<p>When it is done you will need to
<big><strong>Apply</strong></big> the changes.</p>
<p>Now is a good time to use the<span style="font-weight: bold;"><big>
Fast</big> </span><big><strong>Preview
Window</strong></big> to check that everything is going to be ok. <br />
<p><img style="width: 800px; height: 765px;" alt="fast preview" src="shot-6new.jpg" /><br />
<p>Select <span style="font-weight: bold;">Projection</span> and set
to <span style="font-weight: bold;">rectlinear</span>, then drag the
window sliders to set suitable fields of view. <br />
<p>Select <span style="font-weight: bold;">Move/Drag</span> to
position the image using <span style="font-weight: bold;">Mosaic mode</span>,
and then select <span style="font-weight: bold;">Crop</span> and drag
the inside of the cropping rectangle to adjust the crop. <br />
<p>That's it, you can use the <big><strong>Stitcher</strong></big>
tab to create a permanent output file as usual.<br />
In the <span style="font-weight: bold;">Stitcher</span> tab select <span style="font-weight: bold;">calculate Optimal Size</span>, set your
outputs and then <span style="font-weight: bold;">Stitch Now...</span></p>
<span style="font-weight: bold;">
<p><span style="font-weight: normal;">We have used <span style="font-style: italic;">Calculate Optimal
Size</span> 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.</span><br />
<p><img style="width: 800px; height: 666px;" alt="stitch" src="shot-7new.jpg" /><br />
<h2>Advanced techniques</h2>
<p>Other things you might want to experiment with are:</p>
    <p>Rotational alignment &#8212; Horizontal and vertical control points
can be
used to get the overall rotation perfect. See <a href="../architectural/">other tutorials</a> for tips on using these
types of
control points.</p>
    <p>You are not limited to stitching two scans at a time, you can
as many as you like in single or multiple rows.</p>
    <p>A similar method can be used to stitch photos of a surface taken
different viewpoints and distances (such as a mural), this is a subject
for a
    <a href="../">future tutorial</a>.</p>
    <p>Tip: All lens distortion needs to be
corrected beforehand, as <em>d</em> and <em>e</em> parameters
interfere with
the <em>a</em>, <em>b</em> and <em>c</em> lens correction parameters.</p>
<p>Below is a final version stitched with <em>nona</em> and <em>enblend</em>.
There has been no manual re-touching,
however the join is completely invisible.</p>
<span style="font-weight: bold;">
<p><a href="leaves-from-nature-no1.jpg"><img alt="Leaves from Nature No.1" src="leaves-from-nature-no1-small.jpg" /></a></p>
<h2>About this picture</h2>
</span><span style="font-weight: bold;">
<p style="font-weight: normal;">The <em>Grammar of Ornament</em> by
Owen Jones, was published in 1856 and is
a landmark of Victorian architecture, printing and design. The final
<em>Leaves and flowers from nature</em> was extremely influential in
development of the <a href="http://en.wikipedia.org/wiki/Arts_and_Crafts_movement">Arts and
crafts</a> and <a href="http://en.wikipedia.org/wiki/Art_nouveau">Art
<p><span style="font-weight: normal;">Author </span><a style="font-weight: normal;" href="mailto:bruno@postle.net">Bruno
Postle</a><span style="font-weight: normal;"> -
Created March 2005. Updated May 2005. <br />
<p><span style="font-weight: normal;">Updated for Hugin 2010.2, Nov 2010 by Terry
Duell</span><b><br />




Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks