Lua for darktable on Windows

lua

(Bill Ferguson) #21

Kevin,

Try this

open a command prompt
type in
set PATH=%PATH%;C:\Program Files\Hugin\bin
and hit enter

logout and then login. Open a command prompt and type path and make sure the path to hugin is there. Start darktable and try your panorama again. Please post whether it worked or not.

In the meantime, I’ll go find a panorama that I did and try and get it running on windows.

I think what is happening is that there are a lot of executables in the hugin directory, such as align_image_stack which I think are being called from the hugin process, but since they aren’t in the path they don’t execute.

Bill


(Kevin E) #22

Doesn’t seem to have fixed things.

I confirmed that it got added to my path through the environment variables editor:
image

I then restarted and tried exporting to hugin. Still getting the same error:
LUA ERROR hugin not found

I also tried adding a \ after “bin” so that the new path variable looked like so:
C:\Program Files\Hugin\bin\

That was not successful either.


(Bill Ferguson) #23

It appears I was incorrect about contrib/hugin working. I thought the changes had been made and merged, but when I just tried it, the old script is still present.

Bill


(Kevin E) #24

Ok, that might explain a lot then. I’ll watch for the new commits and report back once I’ve tested.


(Tobias) #25

Bill, do we have a PR for the hugin script?


(Bill Ferguson) #26

I believe that it’s 111, hugin plugin improvements


(Tobias) #27

The pr is merged. Please test the new version of the hugin script on windows.


(Kevin E) #28

Will do. I’ve been working with Bill directly on some other scripts, so if there are issues I can work with him to resolve. I’ll report back here with status once I’ve had a chance to test.


(Seb) #29

Hi all,

Meanwhile I am trying to work with the hugin lua script for DT on windows, I found this post. My current issue is that when I select images to export to hugin, it seems to go well and Hugin starts but no images are loaded, and DT seems to be expecting something (the stitched panorama to re-import ?).
I’m not sure where to look from there, as “darktable -d lua” does not give me anything debugging-wise.

Thanks ahead of time if you have any idea as to why it does not work with me :slight_smile:


(Kevin E) #30

Does the file path where your source images are stored have any spaces in it?


(Seb) #31

Yes there is enough space. In fact I can see the TIF files it created in
C:\Users\user_name\AppData\Local\Temp.
I also have a cmd window opened doing nothing, and hugin opened without picture. I can just grab the tif files and as if there were opened in hugin directly.
I then go ahead, align images, save my project (in the temp folder) and generate the panorama (in the temp folder as well), and it throws an error quite explicit :

Remapping LDR images...
caught exception: 
Precondition violation!
Unable to open file 'C:\Users\user_name\AppData\Local\Temp\\Users\user_name\AppData\Local\Temp\DSC_4758.tif'.
(C:\Prog\Hugin\dynamic_vs2015\vigra-1.11.0\src\impex\codecmanager.cxx:203)

I tried to play around with the project_name and the output prefix, but since if i grab other tiff file generated with file_on_disk in another folder, everything works out perfectly, I’m not sure it has to do with these parameter.

Also I’m on W10 if that helps.


(Kevin E) #32

The file path being generated is definitely the issue. Somehow it is getting duplicated and added together. I have not taken much time looking at the Hugin script. Maybe @wpferguson can have a look or comment.

You may also try redownloading all the lua scripts from the GIT repo just to make sure you have the absolute latest versions, as significant changes were made recently.


(Bill Ferguson) #33

I’ll try and make some time to look at it.


(Seb) #34

Hi again,
I’ve tried and looked into it but as I’m not familiar enough with DT just yet, I haven’t anything dodgy that would explain the path issue.
Anything on your side ?

Thanks again


(Bill Ferguson) #35

Bit the bullet and took time to look at it. Something is broke somewhere… :-/ I’ll work on it, but it’ll probably be next week before I get it fixed…

Bill


(Seb) #36

No worries Bill, you’re being kind enough to take time and willing to fix it, that’s enough for me even if it takes a few weeks :slight_smile:

Just let me know if you need some testing done on a Windows environment I’ll be happy to assist.

Thanks!


(Bill Ferguson) #37

It’s fixed. PR is submitted. The problem was what windows expects for quotes. Windows wants everything double quoted instead of single. However, if you double quote the executable, then double quote the arguments, you have to run it from a batch file instead of running it straight from dt.control.execute, otherwise windows chokes on it.

For anyone writing lua scripts that need to run on windows there is a library lib/dtutils.system which provides a function external_command which takes care of running quoted commands on windows. It also works correctly on linux/macos, so you can just use that instead of dt.control.execute.

As far as path quoting you can add the line

local PQ = dt.configuration.running_os == “windows” and ‘"’ or “’”

to set a path quoting variable, then just use PQ in you strings instead of the quotes.


(Seb) #38

Hi Bill,

Thanks for this fix ! It indeed get better as I’m now getting the images loaded into hugin, but then once aligned I just tell it to create the panorama, and then it crashes exactly as first described. Pretty sure it’s still the quote thing probably some place else in the script…

What do you think ?


(Tobias) #39

Does hugin crash if you create the panorama without dt?


(Seb) #40

Well it does not exactly crash, instead it ends up failing creating the panorama and does nothing afterwards. It just tries to open the images to blend them and fails because of the path issue i mentioned above.

Other than that I’ve been able to create multiple panorama with the regular tiff export from DT and then open hugin on its own, but the images weren’t stored in the temp folder.
However I’ve tried to copy paste some tiff in the temp folder, and tried to create the panorama in that same location (with the .pto saved as well there). I’m ending up with the same path issue. Makes me wonder if it’s hugin or the temp folder that causes this to happen.

It manages sometimes to success, but it’s unclear why just yet.