Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - garry23

#1726
Walter

Thanks for the pointer.

Looking forward to the next Lua update on the nightlies as I a script to publish, but the Lua module needs to be updated :-)

Cheers

Garry
#1727
As I gain greater awareness of Lua scripting, I'm facing an 'obvious' question: how can I access some of the standard ML functionality from within a Lua script.

For example: setting an ETTR exposure.

Does anyone know how to do this?

Cheers

Garry
#1728
@argv[0]

The RAW spotmeter is under the Overlay menu.

I personally use the Ev option, which gives you the Ev offset from the overexposure point.

As a quick calibration, put the spot meter on a simple object, eg a grey card, and set the Canon exposure to 0Ev.

Read the ML Raw spotmeter and you will have a very narrow and 'accurate' spotmeter that is calibrated to your grey card. Now you can position an area of the image to any 'Ev zone', eg in my Auto Bracketing I set the spotmeter to about -3 to -4Ev on the darkest area I wish to see detail, ie positioning this area around 0Ev in Canon terms.

The ML auto bracketing handles the highlight captures.

Cheers

Garry
#1729
Lorenzo

I just tried the script with another lens (70-200 F/4L) and I also get the soft stop focus errors when I haven't yet reached the macro end, ie at around 120cm.

Until the Lua module gets an update, to fix the lens focus, I can't tell if it is my script creating the issue.

Let's hope David gets a chance to push a few fixes :-)

Once the Lua update comes out, I look at the script again and add in the other enhancements I wish to see, including auo exposure bracketing with focus bracketing, together :-)

Cheers

Garry
#1730
Lorenzo

Another thought, what DoF setting are you using? You will get the best brackets if you switch on diffraction correction.

Cheers

Garry
#1731
Lorenzo

I used a 5D3 with a 24-105F/4L and it is fine.

Interesting.

What MFD did you use?

BTW I also saw that error message sometimes, just before the lens was moved. I wonder if it is related to the Lua module. For example the lens move is broken at the moment, i.e. I can only move the lens one way.

Please try again and see if your error is repeatable.

Cheers

Garry
#1732
Although this is only at Version 0.2, reflecting some 'features' in the Lua module that means I can't yet script a full version: I thought ML friends would like to see what can be achieved with the Lua toolset.

I've also posted about the script on my blog: http://photography.grayheron.net/2016/01/magical-auto-landscape-bracketing.html

Here is the script; which I'm sure can be optimised by a guru  ;)

-- Simple landscape bracketing script
-- Version 0.2
-- Assumes lens is positioned at farthest point
-- in bracket set.

a1 = 0
b1 = 0
a2 = 0
b2 = 0
i = 0
current_tv = 0
current_av = 0

function main()
-- Close ML menu
menu.close()

if lens.dof_near ~= 0 and lens.af == true
then
-- Delay for requested seconds
for i = keymenu.submenu["Delay"].value,0,-1
do
msleep(1000)
end
-- Check if bookends requested
if keymenu.submenu["Bookends"].value == "yes"
then
current_tv = camera.shutter.apex
current_av = camera.aperture.apex
camera.shutter.apex = 100
camera.aperture.apex = 90
task.yield(100)
camera.shoot(64, 0)
camera.shutter.apex = current_tv
camera.aperture.apex = current_av
end
-- Capture first image
a2 = lens.dof_near
b2 = lens.dof_far
task.yield(100)
camera.shoot(64, 0)
-- take remaining brackets to macro end
repeat
a1=a2
b1=b2
repeat
lens.focus(1,1)
b2 = lens.dof_far
a2 = lens.dof_near
until b2 < a1 or lens.focal_distance <= keymenu.submenu["MFD"].value
camera.shoot(64,0)
until lens.focal_distance <= keymenu.submenu["MFD"].value
-- User macro stop reached
beep(4, 100, 330)
-- Check if bookends requested
if keymenu.submenu["Bookends"].value == "yes"
then
current_tv = camera.shutter.apex
current_av = camera.aperture.apex
camera.shutter.apex = 100
camera.aperture.apex = 90
task.yield(100)
camera.shoot(64, 0)
beep(4, 100, 630)
camera.shutter.apex = current_tv
camera.aperture.apex = current_av
end
end
end

keymenu = menu.new
{
    parent = "Audio",
    name = "Landscape Stacker",
    help = "Focus at farthest point",
help2 = "AF must be on",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Run",
help = "Starts the script",
depends_on = DEPENDS_ON.LIVEVIEW,
select = function(this) task.create(main) end,
},
{
name = "Delay",
help = "Seconds to delay start (default 5)",
value = 5,
min = 0,
max = 10
},
{
name = "MFD",
help = "Min Focus Distance (default 50cm)",
help2 = "Set for your lens",
value = 50,
min = 10,
max = 500
},
{
name = "Bookends",
help = "Adds a dark frame before/after brackets",
choices = {"no","yes"},
value = {"no"}
}
}
}


