enfuse_pro plugin - cross-platform compatible

@yteaot

The git version did not work so I switched to the one you suggested.

Oh, we’re neighbors! If you want, please contact me at alfwerner@bredband.net

For focus stacking I am not getting proper results


I am using the default parameters
If I use terminal with minimum parameters like
align_image_stack -m -a OUT imageFiles(20 total) which creates OUT0000 to OUT0020 .tif files
then I use
enfuse --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --output=output.tif OUT*.tif
and Get

I think the additional parameters which I cannot disable makes the result bad.

Any Help?

There is an issue with the enfuseAdvanced plugin and I’ve been working on a fix. Part of the issue is providing presets that work straight out of the box. Unfortunately, real life has not given me much time to work on it lately. Hopefully that will change soon…

Bill

Unfortunately I am in the same boat as Bill. Life has been very hectic for me lately and I’ve had no time to dedicate to photography or my plug-ins.

Something that may be helpful is to run darktable with LUA debugging turned on and to review the log files so we can compare your Command Line string with the string generated via the program.

You can enable the debug logfile by starting darktable with “-d lua” behind it. On windows I open a CMD window in the folder where my darktable application is installed and type “darktable -d lua”.

The log file can be found at location described here (windows OS): https://www.darktable.org/about/faq/#faq-windows-logs

Sorry for late answer following is the terminal output
Rajs-iMac:~ raj$ /Applications/darktable.app/Contents/MacOS/darktable -d lua

(process:2276): GLib-GObject- CRITICAL **: 17:43:28.614: g_object_set: assertion ‘G_IS_OBJECT (object)’ failed

(darktable:2276): GLib-GObject- WARNING **: 17:43:29.032: invalid cast from ‘GtkMenuBar’ to ‘GtkWindow’

(darktable:2276): Gtk- CRITICAL **: 17:43:29.032: gtk_window_add_accel_group: assertion ‘GTK_IS_WINDOW (window)’ failed

12.078854 LUA enfuseAdvanced - Executable Path Preference: /Applications/Hugin/Hugin.app/Contents/MacOS/align_image_stack

12.335811 LUA enfuseAdvanced - Executable Path Preference: /Applications/Hugin/PTBatcherGUI.app/Contents/MacOS/enfuse

12.426700 LUA enfuseAdvanced - Executable Path Preference: /usr/local/bin/exiftool

272.129724 LUA enfuseAdvanced - Starting Image Fusion

272.130472 LUA enfuseAdvanced - Align Start Command: “/Applications/Hugin/Hugin.app/Contents/MacOS/align_image_stack” -m -g 5 -c 8 -t 3 --corr=0.9 --gpu -a ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0217.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0218.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0212.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0207.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0206.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0223.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0208.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0216.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0219.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0204.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0224.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0213.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0221.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0209.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0220.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0215.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0205.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0222.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0214.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0211.tif’ ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/D2X_0210.tif’

align_image_stack: using graphics card: ATI Technologies Inc. AMD Radeon RX 570 OpenGL Engine

Written aligned images to files with prefix “/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_”

283.100339 LUA enfuseAdvanced - Completed Align

283.167516 LUA enfuseAdvanced - Blend Start Command: “/Applications/Hugin/PTBatcherGUI.app/Contents/MacOS/enfuse” --exposure-weight=0.0 --saturation-weight=0.0 --contrast-weight=1.0 --exposure-optimum=0.0 --exposure-width=0.0 --hard-mask --contrast-window-size=5 --contrast-edge-scale=0.0 --contrast-min-curvature=0.0% --depth=16 --compression=98 --output=’/Volumes/HackSSD/Stacking_Focus_Exposure/godetia_stack04_1200w/D2X_0204-0224_01.jpg’ /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0000.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0001.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0002.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0003.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0004.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0005.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0006.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0007.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0008.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0009.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0010.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0011.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0012.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0013.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0014.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0015.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0016.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0017.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0018.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0019.tif /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0020.tif

enfuse: warning: exposure width less than 0; will use 1/1024

enfuse: warning: option “–exposure-optimum” has no effect as exposure weight

enfuse: warning: is zero

enfuse: warning: option “–exposure-width” has no effect as exposure weight

enfuse: warning: is zero

enfuse: warning: requested output pixel type is “UINT16”, but image type “JPEG”

enfuse: warning: supports “UINT8” at best; will use “UINT8”

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0000.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0001.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0002.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0003.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0004.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0005.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0006.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0007.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0008.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0009.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0010.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0011.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0012.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0013.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0014.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0015.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0016.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0017.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0018.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0019.tif 1/1

enfuse: info: loading next image: /var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_0020.tif 1/1

enfuse: info: narrowing channel width for output as “uint8”

enfuse: warning: must fall back to export image without alpha channel

285.921510 LUA enfuseAdvanced - Completed Blend

285.921554 LUA enfuseAdvanced - EXIFTool Start Command: “/usr/local/bin/exiftool” -TagsFromFile ‘/Volumes/HackSSD/Stacking_Focus_Exposure/godetia_stack04_1200w/D2X_0210.jpg’ -exif:all --subifd:all -overwrite_original ‘/Volumes/HackSSD/Stacking_Focus_Exposure/godetia_stack04_1200w/D2X_0204-0224_01.jpg’

1 image files updated

287.173450 LUA enfuseAdvanced - EXIFTool copy successful

287.173491 LUA enfuseAdvanced - Deleting temp files…

287.191095 LUA enfuseAdvanced - Done deleting

287.191150 LUA enfuseAdvanced - Image fusion process complete

OK, just some notes to myself to help troubleshoot what’s happening. Thanks for these log files!

