Stitching a flat mosaic

134 views
Skip to first unread message

Benjamin Hill

unread,
Mar 2, 2025, 6:56:43 PM3/2/25
to hugin and other free panoramic software
Is Hugin capable of this sort of thing or does it break the model?

I've got a downwards-facing camera taking pictures of a flat object (so I don't have to worry as much about parallax).  It moves in the X/Y plane.  A bit like a scanner. I'd like to stitch the tiles into a single image.  In theory, this should be easy - right?  Each image has an X/Y offset, and maybe a little rotation, but everything else is held constant.

The thing is, I'm not seeing a projection that works well with a flat image, all the projections are... well... projections.  They assume a fixed camera that rotates.

Is there a way to do this?

Terry Duell

unread,
Mar 2, 2025, 7:31:45 PM3/2/25
to hugi...@googlegroups.com
Take a look at the tutorial on stitching flat scanned images, on the hugin site.
It might be a help.

Cheers,
--
Terry Duell <tdu...@iinet.net.au>

Benjamin Hill

unread,
Mar 2, 2025, 9:52:13 PM3/2/25
to hugin and other free panoramic software
https://hugin.sourceforge.io/tutorials/scans/en.shtml didn't say much - it suggests "rectilinear" which gets warp-y as you go out towards the edges.

wirz

unread,
Mar 3, 2025, 12:45:29 PM3/3/25
to hugi...@googlegroups.com
Yeah, the scanner tutorial assumes actual images from a scanner, while I
assume you have a normal camera lens, but the procedure should be the
same. There are two projections to care about: input, which is whatever
your lens is (probably rectilinear), and output, where you can choose
freely, but you probably want rectilinear as well.

If things warp around the edges of your individual images, you may have
some lens parameters to optimise. That doesn't differ from any other pano.

There was a short thread on 15.2 where Thomas has explained the main
steps. If that doesn't help, you could post a few downsampled images so
we can see what's the matter.

best regards, lukas

Claudio Rocha

unread,
Mar 3, 2025, 1:20:11 PM3/3/25
to hugin and other free panoramic software
Yes, Hugin works quite well for the task. I've been doing that for years, digitizing paintings and flat art. I move the camera on a rail that runs parallel to the artwork like a big scanner. 

Some tips: 

Set the optimizer to use Roll (r), X (TrX), and Y(TrY).  Optimize. If the camera is not perfectly parallel to the flat surface you are reproducing, then enable Plane yaw and Plane pitch to correct and optimize again without resetting the already optimized translation and rotation values. Once I have done that second optimization, then I optimize for radial distortion (b) in the lens parameters. 

I usually like to shoot a grid chart or some kind of checkerboard pattern with the same lens used to make the images, so that I can determine the lens distortion and store it on an *.ini file to use on all of the images taken with that particular lens (see: https://hugin.sourceforge.io/tutorials/calibration/en.shtml), so that I don't have to calculate radial distortion on the optimizer.

I get good results using rectilinear projection. A trick I use is to set the FOV for the images to a very low value like 2.5 (the tutorial says 10, but that results on some curved lines sometimes).

For images that use only translation and rotation for the optimizer, you can also set the projection mode to Mosaic plane in the Preview Panorama (GL) window.
mosaic plane.jpg

To keep the edges really straight I create some control points to set horizontal and vertical lines, the procedure is similar to the one used in the lens calibration, except that the lines are set as horizontal or vertical.https://hugin.sourceforge.io/docs/manual/Straight_line_control_points.html
Reply all
Reply to author
Forward
0 new messages