Although the code does some 'error checking', the user must be aware of a few limitations, eg must be in LV, lens must report focus distance and DoF distances, and have auto focus enabled.

Once the Lua module has a few 'fixes', eg I can only drive the lens one way at the moment, I will update the script to do the following:
* bracket from infinity to the macro end (as now)
* bracket from a near focus to infinity
* bracket from the macro (stop) end to infinity.

As usual I welcome feedback to help my program learning (I'm a novice) and, of course, any requests for functionality that I'm missing.

Cheers

Garry
#1733
Scripting Corner / Re: Lua Scripting (lua.mo)
January 29, 2016, 01:42:19 PM
David

Thanks. For a while I thought it was me, until I tested every option  :)

Cheers

Garry
#1734
Scripting Q&A / Re: Questions about Lua scripting
January 29, 2016, 09:17:37 AM
A question for one of the Lua experts, ie willing to help newbies like me  :)

I think I understand the role and power of the Lua tables, but I have got myself confused by trying to reverse engineer one of the Lua examples: http://davidmilligan.github.io/ml-lua/examples/calc.lua.html

I can not see how the calc. table becomes self.

Hope someone can educate me.

Cheers

Garry
#1735
Scripting Corner / Re: Lua Scripting (lua.mo)
January 29, 2016, 08:06:22 AM
David

Have you found time to confirm my testing, that lens.focus has a bug, i.e. Only moves the lens one way?

Cheers

Garry
#1736
Scripting Corner / Re: Lua Scripting (lua.mo)
January 27, 2016, 11:30:41 PM
David

I may have found a bug in lens.focus.

No matter if you put positive or negative values of num_steps or step_size, the lens only moves one way, ie towards the macro end.

If this is a bug, I hope you can fix it   ;)
#1737
Scripting Corner / Re: Lua Scripting (lua.mo)
January 27, 2016, 11:10:52 PM
David

Thanks for the pointer, I do some experimenting and educating  :)

Cheers

Garry
#1738
Scripting Corner / Re: Lua Scripting (lua.mo)
January 27, 2016, 08:38:39 PM
David/Walter

I hope you can help, as I'm so enthused about being able to script.

To me the following is simple and, I believed, coded 'correctly.

It behaves as expected initially, ie move the lens to the macro end and takes a picture.

I then get the LV message repeatedly flashed, ie looks as if it is in an infinite loop, that I'm at the soft end limit. Which I don't understand as I'm driving the lens the other way.

Can you see where I'm going wrong?

-- Simple landscape bracketing script

function main()
-- Close ML menu
menu.close()
-- Move lens to macro end
lens.focus(-10,3)
-- Get DoF info & take first bracket
a1 = lens.dof_near
b1 = lens.dof_far
camera.shoot(64, 0)
-- take remaining brackets to infinity
repeat
repeat
task.yield(100)
lens.focus(1,1)
a2 = lens.dof_near
b2 = lens.dof_far
until a2 > b1
-- move lens back to overlap last capture
lens.focus(-1,1)
a1 = lens.dof_near
b1 = lens.dof_far
camera.shoot(64,0)
until b2 >= 1000000
-- Infinity reached
beep(2, 100, 330)
end

keymenu = menu.new
{
    parent = "Audio",
    name = "Press SET",
    help = "Simple landscape bracket script",
    select = function(this) task.create(main) end,
}
#1739
For what it's worth I use the following workflow, which IMHO is the most robust approach:


  • Switch on Auto Bracketing and ML RAW Spotmeter (Ev mode)
  • Focus and Compose
  • Move the ML RAW (Ev) spotmeter to meter the darkest part where you wish to capture detail
  • Select the exposure to get the Ev value you wish to see at this point, eg I tend to go -3Ev, ie think zone system
  • Use Auto bracketing (1 or 2 Ev) to grab the remaining required frames
  • Process!

Using the above approach means you never need to carry a 1 deg spotmeter and you are guaranteed to get the best photons  :)
#1740
Scripting Corner / Re: Lua Scripting (lua.mo)
January 27, 2016, 06:55:54 PM
David

Can you give idiots like me any addition hints as to when we should consider using task.yield?

I've looked at the Lua examples, but it's difficult to see why task.yield has been inserted, ie good practice or essential at certain times.

Cheers

Garry
#1741
Scripting Corner / Re: Lua Scripting (lua.mo)
January 27, 2016, 08:07:09 AM
David/Walter

Once again, thanks for the prompt and to the point feedback.

It was my incompetence that I hadn't picked up on the LV 'sensitivity' to some ML functionality. I'll look at the documentation more carefully next time  ;)

I will also build some simple 'error' handling into the script, eg to ensure it doesn't run if not in LV.

BTW I assume if I call lv.start() it will switch on LV if LV is not enabled?

Once again, many thanks, and, because of your help, I hope to be publishing my first script very soon  :)

Finally, can someone explain the need for task.yield and when to use it.
#1742
Scripting Corner / Re: Lua Scripting (lua.mo)
January 26, 2016, 11:10:59 PM
@dmilligan

