[d80138]: tutorials / Mosaic-mode / en.shtml  Maximize  Restore  History

Download this file

121 lines (112 with data), 6.3 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);
  </style>
  
  <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 murals using mosaic mode</h1>
<p><strong>This tutorial covers another non-panoramic usage of Hugin
&#8212; Taking two or more partial images of a mural on a flat surface, 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
the
same.</em>
<p>Normal panoramas are stitched from a number of photos taken from the
same location such that the nodal point of the lens stays stationary
and the camera is rotated in pitch, yaw or roll in order to capture the
set of overlapping images necessary for the panorama. This approach
minimises parallax errors, and all the photos are then
aligned into a panorama on the surface of a sphere by optimising
(minimising the errors) of the yaw, pitch and roll angles. </p>
<p>Mosaic mode allows you to shoot photos of any flat, or plane surface
such as a mural, from multiple positions and angles, and then stitch
the
photos together into a seamless view of the mural. One advantage of
this mode is that as the camera location is unrestricted, parallax can
be used to expose parts of the mural in one photo that may be obscured
in another, and in the final stitch any objects in front of the mural
may be masked out.
</p>
<p>In mosaic mode we are interested in the scene on the flat surface,
and as there is no parallax involved with elements of a flat scene we
can allow the camera to move. The alignment of the photos is done by
optimising translations in the X,Y and Z directions. X is left/right, Y
is up/down and Z is into/out of the image.
</p>
<p>Here is a contrived example to demonstrate the basics of stitching
in mosaic mode.</p>
<p><img style="width: 800px; height: 600px;" alt="overview" src="overview.jpg" />
</p>
<p>I have taken two images which will allow the chair to be masked out
in the final stitch. You can download these images and try it yourself,
<a href="first.jpg">first.jpg</a>, <a href="second.jpg">second.jpg</a>.</p>
<p>In hugin, select<span style="font-weight: bold;"> Assistant 1. Load
images</span>, and then select the <span style="font-weight: bold;">images</span>
tab and <span style="font-weight: bold;">Create control points</span>.</p>
<p>Select the Control points tab and check that all of the automatically
generated control points are on the flat surface. Delete any points
that are not.</p>
<p>
<img style="width: 800px; height: 586px;" alt="control points" src="control-points.jpg" /></p>
<p>
Now select the <span style="font-weight: bold;">Optimizer</span> tab
and select <span style="font-weight: bold;">Positions and Translation
(y,p,r,x,y,z)</span>, then select <span style="font-weight: bold;">Optimize
now!</span> and if the error is small, select <span style="font-weight: bold;">yes</span>.</p>
<p>
<img style="width: 800px; height: 587px;" alt="optimise-OK" src="optimise-done.jpg" /></p>
<p>
You can now select the <span style="font-weight: bold;">Fast preview
window</span> to see the basic alignment. Select <span style="font-weight: bold;">Projection</span>, then select <span style="font-weight: bold;">Rectilinear</span>. Move the sliders to
adjust the field of view, then select <span style="font-weight: bold;">Move/Drag</span>
and select 
<span style="font-weight: bold;">Drag mode: Mosaic</span>. Using
the mouse you can drag the image into a suitable position in the window
by holding down the left mouse key whilst dragging. Dragging with the
right mouse button down will rotate the image.</p>
<p>We can now mask out the chair. Select the <span style="font-weight: bold;">Mask</span> tab in main hugin window then
select image 0 (#0), <span style="font-weight: bold;">Add new mask</span>.
You
can then use the mouse to define a mask boundary using the left mouse
button to define points. Double click on the last point to end.
(See
the tutorial <a href="../Blend-masks">Blend-masks</a>). After defining the mask boundary you can
change the
mask type if necessary. For this exercise we want <span style="font-weight: bold;">Exclude region</span> masks.</p>
<p>
<img style="width: 800px; height: 588px;" alt="mask-0" src="mask-0.jpg" />
</p>
<p>Generate a similar mask for image #1. It isn't necessary to exactly
follow the boundary of the chair.</p>
<p>We can now stitch and we should end up with a nice view of the mural
without the chair. Go to the <span style="font-weight: bold;">Stitcher</span>
tab, select your file format (<span style="font-weight: bold;">Normal
outputs: JPEG</span> or <span style="font-weight: bold;">TIFF</span>),
and then select <span style="font-weight: bold;">Stitch now!</span>
and enter a filename for the resulting image in the file browser window
that opens.</p>
<p><img style="width: 800px; height: 588px;" alt="stitch" src="sticher.jpg" /></p>
<p><img style="width: 800px; height: 427px;" alt="stitch" src="test-3.jpg" /></p>
<p>The result is a view without the obstructing chair. It is pity I
didn't take another shot that would allowed the street sign to be
masked out as well.
This is a simple example of how mosaic mode can be used, and should
help you get started.</p>
<h2>Advanced techniques</h2>
<p>If your subject is not a nice flat plane surface, such as the front of
a row of terrace houses, or things are not going as smoothly as shown
here, have a look at Yuval Levy's <a href="http://panospace.wordpress.com/2010/09/19/linear-panoramas-mosaic-tutorial/">tutorial</a>
which describes a more difficult subject.</p>
<h2>About this mural</h2>
<p>This mural is painted on a wall in Hall Street, Moonee Ponds, Victoria.</p>
<p><em>Author <span style="text-decoration: underline;">Terry Duell</span>
-
Created September 2010.
</em></p>
</div>

</body></html>