Author Topic: Custom HDR sequence?  (Read 7161 times)

dbalex

  • New to the forum
  • *
  • Posts: 15
Custom HDR sequence?
« on: January 17, 2016, 10:49:57 PM »
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!

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Custom HDR sequence?
« Reply #1 on: January 18, 2016, 03:40:19 AM »
Yes!

Code: [Select]
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

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3736
Re: Custom HDR sequence?
« Reply #2 on: January 18, 2016, 04:21:23 AM »
That looks like a lua script. Cool!

@dbalex you might want to take a look at the Magic Lantern Lua API Documentation
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #3 on: January 18, 2016, 11:49:13 AM »
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!

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Custom HDR sequence?
« Reply #4 on: January 18, 2016, 04:02:22 PM »
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.

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #5 on: January 19, 2016, 10:32:04 PM »
Great thanks !  Will test it out this weekend when I have some time to understand how all this works :)

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #6 on: January 19, 2016, 10:57:06 PM »
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!


dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Custom HDR sequence?
« Reply #7 on: January 19, 2016, 11:24:50 PM »
Did you load the lua module?

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #8 on: January 20, 2016, 06:26:18 PM »
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 :)

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 6871
Re: Custom HDR sequence?
« Reply #9 on: January 20, 2016, 07:00:59 PM »
Photogs and videographers: Assist in proof reading upcoming in-camera help!. Your input is wanted and needed!

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #10 on: January 20, 2016, 07:43:54 PM »
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.

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 6871
Re: Custom HDR sequence?
« Reply #11 on: January 20, 2016, 07:49:50 PM »
Cam type? If it is not a 600D or 1100D you may download latest nightly build and copy files over.
Photogs and videographers: Assist in proof reading upcoming in-camera help!. Your input is wanted and needed!

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #12 on: January 20, 2016, 07:58:09 PM »
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 :)


Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 6871
Re: Custom HDR sequence?
« Reply #13 on: January 20, 2016, 08:04:29 PM »
It's quite calm right now. Between 01.Jan.2014 and 31.Mar.2014 there were about 76 builds ...
Photogs and videographers: Assist in proof reading upcoming in-camera help!. Your input is wanted and needed!

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #14 on: January 20, 2016, 08:08:36 PM »
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?

axelcine

  • Member
  • ***
  • Posts: 216
  • Hi, I'm Axel, editor, journalist and photographer
Re: Custom HDR sequence?
« Reply #15 on: January 20, 2016, 10:50:59 PM »
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
5dIII.113/Batt.grip, 5dIII.123, 700d/Batt.Grip/VF4 viewfinder, 760d + a truckload of new and older Canon, Sigma and Tamron glass

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Custom HDR sequence?
« Reply #16 on: January 21, 2016, 01:01:54 AM »
any idea what this could be?

My bad. Remove the local from the function definition

Code: [Select]
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

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #17 on: January 22, 2016, 06:38:42 PM »
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 !

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1789
Re: Custom HDR sequence?
« Reply #18 on: January 23, 2016, 04:02:54 PM »
@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

axelcine

  • Member
  • ***
  • Posts: 216
  • Hi, I'm Axel, editor, journalist and photographer
Re: Custom HDR sequence?
« Reply #19 on: January 23, 2016, 08:01:29 PM »
Wow! That'd do something for macro photographers - and in silent...?
5dIII.113/Batt.grip, 5dIII.123, 700d/Batt.Grip/VF4 viewfinder, 760d + a truckload of new and older Canon, Sigma and Tamron glass

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1789
Re: Custom HDR sequence?
« Reply #20 on: January 23, 2016, 08:56:46 PM »
@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


axelcine

  • Member
  • ***
  • Posts: 216
  • Hi, I'm Axel, editor, journalist and photographer
Re: Custom HDR sequence?
« Reply #21 on: January 23, 2016, 09:01:41 PM »
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.
5dIII.113/Batt.grip, 5dIII.123, 700d/Batt.Grip/VF4 viewfinder, 760d + a truckload of new and older Canon, Sigma and Tamron glass

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #22 on: January 26, 2016, 08:01:08 PM »
@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 :)

dbalex

  • New to the forum
  • *
  • Posts: 15
Re: Custom HDR sequence?
« Reply #23 on: January 28, 2016, 08:43:10 PM »
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


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!

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 6871
Re: Custom HDR sequence?
« Reply #24 on: January 28, 2016, 08:56:13 PM »
shoot ([wait=64[, should_af=true]])

Brackets [] are used for optional arguments
Valid lines look like

Code: [Select]
shoot ()
shoot (wait=64)
shoot (wait=64, should_af=true)
Photogs and videographers: Assist in proof reading upcoming in-camera help!. Your input is wanted and needed!