Auto Landscape Focus Bracketing Script

Started by garry23, January 30, 2016, 10:11:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

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

lureb74

Ciao Garry,
Thank you for your job, I know that it is still in develop, but I think it will be a very useful script!
I tried the script with a 5D3 and a EF 24-105 at 24mm f/8 - 800ISO - 2" shutter (was night), starting with infinite focus. First, I check the lens data in ML, and it reported all data (focus distance and DOF values), so I expected the script to work fine... but...

- In between the shots I read a "focus error :(" message on the top-left LCD corner.

- the resulted stacked image (using helicon), have some distance range of very soft focus (I will try again in these days and post images).

Do you think it's possible to use the script with FRSP feature? I tried but it doesn't work (the script simply stop running).

Thanks for your attention!
Lorenzo

garry23

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

garry23

Lorenzo

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

Cheers

Garry

garry23

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

garry23

Lorenzo

Not sure if you are still interested in landscape focus stacking, but the update to the auto script remains broken until I confirm Lua has been updated, i.e. to drive the lens in both directions.

I have, however, released a manual version and put it n the scripts repository.

Cheers

Garry