new panini projection

413 views
Skip to first unread message

Daniel M German

unread,
Dec 29, 2008, 7:10:17 AM12/29/08
to hugi...@googlegroups.com, panotoo...@lists.sourceforge.net

Hi Everybody,

I just committed this change.

2008-12-29 dmg <d...@uvic.ca>

* panorama.h, math.c, adjust.c, queryfeature.c, filter.h,
parser.c: Added panini projection. the credit goes to Thomas
Sharpless who rediscovered it, and to Bruno Postle, who did the
original math.


I'll try to add the "architectural" in the next few days.

I'll let Bruno and Tom provide the background and math, both are
fascinating.

I have only tested it going from equirectangular to panini, but it
should work like any other. We might need some more changes to the
library before hugin can use it, though.


--dmg

Bruno Postle

unread,
Dec 29, 2008, 12:57:38 PM12/29/08
to Hugin ptx
On Mon 29-Dec-2008 at 04:10 -0800, Daniel M. German wrote:
>
>I'll let Bruno and Tom provide the background and math, both are
>fascinating.

There was a long thread on hugin-ptx where Tom and myself picked
apart a Panini painting of St Peter's with some strange perspective
effects. It turns out that hardly any of these great 'vedutismo'
paintings have a standard 'rectilinear' photographic perspective.

There is a very simple projection that does the same kind of thing,
vertical lines are preserved as vertical, radial lines (i.e. the
lines that radiate from the vanishing point) are preserved as
straight, and objects near the horizon have no local distortion.

Using this projection it is possible to create images with extreme
wide angles (over 200°) that look like normal perspectives, I've
uploaded a few here:

http://www.flickr.com/groups/vedutismo/

..and here is a mathmap script that will convert a normal 360°
cylindrical panorama:

filter panini (image in, float FoV: 1-360 (230.07), float pan: -180-180 (0.0))
# Vedutismo / Panini effect
# Bruno Postle December 2008
# input is any 360 cylindrical image
maxphi=atan(pi/2);
newphi=FoV*pi/360/2;
scale=tan(newphi)/tan(maxphi);
phi=atan(x*scale*pi/W);
yscale=cos(phi)*cos(phi);
in(xy:[phi/pi*W+(W*pan/360),y*scale*yscale])
end

--
Bruno

Yuval Levy

unread,
Dec 29, 2008, 2:37:47 PM12/29/08
to hugi...@googlegroups.com
Hi Daniel,

> I just committed this change.
>
> 2008-12-29 dmg <d...@uvic.ca>
>
> * panorama.h, math.c, adjust.c, queryfeature.c, filter.h,
> parser.c: Added panini projection. the credit goes to Thomas
> Sharpless who rediscovered it, and to Bruno Postle, who did the
> original math.

THANKS A LOT!


> I have only tested it going from equirectangular to panini, but it
> should work like any other. We might need some more changes to the
> library before hugin can use it, though.

I found a small bug in the library (even before the introduction of
Panini) that would enumerate one projection too many in the hugin drop
down of available projections. And Panini was missing in there, so I added
it. I don't think I have commit rights to panotools, and I'm anyway on
very limited infrastructure for another ten days. Find my patch to libpano
attached. The hugin stuff will come in a subsequent mail, with a blog
article on how to do that (I hope to entice newbie contributors to put
their hands under the hood of hugin, and maybe you will help me with
something similar for the projections in panotools?).

Yuv

Yuv

libpano.panini.patch

Daniel M German

unread,
Dec 29, 2008, 4:49:30 PM12/29/08
to hugi...@googlegroups.com, panotoo...@lists.sourceforge.net

>> I have only tested it going from equirectangular to panini, but it
>> should work like any other. We might need some more changes to the
>> library before hugin can use it, though.

Yuval> I found a small bug in the library (even before the introduction of
Yuval> Panini) that would enumerate one projection too many in the hugin drop

Mmm, I just checked and I think libpano code is ok. It might be the
code in hugin. panoProjectionFormatCount returns exactly the enumber
of projections available (currently 13, including panini), numbered
from 0 to 12.

Panini is #12 in panotools.

Anybody wants to try it?

Yuval> down of available projections. And Panini was missing in there, so I added
Yuval> it. I don't think I have commit rights to panotools, and I'm anyway on
Yuval> very limited infrastructure for another ten days. Find my patch to libpano
Yuval> attached. The hugin stuff will come in a subsequent mail, with a blog
Yuval> article on how to do that (I hope to entice newbie contributors to put
Yuval> their hands under the hood of hugin, and maybe you will help me with
Yuval> something similar for the projections in panotools?).

I had done the changes last night already, and I committed them few
minutes ago. your code was good, except that it was missing the
maximum vFOV and hFOV values that libpano should return to hugin.

By the way, I have hardcoded 220 degrees as the maximum hFOV. Anything
bigger is just, well, unusable ;) vFOV is set to 180, but 90 is a more
practical one.

--dmg

