orienting a panorama by the sun

227 views
Skip to first unread message

kfj

unread,
Aug 2, 2012, 3:04:15 PM8/2/12
to hugi...@googlegroups.com
Hi group!

I just came up with a neat trick to orient my panoramas (like, when I publish them on 360cities). If I have the sun visible in the panorama, I enter 'sun', the date/time and position into Wolfram Alpha, like this:

sun July 9 2012 18:37 at 45.338 N 7.2524 E

after a bit of trundling and the assumption that I mean the sun as a celestial body, it tells me, among other stuff, that the azimuth is 275.9 - this figure is in degrees, clockwise from north.

This is just the figure I need when I set the orientation in 360cities, and I had thought of calculating the figure earlier, but never actually done it, because it was too much effort to do the calculation. But Wolfram Alpha is smart enough to figure it all out just from the one line of data above!

Kay



Carl von Einem

unread,
Aug 3, 2012, 4:20:18 AM8/3/12
to hugi...@googlegroups.com
I usually use <http://udeuschle.de/Panoramen.html> when I see some peaks
in my panorama, but your solution is pretty elegant. Thanks for sharing!

Carl

kfj schrieb am 02.08.12 21:04:

kfj

unread,
Aug 3, 2012, 6:01:46 AM8/3/12
to hugi...@googlegroups.com, ca...@einem.net


Am Freitag, 3. August 2012 10:20:18 UTC+2 schrieb zarl:
I usually use <http://udeuschle.de/Panoramen.html> when I see some peaks
in my panorama, but your solution is pretty elegant. Thanks for sharing!



Deuschle's site is indeed excellent, and I've been using it for my 'canonical' panoramas from mountaintops, where I set something like a dozen CPs between real images and the artificial panorama (which I extract from what Deuschle's site produces by means of a screenshot). I even wrote a script to extract the GPS position from the panorama and emit the necessary commands to collect the artifical panorama... but it's still a bit of work, more than just asking Wolfram Alpha for the position of the sun. And the DEM data from viewfinderpanoramas.org which Deuschle uses aren't totally correct, either...

I played a bit more with the 'sun method' and first I found that Wolfram Alpha is quite peculiar about how the question is put together - I only get the azimuth and elevation if I use precisely the format I gave above. Why the elevation? I've extended the method like this:

I have made a 360X180 degree grid with the gimp. I add this as a 360 degree spherical image to my pano. Then I set a control point between the image of the sun and the 'proper' point on the grid (like, 92 degrees azimuth and 32 degrees elevation) and use the grid image as position anchor. After optimizing, this gave me a pano which was perfectly level and oriented with it's image center to true south (admittedly I had a vertical line as well, but only one, so it wasn't enough to level the horizon). It definitely helps to have one fixed point in a landscape!

Kay

JohnPW

unread,
Aug 7, 2012, 10:56:57 PM8/7/12
to hugi...@googlegroups.com, ca...@einem.net
That's pretty cool. Thanks.

Naked Robot

unread,
Aug 9, 2012, 6:39:02 AM8/9/12
to hugi...@googlegroups.com, ca...@einem.net
hi,

We had the idea years ago to use the sun as a way to get proper heading. Also to use a mountain database, for panos in the mountains.

But in the end, we are 2 or 3 overworked developers with way too many things to do, and these things are WAY down on the todo list. Sorry :(

kfj

unread,
Aug 10, 2012, 1:20:06 PM8/10/12
to hugi...@googlegroups.com, ca...@einem.net


Am Donnerstag, 9. August 2012 12:39:02 UTC+2 schrieb Naked Robot

We had the idea years ago to use the sun as a way to get proper heading. Also to use a mountain database, for panos in the mountains.

So now I can assure you that your ideas work ;-)
A mountain database in itself isn't so useful, since you need to know the name of the mountain which you want to use for the purpose. When I'm out there, I ofthen don't have a clue which peak is which, but when I see an artificial pano I can figure out quite easily what corresponds to my images.
 
