How can I estimate 360 panorama heading?

I’ve been producing 360 equirectangular panoramas using my DSLR + Hugin, and a monster of a shell script to use exiftool to add in all the right EXIF and XMP tags. One of the tags I would like to set is XMP-GPano:PoseHeadingDegrees which is defined as:

Compass heading, measured in degrees clockwise from North, for the center the image. Value must be >= 0 and < 360.

Are there any software tools that can help me estimate the heading? Perhaps something that allows me to cross-reference the expected position of the sun at the coordinates and timestamp of the photo? At the moment, I can very roughly estimate heading based on memory and intuition, but maybe there’s a better way.

Ideally I’d just use a RICOH THETA or some other proper 360 camera with a built-in compass but my question is specifically about estimating the heading from the image data.

Time, Location and sun position should be anough information. Perhaps kStars can help:
https://edu.kde.org/kstars/

Perhaps @lock042 from the Siril has a good idea.

Besides the Sun location, if there are a couple of reference points visible in the picture (trees, buildings, etc.) you can just go to Google Maps, look at the satellite image of the area, and find the orientation of those reference points with respect to the picture location.

Since most of my 360 panoramas include the sun, i tried using KStars and that seems to work well!

  1. In Hugin use the Move/Drag tab to center the sun in the panorama (i.e. vertical line of the crosshairs crosses the sun). This step is important because later we will use the sun’s azimuth as the heading of the image itself.
  2. In KStars hit the “pause” button and change the date and time to the approximate time of image capture.
  3. Look for the sun and center your mouse over it. The Azimuth is listed in the status bar:

In the above screenshot, the azimuth is about 236 degrees. That is the number to use for XMP-GPano:PoseHeadingDegrees.

Now, I wonder if I can do this from the command line (e.g. feed a timestamp and coordinates, and return an Azimuth)

1 Like

Perhaps try to ask the developer of KStars

I found this nice page for calculation of the azimuth including an Excel spreadsheets:
Sonnenhoehe mit Tabellenkalkulation (de)
Basics of Positional Astronomy (en)

I think you can use this to calc the position. If you use darktable you could write a Lua script for this.