How Does Hugin Arrive at the Resulting Canvas Size?

865 views
Skip to first unread message

Calvin McDonald

unread,
Sep 26, 2011, 2:37:24 PM9/26/11
to hugi...@googlegroups.com
Why does Hugin consistently build results much smaller than the dimensions it gives me if I click "Calculate optimal size"?

My lens has an angle-of-view of 46 degrees (on the sensor) in the horizontal direction.
I take 12 images per row.
So of the 46 degrees captured per image, 30 degrees are needed to complete the pano.
I believe this is approximately a 35% overlap.
This tells me that of each image of the 12 that 65% of the pixels will end up being used (on average).
My sensor in the horizontal direction is 2,592 pixels.

My simple mind wants to believe that the resulting stitched image will be approximately 2,592 * 0.65 * 12 = 20,218 pixels.
But Hugin generates a 13,250 x 6,625 result (or thereabouts).

When I load an image-set and click on "Calculate optimal size" Hugin sets the Canvas Size to 19,450 x 9,725.  It appears my math is consistent with what Hugin tells me the "optimal" size is.  But without exception when a pano is complete the X dimension is in the low 13,000 range.

Would someone kindly explain to me the reason for this difference?

Thanks

Carlos Eduardo G. Carvalho (Cartola)

unread,
Sep 26, 2011, 3:34:12 PM9/26/11
to hugi...@googlegroups.com
I never did this math nor thought about it :) but have you already forced a 20k px width image to see what happens?

Thinking about my usual lens (Opteka 6.5mm), I can do the horizontal with 4 images with some overlap. I use the camera in vertical position, so the width is 3456 pixels (Canon T2i). When I click to get the optimal size I usually get around 12k pixels, so it sounds me ok. When I did it with a Sigma 10-20mm@10mm I got around 15/16k pixels width.

Cheers,

Carlos E G Carvalho (Cartola)
http://cartola.org/360



2011/9/26 Calvin McDonald <c...@ckmcdonald.com>

--
You received this message because you are subscribed to the Google Groups "Hugin and other free panoramic software" group.
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugi...@googlegroups.com
To unsubscribe from this group, send email to hugin-ptx+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx

Bruno Postle

unread,
Sep 26, 2011, 5:12:23 PM9/26/11
to Hugin ptx
On Mon 26-Sep-2011 at 11:37 -0700, Calvin McDonald wrote:

>When I load an image-set and click on "Calculate optimal size" Hugin sets
>the Canvas Size to 19,450 x 9,725. It appears my math is consistent with
>what Hugin tells me the "optimal" size is. But without exception when a
>pano is complete the X dimension is in the low 13,000 range.

When you create a project with the Assistant tab, Hugin downscales
the canvas size from the 'optimal' size - The amount is configurable
in Preferences -> Assistant -> Downscale final pano.

It does this because it speeds up stitching, and you lose hardly any
information doing this with typical digital photos.

(Camera CCDs use a Bayer pattern, so for example an 8 megapixel
camera only has 4 megapixels of green, and two megapixels of red and
blue)

--
Bruno

Calvin McDonald

unread,
Sep 27, 2011, 9:16:24 AM9/27/11
to hugi...@googlegroups.com
Bruno:

Thanks - you pointed out my problem correctly.  My downscaling preference was set to 70.  I didn't even know Hugin had this feature and have been suffering the results of it on every pano I've done apparently since I last updated Hugin.

Does Hugin really come built with this set to 70?

In reading the Hugin help it makes it sound like the downscaling is a post processing activity.  It even claims the algorithm is inferior and suggests if downscaling is needed to use an image editor post-Hugin.  If it's really a post processing activity I wouldn't think it would speed up the stitching process.

Can someone tell me why in general someone would want their pano downscaled by Hugin?
In other words, is there a good reason to set this to something besides 100%?

I did change my "Downscale final pano" to 100% and the resulting pano was 19,450 x 9,725 - the same as Hugin estimated when I click "Calculate optimal size..." under the Stitcher tab.

