Aurora: Pano creation 1

Updated March, 2018. Thank you so much Thomas Modes and Andrew Hazelden!

Hugin (FREE) click to go to the home page.

Here is the final result:

Zenith-nona-enblend

Hugin is a GUI (Graphical User Interface), a wrapper for a number of scripts under the hood. It has 3 versions of the interface: Simple, Advanced, Expert. But it is not obvious to the beginner in what order to do things. Much can and is done automatically for you, which is great, but can come at the cost of confusion if you are not doing a simple daytime panorama with lots of overlap and very obvious common points.

In order to do a time-lapse, the idea is simple enough: stitch one set of images with the GUI, click the Optimize button, save the parameters to the .pto file, then run the script with a big loop that calls the command-line utilities using the .pto file. Details and scripts can be found here: Stiching 3 cameras into a fisheye Aurora time-lapse with Hugin

Single stitching of a triplet

NLC-aurora imager extraordinaire Mike Noble provided me with the several thousand sets of images. Here is one such trio, with the left image looking WSW, the middle looking N, and the right pointing ESE:

Launch Hugin. From the Interface menu, choose Advanced. Load your images. Hugin is smart enough to detect the lens and its settings. There is a small chance the lens is new enough that it is not in the database, or that it is a "manual" lens. In that case, you will have to enter your best guesses for Hfov (horizontal field of view). The lensfun webpage shows you how to determine these values precisely using Hugin (and a bit of extra photography) at http://wilson.bronger.org/lens_calibration_tutorial/.

The advanced interface starts with the General radio button, showing you Width x Height. You can click and drag to change the order of which image is 1,2,3, and you can right-click to edit or to choose an anchor (if this is the best-placed or best-exposed image). You can load your lens parameters if you have calibrated them (above).

I have found that when adding a fourth image, just for adjustment reasons, I might have to edit its exposure value using "Edit image variables". Notice at the bottom that for image 0 it already has the focal length multiplier 1.6x because it has detected through the EXIF that this camera was not full frame.

When you click on the EXIF data radio button, you can see that Hugin recognizes the camera model and lens used AND what focal length was used!

And finally, if you choose the radio button "lens parameters" it will tell you the calculated Horizontal Field of View (Hfov).

If you manually change the focal length or multiplier or lens type, the field of view will adjust automatically.

Now it is time to construct the fisheye view. Here is where you have to guide Hugin because it does not know what you want!

Click on the fast panorama preview window (which should have opened when you clicked Advanced). You can also get to it by clicking the icon:

Click on the preview tab. My images were very dark, as you can see here, so I manually changed the EV to -4.

Next, click on the Projection tab and choose fisheye (default was equirectangular):

Click on the "Fit" button and manually change the field to say 240 (we will adjust this later), because we need to see the top and bottom "poles".

Next click on the Move/Drag tab and under mode, choose normal, individual.

This will allow you to move only the selected image(s) but leaving the non-selected ones visible. A great thing is there is almost an unlimited amount of undo (Ctrl-Z), so no need to panic after making a mistake!

To move an image, first make sure it is the only one checked, then to move exactly left or right, click on the "equator" and drag. Up or down, click on "zero longitude" and drag straight up or down. Just make sure to uncheck the images you do not want to move! So in the following example, I put the north image 0 as anchor, and its horizon at the bottom. The image 1 (east) I moved right, and the image 2 (west) I moved to the left:

Now, I need to rotate the (left) West [2] image 90 degrees, so that its horizon is on the left. I click the boxes of image 0 and 1 so I can see what I am doing with image 2, find a spot at right-center, click and drag as shown by the white line (Hugin puts that in). I try and put the horizon on the 10.5. I don't know why the developers chose the spacing so that 10 grid boxes is 90 degrees.

Next, you click on the horizon at the 10.5, and drag your mouse "up" along a "longitude" line, so that the horizon stays at the 10.5 distance from the center.

Now comes the finicky part! Using markers in the image, shift it around, up, down, diagonally, until it is in the proper orientation. I use a planetarium program (with time that matches the image!) to find which stars are near the zenith, and which are near the west horizon: Luckily, we have Ursa Major's Alkaid, at the end of the tail/handle (near M51) just about due W, while close to the horizon, due W is straddled by Regulus and Jupiter.

