MacroFusion - rewritten in TKinter

Thanks for mentiong focus-stack, it’s not only nice, it’s awesome! Its image-alignment is not only faster but also much more accurate, I have a few cases where align_image_stack failed horribly but focus-stack handles easily. The stacking is also quite good but I still give enfuse an edge here. I still say it’s awesome because it’s a modern approach, utilizing OpenCV, lots of potential. On my GTX 3060, it took only 11 seconds to stack 23 images (the dragon below).

I was about to add cpfind as an alternative to align_image_stack, but after testing out focus-stack and noticing that it uses OpenCV’s ECC algorithm for alignment, I got too excited that I spent the whole night adding ECC to mftker (Tkinter is definitely not multiprocessing-friendly). Even with just 10 iterations and termination-eps of 1e-7, about 22-24 second per image-pair, the result is much better than align_image_stack.

Here is an example where ais failed:

and ECC handled with ease

Took a few hours to learn how to use multiprocesssing.Pool, I pick the middle image as anchor and align the rest against it. Memory consumption is a limit though. I tested using all 16 cores on my Ryzen 5700H, and 32GB memory quickly got flooded into swap :frowning: I’d say 4-8 processes is safe for 24MP images, not too bad for a Python implementation.

Now that I started adding different tools into my little script, I’d love to add focus-stack as another option for alignment (since it’s faster and more efficient than Python implementation). I’ll probably contact the author to see if s/he can expose more options, such as the number of iterations, eps, …, and having a stack-only mode.

Another possibility is median-stacking. I did a few manually before, and the workflow is very similar to focus stacking. So tempting to rename the current “Stack” tab to “Focus Stack”, and add another tab “Median Stack” :slight_smile:

In term of stacking quality, focus-stack is able to address halo somewhat, but still has faint ghosting in the bigger radius. Its output also has less contrast/saturation/details than enfuse. But as I said, anything with a modern approach is more than welcomed.

For comparison, here’s enfuse stacking with no mask:

focus-stack stacking (faint ghosting outlines):

enfuse with a few exclude masks on the extreme out-of-focus areas:

enfuse with include masks on every image:

focus-stack with masks :slightly_smiling_face:

another one by enfuse (that align_image_stack failed)


enfuse with a few exclude masks at the extreme ends

and focus-stack addresses halo pretty well

2 Likes