--
Daniel M. German "We die. That may be the meaning of life.
But we do language. That may be
Toni Morrison -> the measure of our lives."
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .


Daniel M German

unread,
Dec 29, 2008, 4:51:26 PM12/29/08
to hugi...@googlegroups.com

Bruno> On Mon 29-Dec-2008 at 04:10 -0800, Daniel M. German wrote:
>>
>> I'll let Bruno and Tom provide the background and math, both are
>> fascinating.

Bruno> There was a long thread on hugin-ptx where Tom and myself picked
Bruno> apart a Panini painting of St Peter's with some strange perspective
Bruno> effects. It turns out that hardly any of these great 'vedutismo'
Bruno> paintings have a standard 'rectilinear' photographic perspective.

Bruno> There is a very simple projection that does the same kind of thing,
Bruno> vertical lines are preserved as vertical, radial lines (i.e. the
Bruno> lines that radiate from the vanishing point) are preserved as
Bruno> straight, and objects near the horizon have no local distortion.

Bruno> Using this projection it is possible to create images with extreme
Bruno> wide angles (over 200°) that look like normal perspectives, I've
Bruno> uploaded a few here:


As a clarification, we are using equirectangular as the intermediary
projection. It will be interesting to see the effect that other
cylindrical projections have on the final result.

--dmg


--
Daniel M. German "Beware of bugs in the above code;
I have only proved it
Donald Knuth -> correct, not tried it."

Daniel M German

unread,
Dec 29, 2008, 5:00:52 PM12/29/08
to hugi...@googlegroups.com, panotoo...@lists.sourceforge.net

>> I have only tested it going from equirectangular to panini, but it
>> should work like any other. We might need some more changes to the
>> library before hugin can use it, though.

Yuval> I found a small bug in the library (even before the introduction of


Yuval> Panini) that would enumerate one projection too many in the hugin drop

Mmm, I just checked and I think libpano code is ok. It might be the
code in hugin. panoProjectionFormatCount returns exactly the enumber
of projections available (currently 13, including panini), numbered
from 0 to 12.

Panini is #12 in panotools.

Anybody wants to try it?

Yuval> down of available projections. And Panini was missing in there, so I added
Yuval> it. I don't think I have commit rights to panotools, and I'm anyway on
Yuval> very limited infrastructure for another ten days. Find my patch to libpano
Yuval> attached. The hugin stuff will come in a subsequent mail, with a blog
Yuval> article on how to do that (I hope to entice newbie contributors to put
Yuval> their hands under the hood of hugin, and maybe you will help me with
Yuval> something similar for the projections in panotools?).

I had done the changes last night already, and I committed them few
minutes ago. your code was good, except that it was missing the
maximum vFOV and hFOV values that libpano should return to hugin.

By the way, I have hardcoded 220 degrees as the maximum hFOV. Anything
bigger is just, well, unusable ;) vFOV is set to 180, but 90 is a more
practical one.

--dmg

--


Daniel M. German "We die. That may be the meaning of life.
But we do language. That may be
Toni Morrison -> the measure of our lives."

Tom Sharpless

unread,
Dec 29, 2008, 6:26:29 PM12/29/08
to hugin and other free panoramic software
Hi Daniel

On Dec 29, 7:10 am, Daniel M German <d...@uvic.ca> wrote:
> Hi Everybody,
>
> I just committed this change.
>
> 2008-12-29 dmg <d...@uvic.ca>
>
> * panorama.h, math.c, adjust.c, queryfeature.c, filter.h,
> parser.c: Added panini projection. the credit goes to Thomas
> Sharpless who rediscovered it, and to Bruno Postle, who did the
> original math.
>

I won't take credit for rediscovering anything, only for bugging Bruno
about vedute perspective until he did it.

Since first seeing Piranesi's work about 10 years ago, I have wondered
how he and other Baroque masters could draw those impossibly wide
perspective views. When I got into panoramic photography, and found
the available projections rather disappointing for wide angle prints,
I became really keen to know their secrets, which I felt might help us
render similar views photographically. But I had no idea how to
discover them,and did nothing. Then my wife bought a picture puzzle
of one of Panini's views of St Peters, and the pressure became
intolerable. So I moaned to Bruno until he took a few looks and
thought a bit, and voila! the Panini projection was rediscovered.

I will take credit for programming the first interactive tool that can
convert panos to Paninis, a program I first called the pvQt pano
viewer and now call panini. It is a kind of software view camera for
panographers, but the Panini projection is its most valuable trick.
The initial version of panini will be released before New Years.

Regards, Tom



Tom Sharpless

unread,
Dec 29, 2008, 6:27:09 PM12/29/08
to hugin and other free panoramic software
Hi Bruno

Thanks for setting up the Flickr group, Vedutismo. I just put two
paninis there, and will add a few more soon.

-- Tom

Benjamin Schnieders

unread,
Jan 11, 2009, 4:15:33 PM1/11/09
to hugi...@googlegroups.com
Hi all,

just created my first panorama using the panini projection - compared to
equirectangular - which would have been my first choice - it somehow
added more depth to the scene. (a small cemetery with winterly trees in
the background)