Unfortunately, at the scale we are working with, I can't see these on the projection. But we use the zoom-slider which allows us to see what is near the zenith. Typically I have the original image in a viewer so I can positively identify which pale dot is the star:

Ha. Now that I have placed the O over Alkaid and an X at the zenith for the purposes of this tutorial, I realize that this will make the whole process much easier! On a copy of the images, place large markers, and ingest those images into Hugin instead. You should save this first.

Here is the rough alignment, you can just see the E,W,N,Z,O markers:

You can see that the scale is not right since the zenith markers in the images are not at the center; as well, the curvature of the horizons in the image do not parallel the curve of the "longitude" lines. Finally, in the N image, the zenith, Z, should be exactly above the N and exactly horizontal to the E marker. There is no adjustment I can make to rotate/move the image to make this happen. The barrel/distortion of the lenses have not been properly calibrated, so Hugin cannot compensate. In the N image, I can see both horizon points, but they are a different number of pixels from the zenith, a characteristic of the lens and its orientation.

SAVE YOUR WORK!

One might think that optimize would handle this, but it does not. After some trial and error with re-sizing and adjusting the crop factor and focal lengths, it turns out that you don't need to play with any of those at all. I couldn't get the curvature of the horizon to match the projection line, so I suspected that the lens was not being handled properly. The lenses all came in as rectilinear, but I guessed that Mike's lenses were technically fisheyes to begin with. So I changed the lens types, on the photo tab with the radio button for "lens parameters": For images 1 and 2, the cameras were Canon 5D mark II, and 5D mark III, both full frame.

The preview panorama adapted automatically, and all I had to do was some minor adjustments image by image to get the yellow markers to line up quite closely to where they should be. The east marker is the worst, but not way off:

Now you can see that the E and W images appear a bit bigger compared to the North (reference) image. So in the photos tab I change the crop factor until it is pretty close.

But before we optimize, we want to identify control points, to tell Hugin where there are exact matches between images. You will need to click on the "Control Points" tab. We will do 3 sets: images 0-1, images 0-2, and images 1-2. Here I have chosen Images 2 and 0, and about to select the view/zoom at 50%. I switch back and forth to "fit to window" to make sure I am not missing a large overlap segment:

I do a few stars and aim for at least 3 horizon points, say a distant streetlight or where there is a stand of trees, which helps merge the horizon line. You want to be sure you find points near the edges of the images because this is where the largest distortions are. Here is a screen shot of control point selection of one of the pairs:

A word of warning: On occasion, when you click on a star, the software picks the wrong matching star or terrain feature in the other window! You have to click and drag the point to the right place. Avoid using aurora features, just like you would avoid clouds for a daytime pano.

SAVE AGAIN!

Now, back on the photos tab, towards the bottom, there is an "Optimize" section. From the geometric drop-down, I chose Positions, view, barrel:

And click Calculate. After a few seconds, it comes back with a results window:

Click yes. If you don't like the final stitch you can always come back and under control points, click on the ones with the largest separation distances and check if you mis-matched it. If so, adjust and rerun optimize.

Click the Stitcher tab, force the field of view to 190 and the output image size to 1440x1440, check the box under remapped images for "Exposure corrected, low dynamic range", and then the "Stitch!" button at the lower right. You can change the output format to jpg instead of tiff if you want. When it prompts you to save, use a simple name, in my case, "demo". Here is the result:

Success!

Truth be told, before this one, I had a result that still had a problem in the NW:

In reality there seems to always be a bit of iteration (adjust-optimize-save-check) until the worst error goes away. Each time, save as a new image (presuming you want to compare).

And that's it for a single panorama! Save and exit, then go back to the folder and use the original images instead of the ones with the markers. Double-click on the pto file, and click on Stitch to produce the clean version.

In retrospect, it would be nice if there was a faster way to do the adjust-check, or nail a horizon down. Enabling yaw-pitch-roll on individual images would be better than hand/mouse dragging.

Now you are ready to do this as a time-lapse. Instead of using the images' real name, your script renames them Cam0, Cam1, Cam2, and dumps them in the directory where the pto script is, runs nona & enblend, sends the final result off to the output directory, and loops back.