Aligning Images with Hugin

Yes I am.

Maybe it has gone away and we need to update this tutorial!

It is still there but disabled, so I assume that somewhere Hugin thinks that I donā€™t need it.

Iā€™ll try to have a look today.

I am using Hugin for the first time and followed the above step-by-step instructions (thanks for putting this together!). However, when I got to this step ā€œSelect Optimize now! and wait for the software to finish the calculationsā€ I got an error message that says:

ā€œThere are no control points in the current configuration for the optimizer. Please add control points before running the optimizer. Optimization canceled.ā€

Iā€™m not sure how to proceed. Any help would be appreciated.

@eli318 you need to find control points first, then optimize those points.

Thanks for the quick reply. Sure, that makes sense based on the message I got. Because I am so new to the program, I donā€™t know how that is done. Can you point me to instructions on that part?

On the Photos tab, near the bottom, there is a button called Create Control Points.

We may need to revisit this tutorial, as I think hugin has changed slightly since this was authored.

Got it. Thanks!

I might be lvery ate getting here, but I found this article of great value to me in preparing for a long project - so enormous thanks to paperdigits.

To assure myself I have some understanding on how to run hugin to achieve focus stacking I tried to reproduce the results shown in this article, using the 3 zip files mentioned in the article. In summary I was able to reproduce those results following the procedure as documented. However when I used the procedure with my own focus bracketed images I failed to get a blended tiff out of the process. An example log file is copied below, with what I think is the key message from enblend right at the end.

It is saying there is too much overlap between the images. I set my (Fuji X-T30) camera to take 15 images separated by 10 steps (the maximum distance between points of focus I can set with this camera) covering about 12 cm of a ruler. I canā€™t get less overlap, i.e greater separation between shots.

I have uploaded the first (anchor) and last jpegs of the set of 15, assuming that is of value:


What am I doing wrong ?

Hugin log follows:

============================================
Stitching panoramaā€¦

Platform: Linux 6.8.0-48-generic x86_64
Version: 2023.0.0.d88dc56ded0e
Working directory: /home/tony/scratch/focus stack tests-2/jpegs/ruler focstk pto
Output prefix: ruler jpeg

Blender: enblend 4.2
Exposure fusion: enfuse 4.2
ExifTool version: 12.76

Number of active images: 15
Output exposure value: 0.0
Canvas size: 3651x2450
ROI: (83, 65) - (3566, 2385)
FOV: 28x19
Projection: Rectilinear(0)
Using GPU for remapping: false

Panorama Outputs:

  • Exposure fused from any arrangement
  • High dynamic range

Remapped Images:

  • No exposure correction, low dynamic range

First input image
Number: 0
Filename: /home/tony/scratch/focus stack tests-2/jpegs/DSCF3945.jpg
Size: 3480x2320
Projection: Normal (rectilinear)
Response type: custom (EMoR)
HFOV: 27
Exposure value: 0.0

Remapping LDR images without exposure correctionā€¦
Multiple images output
loading DSCF3945.jpg
remapping DSCF3945.jpg
saving ruler jpeg_exposure_layers_0000.tif
loading DSCF3946.jpg
remapping DSCF3946.jpg
saving ruler jpeg_exposure_layers_0001.tif
loading DSCF3947.jpg
remapping DSCF3947.jpg
saving ruler jpeg_exposure_layers_0002.tif
loading DSCF3948.jpg
remapping DSCF3948.jpg
saving ruler jpeg_exposure_layers_0003.tif
loading DSCF3949.jpg
remapping DSCF3949.jpg
saving ruler jpeg_exposure_layers_0004.tif
loading DSCF3950.jpg
remapping DSCF3950.jpg
saving ruler jpeg_exposure_layers_0005.tif
loading DSCF3951.jpg
remapping DSCF3951.jpg
saving ruler jpeg_exposure_layers_0006.tif
loading DSCF3952.jpg
remapping DSCF3952.jpg
saving ruler jpeg_exposure_layers_0007.tif
loading DSCF3953.jpg
remapping DSCF3953.jpg
saving ruler jpeg_exposure_layers_0008.tif
loading DSCF3954.jpg
remapping DSCF3954.jpg
saving ruler jpeg_exposure_layers_0009.tif
loading DSCF3955.jpg
remapping DSCF3955.jpg
saving ruler jpeg_exposure_layers_0010.tif
loading DSCF3956.jpg
remapping DSCF3956.jpg
saving ruler jpeg_exposure_layers_0011.tif
loading DSCF3957.jpg
remapping DSCF3957.jpg
saving ruler jpeg_exposure_layers_0012.tif
loading DSCF3958.jpg
remapping DSCF3958.jpg
saving ruler jpeg_exposure_layers_0013.tif
loading DSCF3959.jpg
remapping DSCF3959.jpg
saving ruler jpeg_exposure_layers_0014.tif

