A new Hugin user, I'm trying to use Hugin itself to mimic a simple approach to creating HDR:
Align images at different exposures via align_image_stack. (Taken on a tripod, so well aligned at the start.)
enfuse the resulting images to combine the best exposure for each part of the images.
(The approach is described here, among other places: http://photoblog.edu-perez.com/2009/02/hdr-and-linux.html. I've already used the included "Hugintools" to do this via the command line (and in fact have a nice Applescript droplet app that will do it automatically when you drop image files on it). So now I'm trying to do it with Hugin.)
Here's the workflow I first thought would work:
On the Photos tab, add images.
Use align_image_stack linear to create control points.
On the Sticher tab, set the projection to rectilinear, calculate field of view, calculate optimal size, fit crop to images.
Same tab, uncheck everything, but "Exposure fused stacks". (This can be flakey BTW, and I sometimes have to switch back and forth between two tabs to get the checkboxes to work.)
Stitch! This results in only nona and enfuse running.
Differences from the command-line approach:
nona runs, whereas that's not in the command-line approach (which works well, btw).
The shaped of the content part of the final image is convex on top and bottom. I don't see any cropping, but the shape is wrong.
The size is also not exactly the same as the original, as it is in the command-line approach. This despite the fact that the images were taken on a tripod. In particular, the originals are 4608x3456, and the Hugin output 4118x3268, so that's a bit taller proportionately and smaller overall. If I force Hugin to use the original size, it changes the FoV and the output ends up slightly cropped.
My question here is why doesn't this produce the same output as the command-line method? They seem to be using the same commands of align_image_stack and enfuse, but maybe Hugin is doing something else too, or assuming something else?
So after some playing I hit upon...
Use align_image_stack linear to create control points.
Go to "preview panorama" window and change the projection to Rectilinear from Equirectangular. This squares out the image.
Go to "fast preview panorama" window and auto-crop the image.
On the Sticher tab, calculate field of view, calculate optimal size, fit crop to images.
Same tab, check only "Exposure fused stacks".
Again the size of the image isn't quite the same: 4589x3574, cropped to 3456, so in this case a little taller with the same height. The image is clearly mildly cropped on the sides, but looks the same top to bottom. Using the GIMP to subtract the final images from each workflow (CL and Hugin) shows that they are nearly identical where they overlap.
Is there any way not to run nona, or is it absolutely necessary?
Should I worry about the slight differences in size? I suspect this is leftover from the either the alignment (although it doesn't happen in the CL version), or the projection change. Can I eliminate it?
Why doesn't changing the projection in workflow 1 work as it does in workflow 2?
Thanks for any help.
(PS A general observation that once you're out of simple mode (which I almost never am in), Hugin requires you to jump from one tab to another, or to a preview. I'm not very experienced, but the interface is confusing to me.)
####################################### OTRA FUENTE #######################################
How to Create a Panoramic Photo Using Hugin
Three Methods:Take Your PhotosStitching Your Photos with HuginFurther processing
Panorama stitching is a way to emulate having a much wider field of view than your lens and camera would provide by themselves. Hugin is the foremost open-source panorama stitching program, built around Panorama Tools. While it may not be as easy to use as some alternatives, the basics of using it to create panoramic photos are relatively simple. With some practice, you'll be taking photographs and stitching your own panoramas from them in no time.
Method 1 of 3: Take Your Photos
Consider setting your camera to a smaller quality setting. Remember that your final image may be many times as large, in each dimension, as a normal image from your camera. Unless you're doing enormous prints (and/or you have near-unlimited processing power, disk space and memory) you don't need to set it to the largest picture it can take (although you may want to not use much JPEG compression, if you possibly can).
In this stitched photo, the camera chose a different white balance for different parts of the sky, making the seam lines very obvious. Set it manually instead!
Set your white balance manually. Many cameras (including the ancient Canon D30, used to take the photographs for this article) do not lock their automatic white balance between shots, and have no provision for doing so, even when using auto-exposure lock (see below). Your camera may well decide on a different white balance for different parts of your panorama; consequently, you can easily end up with several photos, with very different white balances, which are a pain to correct in software later on.
So don't use "Auto" white balance. Read your camera's manual to figure out how to set it yourself; on some compacts, this may be buried under "scene mode"-type settings. Don't worry about this if you're shooting film, of course. (You could, of course, shoot in raw and set the white balance when you convert to some more sane format.)
Note the visible band to the left of the center of the sky here; this is probably caused by light fall-off resulting from shooting a lens wide-open.
Stop your lens down a little. Most—possibly all—camera lenses exhibit some kind of light fall-off towards the corners, or "vignetting", when shot wide-open (there will be some at nearly any aperture, but it is worse when the lens is wide-open). This is especially visible if you're shooting 35mm film or a full-frame digital SLR. Hugin can accommodate for this, to an extent, but it's best to eliminate it entirely. If conditions permit, try using an aperture one or two stops smaller than wide-open. This has the added advantage that lenses are usually somewhat sharper stopped down, too; it'll help Hugin find the common points between them much easier. (If you don't understand any of this, don't worry about it too much; just fix the vignetting in software later on if you're good with Photoshop and friends.)
Take a test shot to get the exposure right, if you're on a digital camera. Check your LCD for a correct exposure. As ever with digital cameras: if in doubt, underexpose. You can pull shadow detail out later if you need to, but you can never recover a blown highlight.
The AE lock button on a Canon SLR.
Hit your auto-exposure lock, if you have such a thing. On Canon cameras, this is the button marked with an asterisk on the back. This will prevent your photos being very differently exposed between shots. Hugin will blend them in such a way that it won't be quite as noticeable, but it's still a good idea nonetheless. (If you're weird, you might like the effect that comes from not using your AE lock; have fun if this is your sort of thing.)
Four photographs taken for a panoramic photo; note the overlap between them.
Take your photos. Remember that Hugin can deal with as many shots as you care to give it, in both directions (up and down). The most important thing is to leave a substantial degree of overlap between shots, perhaps as much as a third. Also be wary of large, blank areas of sky; Hugin may fail to automatically discern common points ("control points") between the two shots. If you want to be quite pedantic, use a panoramic tripod head; otherwise, ensure that when you rotate your camera, that you do so around the front nodal point. To quote Paul van Walree,
To preserve the perspective during rotation, which prevents a displacement of nearby objects relative to the background (parallax), the axis of rotation should pass through the entrance pupil [...] the position of the entrance pupil can be approximately found by visual inspection. When you look into a lens from the front, the entrance pupil is the image of the diaphragm opening.
Method 2 of 3: Stitching Your Photos with Hugin
Hugin generating some keypoints after loading some images.
Open Hugin and Hit the "Load images" button. Select the photos that you took earlier. Hit "OK", and wait.
For digital cameras, you probably won't need to enter your focal length manually.
Enter your focal length and FOV crop, if needs be. If you shot this on digital, and intervening software did not strip the EXIF data from your pictures, it should determine this automatically, so don't worry about it too much (in our example, it was shot on a Canon camera fitted with a 29mm manual-focus M42 lens, so it had to be entered manually).
Remember to enter your real focal length and the crop factor of your sensor, not the 35mm equivalent focal length (you can find these out easily enough by a web search). If you shot on 35mm film, then just enter your focal length, and set the multiplier to 1. Divide 35 by the width of your film in millimeters to get the focal length multiplier for other formats.
Hit "Align". The window which comes up is a keypoint generator; it's attempting to find common points between your photos in order to skew them and join them properly. After this, a window will pop up showing you a crudely stitched version of your picture. (Don't worry about the rough edges in this window; the stitching engine will smooth it all out later on.)
Check the fit. In the main Hugin window, it will say something like "Mean error after optimization...". Look immediately below that. If it says "very good fit", or perhaps merely "good fit", then you're ready to stitch your photos, and can ignore the next three steps.
If Hugin says "Very good fit", then you can get straight to the stitching.
Delete any stray control points. One cause of poorly aligned images is Hugin finding common points between images where none exist. Find these spurious control points and delete them. The control points will be marked with circles. Click once in the center of one, then hit the "Delete" button in the lower pane (by default, on Linux at least, this bottom pane is made too small, so you might want to make it larger).
Control points in Hugin.
Add some control points. Go to the "Control Points" tab. You'll notice that there are two pairs of tabs, numbered. These are the numbers of your photos. Make sure that on both the left and right, you have two different images selected, with some shared point between them. Click on one on the left, then in the identical place on one on the right (see the picture to the right for an example). Hugin will, by default, automatically fine tune them, so don't worry about being too precise (though it's best to zoom in to 100%, from the drop-down menu on the bottom pane, so that Hugin doesn't need to guess quite so much). Click the "Add" button in the lower pane. Add as many as you wish, and repeat this process for each common area between all images.
Go back to the "Assistant tab" and hit "Align". If you don't get the desired effect ("very good fit" or perhaps "good fit"), repeat the above two steps, and this one, until you get it right. Try more control points, further apart. Once the alignment is right, you might want to hit the "Straighten" button in the "Panorama preview" window.
Hugin's "Optimize" button.
Optimize your panorama. There is a button on the toolbar to do this; see picture at right. Press it. You can also do this by going to the "Optimizer" tab; this will give you finer-grained control over what will be optimized.
Hugin's "Stitcher" tab.
Set your stitching settings. Go to the "Stitcher" tab and hit "Calculate Optimal Size"; this will make your resulting file as big as it should be. Set "Stitching engine" to "nona"; this usually has great results, though doesn't permit outputting PSD files (which may or may not be useful to you), or anything but TIFF files. Set "image format" to "TIFF". You may want to use "multilayer TIFF" if you ignored the white balance and exposure-locking advice above; this will allow you to correct exposure and white balance individually if your software handles them well (GIMP, at least, does). Alas, this means you'll have to blend each photo into the others, manually, with layer masks. Good luck.
Hit "Stitch now" and enter a filename for your TIFF file.
Hit the "Stitch now!" button. Enter a filename for it to save to. Hit "Save", and sit back, and...
Go away from your computer for a while. Stitching may take some time, and watching it happen is not particularly exciting.
Don't sit and stare at this, unless you're easily entertained.
Method 3 of 3: Further processing
Open your TIFF file in your favourite photo editor. GIMP or Photoshop, or anything else that can handle huge TIFF files and have a crop tool, will be fine.
Crop out any transparent areas, and anything else that doesn't add to your photo.
Crop your photo. In the default nona stitcher, with the default TIFF output, you'll end up with large, transparent areas left over from where Hugin had stretched it. Crop all the transparent areas out.
Actually, you should be ruthless about cropping everything; anything that doesn't add to your photo should be removed from it.
Perfectly stitched, but boring!
Do any further post-processing that you want. Again, if you ignored the advice about white balance and exposure locking, you'll need to correct this. Our photo didn't need this, but did need a kick up with the colour; exactly how this was done is detailed in How to Make Skies Beautiful with GIMP.
The final result.
Save your photo in some saner-than-TIFF format (like JPEG). Print it off, upload it places, and show it off to the world!
This is why you shouldn't use a polarising filter. Note that the sky is markedly darker on the left of this stitched panorama than on the right.
Don't use a polarising filter when taking your photos. You don't do this for the same reason you don't do the same thing with ultra-wide lenses: you will likely end up with such a wide angle of view that the polarisation of the sky will be different from one side of your final stitched photo to the other, and so using a polarising filter will cause some parts of the sky to be darker than others.
If you are on Linux and repeatedly get control points in completely unexpected and random places, it probably means that you have cached keypoints sitting around for a different file with an identical file name. "rm /tmp/*.key.gz" will fix this nicely; a longer-term solution is to make sure your camera is using continuous file numbering.
Using Hugin can use up a lot of memory, disk space and processor cycles. Save any data you have in any other programs you have running and close them if you don't need them. Having other processes running will cause Hugin to take longer than it normally would, too.
Things You'll Need
A camera. If you're on digital, the ability to set white balance and an auto-exposure lock button is useful, though not totally essential. Any film camera with either manual control or an AE lock should be just fine, too.
Hugin, which is available for Windows, Linux and Macs. You can download it for free from the project's website.