Blend Start Command: “/Applications/Hugin/PTBatcherGUI.app/Contents/MacOS/enfuse” --exposure-weight=0.0 --saturation-weight=0.0 --contrast-weight=1.0 --exposure-optimum=0.0 --exposure-width=0.0 --hard-mask --contrast-window-size=5 --contrast-edge-scale=0.0 --contrast-min-curvature=0.0% --depth=16 --compression=98 --output=’/Volumes/HackSSD/Stacking_Focus_Exposure/godetia_stack04_1200w/D2X_0204-0224_01.jpg’

compares to

enfuse --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --output=output.tif OUT*.tif

So here we have potentially extraneous commands:
exposure width : 0
contrast window size = 5
contrast edge scale = 0
contrast min curvature = 0
depth = 16
compression = 98

and

Align Start Command: “/Applications/Hugin/Hugin.app/Contents/MacOS/align_image_stack” -m -g 5 -c 8 -t 3 --corr=0.9 --gpu -a ‘/var/folders/3x/vz2846ts5tbddfbcmf5_d2zr0000gn/T/aligned_’

compares to

align_image_stack -m -a OUT

gives us possible extraneous commands:
-g 5 … this is default according to panotools manual
-c 8 … this is default according to panotools manual
-t 3 … this is default according to panotools manual
-corr 0.9 … this is default according to panotools manual
–gpu … this should not be causing the problem

Since your example image looks like an alignment issue I’ll focus on that rather then the blend command. Are you able to provide the images so I can attempt to replicate myself? High quality JPEGs should be sufficient.

@Rajkhand @BzKevin There is a copyright on the image set. Please use and work on other images here. Also, for output with many lines enclose it with back ticks. After a certain height, it will truncate the field. Like so:

```
L
O
N
G

O
U
T
P
U
T 

T
E
X
T
```
L
O
N
G

O
U
T
P
U
T 

T
E
X
T
1 Like

Sorry didn’t know how to post long line will do it next time. The images are from helicon focus site as long as you don’t remove the water mark I think it is ok. There are other images there too.

Does the script works with dt 3.0.1 on Windows?

I have the script installed. The require "contrib/enfuseAdvanced" is in the luarc (and nothing else).

I get the DRI or DFF image in dt. I do not get the LUA tab in dt preferences though. My Hugin is 2019.2.0

My aim is focus stacking. I do get something processing, but no image getting saved.

Do I missed something?

What do your logs say?

Easier said than done :wink: This page points me to C:\Users\[username]\AppData\Local\Microsoft\Windows\INetCache\darktable\darktable-log.txt

Well, no such folder.

If you put the hello world lua example in your lua file, does it print when you start darktable?

print("Hello World !")

You have to replace [username] with your username.

No kiddin’! :wink:

Even though I state “view hidden files” the \INetCache\ folder does not show for me. However, I do get the darktable-log.txt when I do a search.

I do get “Hallo World!”. That was sort of clear because I do get the enfuse export options.

The darktable-log.txt was sort of empty, so I started dt from CMD with: "C:\Program Files\darktable\bin\darktable.exe" -d all

I get then just two enfuse references:

124.645435 LUA ERROR : ...e\AppData\Local\darktable/lua/contrib/enfuseAdvanced.lua:465: attempt to call a number value (local '_')
stack traceback:
	[C]: in local '_'
	...e\AppData\Local\darktable/lua/contrib/enfuseAdvanced.lua:465: in function <...e\AppData\Local\darktable/lua/contrib/enfuseAdvanced.lua:419>
124.648429 [run_job-] 06 296258163.269340 124.649428 export | queue: 3 | priority: 0124.649428 
124.649428 [add_job] 0 | 124.649428 lua: destroy storage param | queue: 4 | priority: 0124.654428 
124.655434 [run_job+] 03 296258163.276345 124.655434 lua: destroy storage param | queue: 4 | priority: 0124.655434 
124.656427 [run_job-] 03 296258163.277338 124.656427 lua: destroy storage param | queue: 4 | priority: 0124.656427 

I also wonder why I don’t get the LUA option in preferences? I presume enfuseAdvanced.lua might was written for pre 3.0.* and simply doesn’t work in the latest version?

Please tell us where you found it.

Have you downloaded the complete tree or just the enfuseAdvanced.lua file?
You need at least:
lib\dtutils.file.lua
lib\dtutils.system.lua
lib\dtutil.lua
locale\

No, then you would get the error: “This application is written for lua api version XXX or later.”
I have no windows here, but can you try to replace the ‘/’ with ‘\’ in line 71.

I did the git from https://github.com/darktable-org/lua-scripts.git, so those files and folders are there. They are not called in luarc though. Do I need to call them?

That’s:
gettext.bindtextdomain('enfuseAdvanced',dt.configuration.config_dir..'/lua/locale/')

I changed 1,2,3 / to \ or \\ (all options) - no change. I do get the LUA GUI for the contrib/image_stack module (that also uses ‘/’).

My complete luarc looks like this:
require "contrib/enfuseAdvanced"
-- require "contrib/image_stack"

No.

Please undo the changes I suggested, that was wrong.

I looked closer at the script.

  1. You can’t find any options because there are no options in the preferences.
  2. Just select “DRI or DFF image” as storage option:
    grafik

OK, I have that menu. It’s not creating files though.

In the meantime I use enfuse.exe from the command line. That works fine.

Bill
I have been using Darktable for a bit, thank you for the Script Manager, it works very well.

When I try focus stacking from export selected how to I choose or find where the stacked image is saved?
Gary

@Fzyace: Please post your question in one place. Possible answer to your question can be found here [your initial thread].