Blending exposure layer 0ā€¦
enblend: info: loading next image: ruler jpeg_exposure_layers_0000.tif 1/1
enblend: info: loading next image: ruler jpeg_exposure_layers_0001.tif 1/1

enblend: excessive image overlap detected; too high risk of defective seam line
enblend: note: remove at least one of the images
enblend: info: remove invalid output image ā€œruler jpeg_exposure_0000.tifā€

Process took 10 s

I donā€™t know what Hugin is supposed to Output when focus stacking, but it says ā€œstitching panoramaā€ :thinking:

That could explain the overlap message.

I think I remember having a similar problem that I couldnā€™t figure out how to focus stack in Hugin. Have you tried following this tutorial?

I also expercienced issues when focus stacking with Hugin. It should work according to the manual, but I obtained blurry outputs.
The question now seems to be ā€˜is it indeed the software or are the images to blame?ā€™ I fear it is the software as I used an alternative piece of software without problems with the same set.

In Germany there is a professor who uses microscopy heavily and faced a stacking problem too. He wrote a freeware program ā€˜picolayā€™ for stacking. You can download it (picolay.de) and see whether it stacks your images nicely. When it does, it seems that Hugin has an issue.

Not yet, but it looks relevant, so thank you for bringing it to my attention. I donā€™t expect much though - not because the referenced article is wrong but I find that Linux is prolific in throwing up technical problems which, given my level of knowledge, take days, if not weeks, to solve (and some never).

By the way I thought the original article which I read is (partly) about focus stacking:
ā€œAligning a stack of images can be useful for achieving several results, such as:
;;;;
photographs taken at different focal distances to extend the depth of field, which can be very useful when taking macrosā€

So it surprises me that the procedure does seem to invoke a panorama stitcher.

I feel you, thatā€™s one of the things I donā€™t like about Linux. The problems you may encounter are usually one of the following:

  • non-existent on Google, or one old post with no replies
  • it requires a workaround that may stop working the next update
  • simple and permanent fix (not as common as Iā€™d wish)

Some of the problems I had were only visual (like broken window animations), but they made the experience less pleasant. Maybe the next time I decide to go for Linux Iā€™d go for Mint or Pop OS for better stability.

Yeah, that surprises me too.

Could we add 'Broken packages in Synaptic Package Manager;, please?

This is an example of the ā€˜never solvedā€™ problem. I have it right now, trying to re-install Hugin, having ā€˜completely removedā€™ it (because neither ā€˜align_image_stackā€™ nor ā€˜enfuseā€™ could be found in my system in the locations suggested in the article to which you referred me).

Now, I try to avoid installing packages via methods other than Software Manager or Synaptic Package Manager, so the occurrence of a ā€˜broken packageā€™ is not my fault surely? But finding out what causes a broken package and what is required to mend it is like labour of Hercules in Linux (I make no comment about Windows, Appleā€™s various OSes, or other strange and horrifying Google-bred mutations loosely genetically related to Unix).

End of rant.

Great; that process worked. Gave me a result which demonstrated that the process is good, but the data, supplied by the user, is not. Back to the camera and try to find an answer on how to get larger ā€˜focus distanceā€™ steps.

1 Like

When I updated to Ubuntu 22.04 LTS after the .1 version was released I encountered a problem that enfuse is just not in the repository, they didnā€™t update it to ā€˜jammyā€™ (I havenā€™t checked ever since). I tried to install it but it was pretty much impossible, I think it was the dependency rabbit hole problemā€¦
Iā€™m happy if I manage to install one program from source with cmake and not possibly tens of programs, so I gave up and looked for an alternative.

I ended up buying EasyHDR, but I havenā€™t used it much, I actually prefer single underexposed RAW, itā€™s enough like 95% of the time for me.