But in the end, we are 2 or 3 overworked developers with way too many things to do, and these things are WAY down on the todo list. Sorry :(
 
What might be a nice idea to implement is the foundation needed for stuff like this: Control points which 'pin' a point in an image to a pair of coordinates. In the CP tab, you click on, say, the sun, set 'coordinate control point' for CP type, and you get a popup to enter the coordinates. Having this CP type allows plugins to use it as well, and so it becomes easy to write a 'click on the sun' plugin - the plugin can grab UTC and location from the image and calculate or look up the sun's position, add a 'coordinate control point', ready.

This is, after all, what I do when I add a full spherical image with a degree grid and set a CP to the right spot on it. Would be plugin-able too.

Most of the time with my latest bunch of panos, I just grabbed the azimuth from Wolfram Alpha and oriented the image in 360cities' direction dialog. This was fast and convenient - I kept Wolfrm Alpha open in one tab and 360cities in the other and only changed the time (I was roughly in the same area, so I only updated position and date every so often) - and this gave me the figure I had to rotate to in the 360cities orientation dialog.

Another use for this type of control point would be to fix the horizon (especially if it would also be allowed to only fix only one coordinate).

The setting of CPs with artificial panoramas works for me, using simulated panoramas from Deuschle's site, but it takes a bit of doing. I usually only do it when my pano looks wrong and I can't make it look right otherwise - or when I want to be really precise. Another candidate for a plugin - grab a simulated pano and add it to the image list - but so far there is no automatic image download from this site.

Kay

kfj

unread,
Jan 20, 2014, 3:17:41 AM1/20/14
to hugi...@googlegroups.com
On Friday, August 3, 2012 12:34:15 AM UTC+5:30, kfj wrote:
Hi group!

I just came up with a neat trick to orient my panoramas (like, when I publish them on 360cities). If I have the sun visible in the panorama, I enter 'sun', the date/time and position into Wolfram Alpha, like this:

sun July 9 2012 18:37 at 45.338 N 7.2524 E

After using this method for a while, I became annoyed with Wolfram alpha, because it was so very picky about what you have to enter, and I found no way to just get the azimuth and nothing else. So I opted to write a little python script which reads out the relevant EXIF tags from an image with the pyexiv2 module (GPS Date, GPS Time, GPS Longitude and GPS Latitude) and calculates the sun's position using the pysolar module. The script gives the azimuth in degrees clockwise off north, as required by the orientation dialog in 360cities, who host my full spherical panoramas. Interested? Download the script from here:

http://bazaar.launchpad.net/~kfj/+junk/script/download/head:/sun_position-20140120072527-vlz6gee23xhwlkrl-1/sun_position

and put it into /usr/local/bin or somewhere else in your path.

You'll obviously have to have the pyexiv2 module and pysolar installed; I got pyexiv2 via my package management (I'm on Kubuntu 12.04). pysolar can be had from http://pysolar.org/

usage is simple, just pass the image's filename to the scipt and it outputs the azimuth and altitude:

$ sun_position IMG_5458.CR2
azimuth (clockwise, N = 0 degrees): 204.558020 altitude 57.709008

I hope this works generally - I geotag my images from gpx tracks, using exiftool -geotag, so the images have these GPS-related tags (printed with exiftool):

GPS Version ID                  : 2.3.0.0
GPS Latitude Ref                : North
GPS Longitude Ref               : East
GPS Altitude Ref                : Above Sea Level
GPS Time Stamp                  : 12:25:07
GPS Date Stamp                  : 2013:08:09
GPS Altitude                    : 1022.8 m Above Sea Level
GPS Date/Time                   : 2013:08:09 12:25:07Z
GPS Latitude                    : 46 deg 1' 30.64" N
GPS Longitude                   : 8 deg 25' 49.52" E
GPS Position                    : 46 deg 1' 30.64" N, 8 deg 25' 49.52" E

In 360cities, I put the sun into the center in the orientation window, then click on the button in the top right corner and drag the tip of the compass until the number shown is equal to the azimuth.

Again this made me wish there was something like an 'absolute' control point type in hugin, where you can just enter an azimuth and an altitude value (call it yaw and pitch if you like) to set the orientation of the panorama. Then it would be as easy as 'click on the sun and set an absolute control point'. Add the nadir in the same way, and the panorama is perfectly oriented and levelled.

Kay
Reply all
Reply to author
Forward
0 new messages