Hi guys,
Is it possible to use a custom HDR sequence? I would like to shoot the following sequence.
f/4, 1s
f/4, 1/4 s
f/4, 1/32 s
f/16, 1/16 s
f/16, 1/125 s
f/16, 1/1000 s
f/16, 1/8000 s
Is there a way to do that with Magic Lantern?
Thanks!
Yes! (http://www.magiclantern.fm/forum/index.php?topic=14828)
menu.new
{
name = "Run Bracket",
select = function() task.create(run_bracket) end,
depends_on = DEPENDS_ON.M_MODE,
}
local run_bracket = function()
camera.aperture.value = 4.0
camera.shutter.value = 1.0
camera.shoot()
camera.shutter.value = 1/4
camera.shoot()
camera.shutter.value = 1/32
camera.shoot()
camera.aperture.value = 16.0
camera.shutter.value = 1/16
camera.shoot()
-- and so forth...
end
That looks like a lua script. Cool!
@dbalex you might want to take a look at the Magic Lantern Lua API Documentation (http://davidmilligan.github.io/ml-lua/)
Great! I will look into lua scripts.
Can I make tests of scripts on my camera or do I risk something if the script has some errors?
Thanks!
Errors should print to the console, and this is the most likely thing to happen if there is an error. You should get a description, filename, and line number, and also a stack trace if it's a runtime error. However, it's not impossible to crash the camera from a script (the scripting engine is pretty defensive and tries to prevent you from doing anything bad, but it's not absolutely perfect). If that happens, you just need to pull the battery and reinsert it.
Great thanks ! Will test it out this weekend when I have some time to understand how all this works :)
Ok I just made a little test but I must say I'm not really understanding everything here. Is there a tutorial somwhere that explains step by step how to use .lua scripts with magic lantern? I tried writing the code you wrote in notepad on my computer saved the file, changed the .txt in .lua and put it in ml/scripts folder but when I switch my camera on I don't really see anything different, can't find a new menu to trigger the script.
Can someone point me in the right direction?
Thanks!
Did you load the lua module?
Euhm... No... I'm not sure but I looked in all the menus and can't find anything to load the modules. How do I load it? Is there a tutorial explaining all this somewhere that I've missed?
Sorry for all the questions but this is all new for me :)
Click! (http://lmgtfy.com/?q=how+to+load+modules+magic+lantern)
Ok loading a module I already tried with the other modules, but in my list, I can't find the lua module or the script I put on my cf card.
Cam type? If it is not a 600D or 1100D you may download latest nightly build and copy files over.
Yes thanks that was it, I have a too old build. I thought since it's only one month old it was ok, but it seems it was already outdated :)
It's quite calm right now. Between 01.Jan.2014 and 31.Mar.2014 there were about 76 builds ...
haha quite calm I see :)
now I have the lua module but I get the error: When loading bad argument #1 to 'create' (function expected) stack traceback [c] in function 'ta_
any idea what this could be?
It is a very good idea to visit https://builds.magiclantern.fm/jenkins/ from time to time, and the updating process are a mere trivial 2 minutes, to keep your cam updated with the latest ML. LUA was introduced almost a year ago and provides an opportunity to actually program your cam more or less like if you were writing in Business Basic. As a tool LUA is extremely powerful and a Godsent. Canon's are just about the only cams, you can master this way.
http://www.magiclantern.fm/forum/index.php?topic=14828.0
Quote from: dbalex on January 20, 2016, 08:08:36 PM
any idea what this could be?
My bad. Remove the local from the function definition
menu.new
{
name = "Run Bracket",
select = function() task.create(run_bracket) end,
depends_on = DEPENDS_ON.M_MODE,
}
run_bracket = function()
camera.aperture.value = 4.0
camera.shutter.value = 1.0
camera.shoot()
camera.shutter.value = 1/4
camera.shoot()
camera.shutter.value = 1/32
camera.shoot()
camera.aperture.value = 16.0
camera.shutter.value = 1/16
camera.shoot()
-- and so forth...
end
Awesome it runs now ! I will try now on my own to customize the script even more to my needs. But it's a great start, Thanks for the help !
@dbalex
I, like many I'm sure, would welcome you publishing your progress. In fact I would welcome anyone publishing their experience with lua, especially 'doing' image capture.
I'm not a programmer but I'm good at bootstraping off others :-)
My project is to write an auto bracketing script that covers the entire DoF.
Cheers
Garry
Wow! That'd do something for macro photographers - and in silent...?
@axelcine
Sorry, quite the opposite.
Macro bracketing is easy and already built into ML.
Macro bracketing is simply repeating a fixed lens refocus multiple times.
Landscape focus bracketing requires a little more programming :-)
Cheers
Garry
Yeah, well, of course you're quite right.
I love focus stacking, but it is still a setup with quite a handful of variables, but an auto way would be to script it, and I'm a hell of a lazy boy...! I also do landscape dof bracketing and it is more slow, yet simple. Just takes a lot of time and caution. Another area of auto via scripting. So: I'm still looking very much forward to see what comes out of this thread.
@Garry: I will if I make any progress, but I already tried some mods and can't seem to make them work. I don't really understand how to write the .lua code so I will need to dive into it before making any progress :)
Ok so now I'm trying to add a delay before the first picture. I think I'm doing it wrong because it tells me an error.
can someone tell me how I can interpret this ML LUA API? http://davidmilligan.github.io/ml-lua/modules/camera.html#shoot (http://davidmilligan.github.io/ml-lua/modules/camera.html#shoot)
I don't understand how I can translate those in .lua code. I read in the ML Lua API
"Functions
shoot ([wait=64[, should_af=true]])
Take a picture
Parameters:
wait int how long to wait for camera to be ready to take a picture (default 64)
should_af bool whether or not to use auto focus (default true)"
so I made a little change (in red) to the code written by dmilligan to try to add a delay (64=64 seconds?) and disable autofocus:
menu.new
{
name = "Run Bracket",
select = function() task.create(run_bracket) end,
depends_on = DEPENDS_ON.M_MODE,
}
run_bracket = function()
camera.aperture.value = 4.0
camera.shutter.value = 1.0
camera.shoot([wait=64[, should_af=false]])
camera.shutter.value = 1/4
camera.shoot()
camera.shutter.value = 1/32
camera.shoot()
camera.aperture.value = 16.0
camera.shutter.value = 1/16
camera.shoot()
camera.shutter.value = 1/125
camera.shoot()
camera.shutter.value = 1/1000
camera.shoot()
camera.shutter.value = 1/8000
camera.shoot()
end
But this code doesn't work and tells me : error near [
Can someone tell me what's the problem or where I can learn this? I would really like to do this by myself but now I'm a bit stuck because I don't know how to translate the 'ML LUA API' to .lua code.
Thanks!
shoot ([wait=64[, should_af=true]])
Brackets [] are used for optional arguments
Valid lines look like
shoot ()
shoot (wait=64)
shoot (wait=64, should_af=true)
If you want to add a delay, just call msleep() (http://davidmilligan.github.io/ml-lua/modules/global.html#msleep) before calling camera.shoot(). The wait parameter to camera.shoot() means to wait no longer than this for the camera to be ready to shoot, but it will go ahead and take the picture as soon as the camera is ready.
Also, there's a bug with the should_af parameter. The fix should be available soon.
thanks msleep work like a charm, exactly what I needed. Now I understand a bit better, thanks guys! I added three beeps to tell me when the sequence starts :)
I just noticed now but it seems like the aperture settings is not correctly adjusted while running the sequence. At the 4th camera shot it's supposed to set it to f16 but it seems to set it to f22. Any idea why it's not adjusting to the correct aperture?
menu.new
{
name = "Run Bracket",
select = function() task.create(run_bracket) end,
depends_on = DEPENDS_ON.M_MODE,
}
run_bracket = function()
camera.aperture.value = 4.0
camera.shutter.value = 1.0
beep(3)
msleep(6000)
camera.shoot()
camera.shutter.value = 1/4
camera.shoot()
camera.shutter.value = 1/32
camera.shoot()
camera.aperture.value = 16.0
camera.shutter.value = 1/16
camera.shoot()
camera.shutter.value = 1/125
camera.shoot()
camera.shutter.value = 1/1000
camera.shoot()
camera.shutter.value = 1/8000
camera.shoot()
end
Yeah the conversion from f number to Canon raw units is wrong. I think I must have found it somewhere in ML code, then never tested it or sanity checked it. It's currently implemented as:
x * 8 + 8
The correct formula is:
log2(x) * 16 + 8
log2(16) * 16 + 8= 72, right ? Because that's not working as well, a bit weird because f4 written as 4.0 works even if it's 40
Anything else that I'm missing?
That formula is to convert it to a Canon raw value, so you'd need to use
camera.aperture.raw = 72
There will be a fix soon. There may also be a separate rounding issue (Canon firmware will only accept certain values).
Ok perfect, works great now! thanks for all the help!
Any news on a fix for this issue?
What issue?
I'm pretty sure it was fixed in the first lua_fix that has already been merged (didn't check the commit history). That was a long time ago.
This is awesome. didnt realize ML could do this.
If you dont specifiy the Aperture value and only set the Shutter duration.
will it use current camera settings if set in manual mode.. so if i have the camera set to F22 it will not change that i assume