Thanks Bruno and Carlos for the help.
Calvin

Bruno Postle

unread,
Sep 27, 2011, 4:56:57 PM9/27/11
to Hugin ptx
On Tue 27-Sep-2011 at 06:16 -0700, Calvin McDonald wrote:
>
>In reading the Hugin help it makes it sound like the downscaling is a post
>processing activity. It even claims the algorithm is inferior and suggests
>if downscaling is needed to use an image editor post-Hugin. If it's really
>a post processing activity I wouldn't think it would speed up the stitching
>process.

Hugin is really bad at heavy downscaling, but 70% is gentle enough
not to produce any aliasing artefacts. If you want smaller than
this, you should stitch a big picture, then scale it down in an
image editor.

>Can someone tell me why in general someone would want their pano downscaled
>by Hugin?
>In other words, is there a good reason to set this to something besides
>100%?

Yes, photos taken with a normal CCD and processed with a deBayer
filter have a lot of redundant data. i.e. you can sample them at
70% size, process less pixels, and end up with the same amount of
useful information.

--
Bruno

Erik Krause

unread,
Sep 27, 2011, 5:07:53 PM9/27/11
to hugi...@googlegroups.com
Am 27.09.2011 15:16, schrieb Calvin McDonald:
> Can someone tell me why in general someone would want their pano
> downscaled by Hugin?
> In other words, is there a good reason to set this to something besides
> 100%?

Yes. The 70% rule was introduced by Ken Turkowski, QTVR pioneer at
Apple. He found out that you can downscale a Bayer interpolated image
(as most digital camera images are) to 70% without loosing relevant
image information. You can try it: Downscale an image to 70%, then
upscale again to original size. Compare with the original.

This might or might not hold true, depending on image content. While
color information is indeed upscaled during Bayer interpolation,
brightness information could be taken from any sensor pixel. Hence one
could assume that a more or less black and white image with high
contrast might suffer more from downscaling than a low contrast but very
colored one.

--
Erik Krause
http://www.erik-krause.de

kfj

unread,
Sep 29, 2011, 1:19:10 PM9/29/11
to hugin and other free panoramic software
On 27 Sep., 23:07, Erik Krause <erik.kra...@gmx.de> wrote:
> Am 27.09.2011 15:16, schrieb Calvin McDonald:
>
> > Can someone tell me why in general someone would want their pano
> > downscaled by Hugin?
> > In other words, is there a good reason to set this to something besides
> > 100%?
>
> Yes. The 70% rule was introduced by Ken Turkowski, QTVR pioneer at
> Apple. He found out that you can downscale a Bayer interpolated image
> (as most digital camera images are) to 70% without loosing relevant
> image information. You can try it: Downscale an image to 70%, then
> upscale again to original size. Compare with the original.

I tried, and indeed the difference is nearly invisible. When I put the
original and the scaled-down-and-up-again image in two layers and
looked at them with difference layer mode and brightened by a few 100
percent, a ghost image occured showing what had gone missing: very
fine contrast. Not really visible at all, even though it's detectable
- and I only used cubic interpolation, so if I used something better
the effect migt even be less.

This was on a landscape taken RAW with a decent lens on a EOS 450D,

> This might or might not hold true, depending on image content. While
> color information is indeed upscaled during Bayer interpolation,
> brightness information could be taken from any sensor pixel. Hence one
> could assume that a more or less black and white image with high
> contrast might suffer more from downscaling than a low contrast but very
> colored one.

The differences were largest in areas with small detail, as expected
(grass in the foreground) and along high-contrast edges.

I'd add that it does also depend on what camera/lens you're using. If
I take zoom images with the 450 D's kit lens, I don't even expect 70%.
And when the images are warped and blended, there's two more
processing steps which lower resolution, so the resulting image is
slightly blurred compared to the input anyway (unless there's some
superresolution magic going on). 70% is probably even a bit
optimistic, then. I usually go for something like 50 - the visible
difference is small and proecessing is much faster.

Kay
Reply all
Reply to author
Forward
0 new messages