anyway, since there are so many projections now, maybe we should think
about ordering them? something like "keeps straight lines", "keeps
angles", "keeps areas equal" or "mixed", as the architectural
projection. or are the projections too different to be classified like that?

thx to all developers :) can't imagine working without hugin/panotools
anymore....

Benjamin

Bruno Postle

unread,
Jan 19, 2009, 7:04:03 PM1/19/09
to Hugin ptx
On Sun 11-Jan-2009 at 22:15 +0100, Benjamin Schnieders wrote:
>
>anyway, since there are so many projections now, maybe we should think
>about ordering them? something like "keeps straight lines", "keeps
>angles", "keeps areas equal" or "mixed", as the architectural
>projection. or are the projections too different to be classified like that?

The projections form two neat series of 'cylindrical' and
'azimuthal' types, all other projections are not so easy to
categorise. I've updated the wiki page on projections, so this may
make a bit more sense there:

http://wiki.panotools.org/Projections

--
Bruno

Erik Krause

unread,
Jan 20, 2009, 9:54:58 AM1/20/09
to hugi...@googlegroups.com
Bruno Postle wrote:

> The projections form two neat series of 'cylindrical' and
> 'azimuthal' types, all other projections are not so easy to
> categorise. I've updated the wiki page on projections, so this may
> make a bit more sense there:
>
> http://wiki.panotools.org/Projections

Many thanks! I'v added the (approximate) field of view for each example
image. There are some, where I probably didn't get it right from
counting the squares, so please correct if you have the exact values.


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

Tom Sharpless

unread,
Jan 20, 2009, 10:34:42 AM1/20/09
to hugin and other free panoramic software
Hi Bruno
Thanks for this helpful page.

Since the Pannini projections are just compressed cylindrical ones,
why not put them in the cylindrical category?

-- Tom
>
> --
> Bruno

Daniel M German

unread,
Jan 20, 2009, 10:58:52 AM1/20/09
to hugi...@googlegroups.com

Tom> Thanks for this helpful page.
Tom> Since the Pannini projections are just compressed cylindrical ones,
Tom> why not put them in the cylindrical category?

Hi Tom,

Pannini is not a cylindrical in the pure sense. It is a hybrid. It is
an azimuthal projection of a cylindrical one.

--dmg

paul womack

unread,
Jan 20, 2009, 11:41:20 AM1/20/09
to hugi...@googlegroups.com


One might (pedantically) call that a composite,
not a hybrid :-)

BugBear

Daniel M German

unread,
Jan 20, 2009, 11:44:20 AM1/20/09
to hugi...@googlegroups.com
paul womack twisted the bytes to say:

paul> Daniel M German wrote:
>>
>>
Tom> Thanks for this helpful page.
Tom> Since the Pannini projections are just compressed cylindrical ones,
Tom> why not put them in the cylindrical category?
>>
>> Hi Tom,
>>
>> Pannini is not a cylindrical in the pure sense. It is a hybrid. It is
>> an azimuthal projection of a cylindrical one.


paul> One might (pedantically) call that a composite,
paul> not a hybrid :-)

I like that term: compositional projections. Those created by the
composition of 2 or more projections.

Hybrids: those created by mixing 2 or more projections, each covering
part of the field of view.

--dmg

Bruno Postle

unread,
Jan 20, 2009, 5:19:17 PM1/20/09
to Hugin ptx
On Tue 20-Jan-2009 at 07:34 -0800, Tom Sharpless wrote:
>
>> http://wiki.panotools.org/Projections
>
>Thanks for this helpful page.
>
>Since the Pannini projections are just compressed cylindrical ones,
>why not put them in the cylindrical category?

..except that the pannini projection is as similar to stereographic
as it is to cylindrical.

The interesting thing about organising them like this is that it
shows that hugin/panotools now has a comprehensive range of
cylindrical and azimuthal output projections. The others are a bit
random: some composite/hybrid projections, one transverse.

--
Bruno

Tom Sharpless

unread,
Jan 22, 2009, 10:12:31 AM1/22/09
to hugin and other free panoramic software

On Jan 20, 11:44 am, Daniel M German <d...@uvic.ca> wrote:

> I like that term: compositional projections. Those created by the
> composition of 2 or more projections.
>
> Hybrids: those created by mixing 2 or more projections, each covering
> part of the field of view.
>
I agree on this terminology. And I think we will see more hybrids
soon.

That makes the Pannini a composition of the gnomonic and cylindrical
projections. But when I think "azimuthal" I think "curved
verticals". And in fact the gnomonic projection is no more azimuthal
than cylindrical or conic or anything else: it is the limit of all of
them as the eye point approaches the center of the panosphere, from
which point of view all proper projections of the sphere look the
same.

So by me, the Pannini really is a compressed cylindrical projection.
A stereographic view of the cylinder would not be, because the
stereographic is truly azimuthal.

--Tom
Reply all
Reply to author
Forward
0 new messages