How do I keep a rectangular image as a rectangle in the output?

57 views
Skip to first unread message

Ken Shirriff

unread,
Nov 16, 2025, 4:30:34 AM (5 days ago) Nov 16
to hugin and other free panoramic software
I'm stitching together microscope photos taken on an X-Y stage. However, the images end up slightly distorted because Hugin treats everything as spherical rather than rectilinear. I use an equirectangular projection to position the images planarly, which helps. However, images end up slightly trapezoidal as the pitch increases, which I don't want. I thought the equirectangular lens would fix this, but changing the lens type seems to make no difference. (Maybe I'm using the lenses wrong?)

I'm using a small FOV (1 degree) for the images, but I'm still getting enough distortion to cause difficulty. Is there a way to make Hugin keep a rectangular source image as a rectangle in the output?

I'm sure I'm mangling the terminology here, but hopefully this question makes sense. 

Thank you,
Ken

Bruno Postle

unread,
Nov 16, 2025, 5:05:00 AM (5 days ago) Nov 16
to hugin and other free panoramic software
Hi Ken, yes you need to use rectilinear for both the unit and output projection, this will preserve straight lines - Bruno

dkloi

unread,
Nov 16, 2025, 7:54:37 AM (5 days ago) Nov 16
to hugin and other free panoramic software
You may want to look into mosaic mode e.g.

https://hugin.sourceforge.io/docs/manual/Stitching_a_photo-mosaic.html

The images are treated as lying on a plane, not a sphere. You should be able to translate and the rotate the virtual camera to get the desired framing, tilt, and shift with respect the placement of the image on them plane.

Ken Shirriff

unread,
Nov 16, 2025, 1:07:05 PM (5 days ago) Nov 16
to hugin and other free panoramic software
Awesome, mosaic mode (TrX, TrY) with rectilinear lenses and projection does what I want. One question: what are the units for TrX and TrY? By experimentation, 1º is approximately 0.0175 for TrX/TrY. But I assume there's some geometrical interpretation.

Ken Shirriff

unread,
Nov 16, 2025, 1:32:55 PM (5 days ago) Nov 16
to hugin and other free panoramic software
It looks like TrX and TrY are in radians?

Bruno Postle

unread,
Nov 16, 2025, 2:02:11 PM (5 days ago) Nov 16
to hugin and other free panoramic software
The translation parameters are linear distances. Imagine that the photos are each being projected onto a wall by portable slide projectors, and you are viewing this wall from a distance of one unit. The coordinates for each projector are trx try trz (you are at 0,0,0) - Bruno


On Sun, 16 Nov 2025, 18:32 Ken Shirriff wrote:
It looks like TrX and TrY are in radians?

On Sunday, November 16, 2025 at 10:07:05 AM UTC-8 Ken Shirriff wrote:
Awesome, mosaic mode (TrX, TrY) with rectilinear lenses and projection does what I want. One question: what are the units for TrX and TrY? By experimentation, 1º is approximately 0.0175 for TrX/TrY. But I assume there's some geometrical interpretation.
Bruno

Ken Shirriff

unread,
Nov 17, 2025, 1:36:00 PM (4 days ago) Nov 17
to hugin and other free panoramic software
Thanks! One (hopefully) final question: how do I center a mosaic image? If I try to center it in Panorama Preview, the pitch and yaw get set, causing the image to be tilted rather than shifted. What I want is the translation parameters to get changed to move the center of the image.
Ken

Luís Henrique Camargo Quiroz

unread,
Nov 17, 2025, 2:40:32 PM (4 days ago) Nov 17
to hugi...@googlegroups.com
    Hi Ken!
    

--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hugin-ptx+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hugin-ptx/117cf464-97ec-4c3b-bda5-9954cdb577f5n%40googlegroups.com.


--
--
Luis Henrique Camargo Quiroz

Luís Henrique Camargo Quiroz

unread,
Nov 17, 2025, 2:51:23 PM (4 days ago) Nov 17
to hugi...@googlegroups.com
    Hi Ken!
    Glad there is only one question now - or none at all.
    With a "regular' panorama it makes sense to choose an adequate center for the image, say, pointing North or to some interesting feature in the image. However, panning the panorama in a viewer (standalone or through an internet page) you could see anywhere you want.
    For your rectangular image, a mosaic of microscope photos, how will you see or present it to others? Using an image editor like Gimp, or maybe OpenSeadragon to show (efficiently) a very high resolution image in an internet page? In both cases the image will be presented centered in the window, scaled for best fit. The center will ever be the center of the image (or viewing window), and you could pan and zoom without difficulty. There is no need to define a center for your image! 

    Hope this makes sense, 

    Luís Henrique

Em seg., 17 de nov. de 2025 às 15:36, Ken Shirriff <ken.sh...@gmail.com> escreveu:
--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hugin-ptx+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hugin-ptx/117cf464-97ec-4c3b-bda5-9954cdb577f5n%40googlegroups.com.

Bruno Postle

unread,
Nov 17, 2025, 4:11:34 PM (4 days ago) Nov 17
to hugi...@googlegroups.com
Hi Ken, in the Fast Preview window > Move/Drag tab, there is a
'mosaic' Drag mode that will let you drag the mosaic around the canvas
without tilting it or adding distortion - Bruno

On Mon, 17 Nov 2025 at 18:36, Ken Shirriff wrote:
>
> Thanks! One (hopefully) final question: how do I center a mosaic image? If I try to center it in Panorama Preview, the pitch and yaw get set, causing the image to be tilted rather than shifted. What I want is the translation parameters to get changed to move the center of the image.


--
Bruno

Ken Shirriff

unread,
Nov 19, 2025, 12:52:29 PM (2 days ago) Nov 19
to hugin and other free panoramic software
Thanks! That feature is exactly what I was looking for. I should take a closer look at Fast Preview, since it seems to have a lot of interesting functions.
Ken

Reply all
Reply to author
Forward
0 new messages