:)

That fixed it: thank you.

I'm now confident to move to the coding the conditional logic in my script.

Once again thanks for your help.

BTW I hadn't read anywhere that Lua requires you to be in LV.

Cheers

Garry
#1743
Scripting Corner / Re: Lua Scripting (lua.mo)
January 26, 2016, 09:51:17 PM
!!!!!!! I am now !!!!!!!!!!!!!!!!!!

But I still have a non-predicted response.

After the first wait, the lens correctly moves to the macro end.

After the next wait a picture is not taken and the lens moves backwards and forwards between the macro and infinity end.

I'm baffled.
#1744
Scripting Corner / Re: Lua Scripting (lua.mo)
January 26, 2016, 09:28:09 PM
I'm afraid that didn't change anything.

Here is the function I call:

function main()
-- Close ML menu
menu.close()
    console.show()
print "move to macro end"
    key.wait()
-- Move lens to macro end
lens.focus(-10,3)
print "take picture"
    key.wait()
camera.shoot(64, false)
    print (lens.focal_length)
    print (lens.focal_distance)
print (lens.dof_near)
print (lens.dof_far)
print "Press any key to exit"
    key.wait()
    console.hide()
-- quit script
end


After the first key.wait, the lens doesn't move.

After the second key.wait an image is taken and the lens moves to the macro end then back to where it was.

Also the half press becomes active.

I'm mystified as the above code can't get much simpler.

Hope someone can divine what I'm doing wrong :-)
#1745
Scripting Corner / Re: Lua Scripting (lua.mo)
January 26, 2016, 08:48:37 PM
@dmilligan

Thanks for clarifying the console.

May I ask one more question of you: If you look at my simple code, can you see why it wouldn't work.

For example, rather than go to the macro end, when the code runs it seems to go the macro end and then return to where the lens started.

An image isn't taken and the shutter picks up a half press focus, when I have back button set.

As I said: I don't understand as the code seems 'simple' to me.
#1746
Scripting Corner / Re: Lua Scripting (lua.mo)
January 25, 2016, 11:07:56 PM
I hope one of the Lua experts can help with this simple script I am using to try and understand Lua.

-- Test Script

require('keys')


function main()
-- Close ML menu
menu.close()
    console.show()
print "move to macro end"
    key.wait()
-- Move lens to macro end
lens.focus(-10,3)
print "take picture"
    key.wait()
camera.shoot()
    print (lens.focal_length)
    print (lens.focal_distance)
print (lens.dof_near)
print (lens.dof_far)
print "Press any key to exit"
    key.wait()
    console.hide()
-- quit script
end

keymenu = menu.new
{
    parent = "Audio",
    name = "Shoot",
    help = "Simply operates shutter",
    select = function(this) task.create(main) end,
}


All the script does is first move the lens to the macro end, following a key press; then take a picture, following a key press; then display some info; then finish after a key press.

But I get strange results and when in the console I get 'loads' of other Lua reporting, eg about other scripts running.

What am I doing wrong?

Hope some kind person can 'educate me'  :)
#1747
Scripting Q&A / Re: Questions about Lua scripting
January 24, 2016, 08:28:03 PM
@dmilligan

Many thanks for taking the time to 'kick start' this resource. I've downloaded the Lua link to my iPad so I can read and browse at my leisure.

Once again: thanks for taking the time to start the education process  :)

Cheers

Garry

#1748
Scripting Q&A / Questions about Lua scripting
January 24, 2016, 06:48:32 PM
I appreciate this thread may not even get traction, but it is my humble attempt to see if the 'experts' can support the 'newbies' on Lua scripting.

By copying the scripts of others, I am making slow progress on learning to script in ML-Lua.

But like most programming, I find myself struggling with some basics, as I'm not a programmer.

As an example. To print a message I would use

print "test message"

So far so good. But what if I wish to print a variable, ie for debugging. For example lens.focal_length. If I try

print "lens.focal_length" I simply get the text 'lens.focal_length'.

I've tried using the Lua tostring, but get errors.

Bottom line: if this post gets traction, I hope it can be used by all those interested in learning Lua: supported by those that are prepared to mentor others.
#1749
Scripting Corner / Re: Lua Scripting (lua.mo)
January 24, 2016, 04:23:28 PM
Ok I just found out what has been happening.

With the script loaded (in the Audio parent menu) iy shows up OK.

If I toggle to the script submenu and press RATE nothing happens.

If I first press SET then RATE the script appears to function OK.

It's nuances like this that will mean that 'idiots' like me will meander towards scripts that work, ie our only way forward is to adapt others' scripts and experiment (and hope we don't brick our cameras :-))

Bottom line: now I can trigger a script I can focus on my task, ie an auto landscape bracketing script.

Thanks for your help.

Cheers

Garry
#1750
Scripting Corner / Re: Lua Scripting (lua.mo)
January 24, 2016, 04:03:48 PM
Walter

Does that imply you can't 'access' the rate button on the 5D3?