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

#1701
David

Once again thanks for your detailed feedback.

I put the task.yield in out of desperation, as I get the semaphore error with out it.

As I said, I followed the guidance  you gave me before, ie put the camera.shoot in a create.task wrapper.

But as I say, I just keep getting the error: which I can't ignore as it opens the console and fills the screen with all the other ML/Lua 'stuff'.

I'm really not thick, and I really do read your feedback.

Bottom line: with or without the use of task.yield, ie get the error.
#1702
David

I hope you are watching  :)

I continue to suffer from Lua semaphore errors but can't see why, as I followed you advice.

My script is this:

--[[
Manual Landscape bracketing helper script
Version 0.3.3
Garry George Feb 2016
http://photography.grayheron.net/
First focus at nearest bracket in focus stack then move towards infinity.
Try using ML follow focus to control lens, as opposed to rotating lens by hand.
Yellow means move more towards the infinity end, Red means move more towards macro end,
Green means at the sweet spot. If Green not seen, move to just being in the Yellow from being in the Red.
************************
* Must be in liveview! *
************************
--]]
a1 = lens.dof_near
b1 = lens.dof_far
c1 = 0
fp = lens.focal_distance
inf = 1000000
started = false

function do_bookend()
task.create(function()
current_tv = camera.shutter.apex
current_av = camera.aperture.apex
camera.shutter.apex = 100
camera.aperture.apex = 90
camera.shoot(64, 0)
camera.shutter.apex = current_tv
camera.aperture.apex = current_av
end)
task.yield(100)
end

event.keypress = function(key)
if key == KEY.RATE then
if keymenu.submenu["Bookends"].value == "yes"
then
do_bookend()
end
return true
end
if keymenu.submenu["Turn On/Off"].value == "Off" then started = false end
if fp ~= 0 then
if key == KEY.FULLSHUTTER
then
b1 = lens.dof_far -- in mm
fp = lens.focal_distance -- in cm
if keymenu.submenu["Bracket to bracket overlap"].value == "20%" then
factor = .2
elseif keymenu.submenu["Bracket to bracket overlap"].value == "10%" then
factor = .1
else
factor = .05
end
c1 = b1 - (b1 - fp*10)*factor
started = true
end
end
end

lv.info
{
    name = "Landscape Stacker Info",
    value = "",
    priority = 100,
    update = function(this)
    this.value = ""
if fp == 0 then
this.value = ""
else
    if keymenu.submenu["Turn On/Off"].value == "On"
    then
    if started then
a2 = lens.dof_near
this.value = ""
if a2 > b1 then
this.background = COLOR.RED
elseif a2 < c1 then
this.background = COLOR.YELLOW
this.foreground = COLOR.BLACK
else
this.background = COLOR.GREEN1
end
if lens.dof_far >= inf then
this.value = "Inf"
else
this.value = "   "
end
end
else
this.value = ""
end
end
end
}

keymenu = menu.new
{
parent = "Audio",
name = "Landscape Stacking Helper",
help = "First focus at nearest point in bracket set",
help2 = "and take first picture",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Turn On/Off",
help = "Switches the script on/off",
depends_on = DEPENDS_ON.LIVEVIEW,
choices = {"Off","On"},
},
{
name = "Bracket to bracket overlap",
help = "Amount to overlap each bracket",
help2 = "% of FP-2-DoF(far) distance",
choices = {"20%","10%", "5%"},
},
{
name = "Bookends",
help = "Adds a dark frame",
choices = {"no","yes"},
}
}
}


When I press the RATE button I start a new task and steal the keypress and call do_bookend. Sometimes I don't get the semaphore error, but usually I do.

Can you suggest what I'm doing wrong?

Cheers

Garry
#1703
Feature Requests / Re: Trigger Focus Stacking from Remote
February 18, 2016, 07:52:05 AM
@Pedr

Although my interests are directed at landscape focus stacking, which is slightly more complicated than macro focus stacking, I have 'successfully' demonstrated auto focus stacking using Lua scripting, ie triggering from any button.

Unfortunately, some of the core ML and Lua  coding needs fixing for the auto focus bracketing to fully work (my current script is not stable), as, at the moment I can't drive the lens both ways and you can trigger 'soft end' errors. Once this gets fixed, I'll release my auto focus stacker script.

My manual focus stacking experiments with Lua are here: http://www.magiclantern.fm/forum/index.php?topic=16659.msg162352#msg162352
#1704
Scripting Q&A / Re: 'Dumb' Lua question
February 18, 2016, 07:29:02 AM
Walter

Once again many thanks for the pointer.

I have successfully got what I wanted to do up and running, i.e. my landscape focus bracketing now has an option to carry out exposure bracketing at each focus step.

Cheers

Garry
#1705
Scripting Q&A / Re: 'Dumb' Lua question
February 17, 2016, 08:43:06 PM
Walter

Many thanks. I naively followed the language in the Lua 'manual', which says:

get (menu, entry)
    Get the value of some existing ML menu entry
    Parameters:

        menu name of the parent menu ('Audio', 'Expo', 'Overlay', 'Shoot', 'Movie', etc)
        entry name of the menu entry

    Returns:

        the value of the menu entry

#1706
Scripting Q&A / 'Dumb' Lua question
February 17, 2016, 06:44:38 PM
I hope David (Lua guru) is watching and can put me out of my misery, once again!

'All' I'm trying to do is access (get) and then change (set) an ML sub/sub menu item, "Shoot", "Advanced Bracket", "Frames" eg I can get to Advanced Bracket, but how do I get/set Frames?

i = menu.get("Shoot", "Advanced Bracket")


I've tried many different things.

Hope some kind person can help?
#1707
Feature Requests / Auto Bracket Post Shot Review
February 17, 2016, 07:57:07 AM
I haven't really been sensitive to how Auto Bracketing works until now, as I try and build auto bracketing into some script-based workflow.

What seems to happen with auto bracketing, but not with ML taking a fixed numbers of brackets, is that it flashes up an image review after each image and, more importantly leaves the camera on image review after the auto bracketing completes, ie rather than returning to the screen the camera was in at the start of the auto bracketing sequence. BTW I have Canon review set to off.

Is there a way to have auto bracketing behave as fixed ML bracketing, ie not show the image review and return the camera to the pre bracketing state.

#1708
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
#1709
Scripting Corner / Focus Stacking Helper Script
February 16, 2016, 01:08:25 AM
I hope this post and script helps others who are learning/struggling to become 'scripters'.

I couldn't have got this far without the help of David Milligan and others, who have provide feedback.

Although learning Lua scripting is easier than trying to code in ML C, Lua still requires some effort to learn, especially while the 'user manual' is being developed. For instance http://davidmilligan.github.io/ml-lua/index.html helps, but there are still areas where the user is left 'guessing'.

As a scripting newbie, I have spent tens of hours experimenting and trying to divine coding errors. I have educated myself on event driven programming and now have a reasonable looking script to offer the ML community.

This script's only purpose is to provide in-camera feedback to aid landscape (sic) focus stacking, ie NOT macro focus stacking.

The caveats are the lens must report focus distance and DoF, and LV must be on.

Before using it is best to check if the ML DoF is set up correctly, eg I recommend switching on the diffraction aware option.

I have positioned the script in the Audio menu (my preference), but this can me moved elsewhere.

Here is the script, which you should put in a text file with a .lua extension and place this file in the ML script folder.

--[[
Manual Landscape bracketing helper script
Version 0.3.3
Garry George Feb 2016
http://photography.grayheron.net/
First focus at nearest bracket in focus stack then move towards infinity.
Try using ML follow focus to control lens, as opposed to rotating lens by hand.
Yellow means move more towards the infinity end, Red means move more towards macro end,
Green means at the sweet spot. If Green not seen, move to just being in the Yellow from being in the Red.
************************
* Must be in liveview! *
************************
--]]
a1 = lens.dof_near
b1 = lens.dof_far
c1 = 0
fp = lens.focal_distance
inf = 1000000
started = false

event.keypress = function(key)
if keymenu.submenu["Turn On/Off"].value == "Off" then started = false end
if fp ~= 0 then
if key == KEY.UNPRESS_FULLSHUTTER
then
b1 = lens.dof_far -- in mm
fp = lens.focal_distance -- in cm
if keymenu.submenu["Bracket to bracket overlap"].value == "20%" then
factor = .2
elseif keymenu.submenu["Bracket to bracket overlap"].value == "10%" then
factor = .1
else
factor = .05
end
c1 = b1 - (b1 - fp*10)*factor
started = true
end
end
end

lv.info
{
    name = "Landscape Stacker Info",
    value = "",
    priority = 100,
    update = function(this)
    this.value = ""
if fp == 0 then
this.value = ""
else
    if keymenu.submenu["Turn On/Off"].value == "On"
    then
    if started then
a2 = lens.dof_near
this.value = ""
if a2 > b1 then
this.background = COLOR.RED
elseif a2 < c1 then
this.background = COLOR.YELLOW
this.foreground = COLOR.BLACK
else
this.background = COLOR.GREEN1
end
if lens.dof_far >= inf then
this.value = "Inf"
else
this.value = "   "
end
end
else
this.value = ""
end
end
end
}

keymenu = menu.new
{
parent = "Audio",
name = "Landscape Stacking Helper",
help = "First focus at nearest point in bracket set",
help2 = "and take first picture",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Turn On/Off",
help = "Switches the script on/off",
depends_on = DEPENDS_ON.LIVEVIEW,
choices = {"Off","On"},
},
{
name = "Bracket to bracket overlap",
help = "Amount to overlap each bracket",
help2 = "% of FP-2-DoF(far) distance",
choices = {"20%","10%", "5%"},
}
}
}


The script, by default, is not running. To switch it on, go to the menu and switch to 'on'.

Also change the bracket to bracket overlap. The default is 20%, but you can reduce this to 10% or 5%. The % represent the % of the distance between the current bracket's DoF(far) and the focal_distance. According to the lens you may not see the effect of this variable.

Do a half shutter press to get rid of the script's menu and, of course, ensure you are displaying the ML top and bottom bars of information.

To use the script, once switched on, position the lens at the first (closest) bracket and take a picture. You will then see a helper flag (coloured block) come on.

The coloured blocks have the following meaning:
* Yellow = move the lens towards the infinity end
* Red = move the lens towards the macro end
* Green, if seen, means the lens is in the 'sweet spot', according to the % overlap criterion

If you don't see green, but just yellow or red, simply move the lens into the yellow position just before it goes red.

Each time you take a picture move the lens closer to the infinity end until you see INF in the coloured block. This means the DoF-far has reached infinity: you may wish to take an insurance shot beyond this.

Consider using the ML follow focus to move the lens, as this is more controllable than trying to manually position the lens.

To take a new set of brackets, simply reposition the lens to a new closest image and take a picture to reset the bracketing sequence. Consider grabbing a bookend image to separate your bracket sequences, eg an image of your hand: this will help in post processing, especially if you are not recomposing.

Bottom line: I have tested the script on my 5D3 and 24-105 F/4L and it works for me. I hope it does for you. As usual I welcome feedback on this script. Also note that my next project is an automated version of this, but I can't finish this until the next Lua update is pushed out, eg fixing the lens control by Lua.
#1710
Scripting Q&A / Re: Lua Help!!!!
February 15, 2016, 08:23:13 AM
David

I hope you are still watching my 'progress' and sorry for all the posts. This post is the one to read  ;)

Here is the script that I think should run.

--[[
Manual Landscape bracketing script
Version 0.3.1
Garry George Feb 2016
http://photography.grayheron.net/
Assumes lens is first focused at nearest bracket
in focus stack then moved towards infinity.
************************
* Must be in liveview! *
************************
--]]
is_taking_picture = false
is_running = false

keymenu = menu.new
{
parent = "Audio",
name = "Landscape Stacker",
help = "Focus at nearest point in bracket set",
help2 = "AF must be on and in LV!",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Run",
help = "Starts the script",
help2 = "Press SET",
depends_on = DEPENDS_ON.LIVEVIEW,
select = function(this) task.create(main) end,
},
{
name = "Delay",
help = "Seconds to delay start (0-10s)",
value = 5,
min = 0,
max = 10,
}
}
}

function do_take_picture()
--take the picture in another task so we don't block the key handler from returning
is_taking_picture = true
task.create(function()
task.yield(1000 * keymenu.submenu["Delay"].value)
camera.shoot(64, 0)
end)
is_taking_picture = false
end

function main()
if is_running then return end
is_running = true
local b2 = lens.dof_far
local fp = lens.focal_distance
local inf_reached = false
local inf = 1000000
--press half shutter to toggle menu off (but this doesn't work!!!)
-- key.press(HALFSHUTTER)
-- task.yield(50)
-- key.press(UNPRESS_HALFSHUTTER)
--set up the key handler
--main exits immediately after this b/c all it does is set the key handler
event.keypress = function(key)
if is_taking_picture then
is_running = true
return false
elseif key == KEY.JOY_CENTER then
-- take a picture and keep looking for JOY_CENTER key press
do_take_picture()
is_running = true
return false
elseif key == KEY.RATE then
-- stop: unregister keypress handler so we stop receiving events and end script
event.keypress = nil
is_running = false
return true
end
return true
end
end

lv.info
{
    name = "Landscape Stacker Info",
    value = "",
    priority = 100,
    update = function(this)
           this.background = COLOR.RED
           this.foreground = COLOR.WHITE
this.value = string.format("DoF %dcm",lens.dof_near)
    end
}


I still get semaphore messages in the console and the script exits after a press the JOY_CENTER button, and I don't think it should.

Also, after I press RUN in the menu, the menu stays on the screen. I can get rid of it, by manually pressing a half_shutter. So I tried to emulate that in the script, but that failed (so I commented it out).

All I want this script to do is remove the run menu, leave the ML bars on the LV, so I can provide feedback on DoF, and allow me to keep grabbing images via pressing the JOY_CENTER.

I just can't see what I'm doing wrong!

Hope you can put me out of my misery.

Cheers

Garry
#1711
Scripting Q&A / Re: Lua Help!!!!
February 14, 2016, 11:02:29 PM
David

I had tried that before: but no luck.

Does anything else jump out at you:

--[[
Manual Landscape bracketing script
Version 0.3.1
Garry George Feb 2016
http://photography.grayheron.net/
Assumes lens is first focused at nearest bracket
in focus stack then moved towards infinity.
************************
* Must be in liveview! *
************************
--]]
is_taking_picture = false
is_running = false
b2 = lens.dof_far
fp = lens.focal_distance
inf_reached = false
inf = 1000000

keymenu = menu.new
{
parent = "Audio",
name = "Landscape Stacker",
help = "Focus at nearest point in bracket set",
help2 = "AF must be on and in LV!",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Run",
help = "Starts the script",
help2 = "Press SET",
depends_on = DEPENDS_ON.LIVEVIEW,
select = function(this) task.create(main) end,
},
{
name = "Delay",
help = "Seconds to delay start (0-10s)",
value = 5,
min = 0,
max = 10,
},
{
name = "Bracket to bracket overlap",
help = "% to overlap each bracket",
help2 = "% of current fp-2-DoF",
choices = {"1%","5%", "None"},
}
}
}

function do_take_picture()
--take the picture in another task so we don't block the key handler from returning
is_taking_picture = true
task.create(function()
task.yield(1000 * keymenu.submenu["Delay"].value)
beep(4, 100, 500)
camera.shoot(64, 0)
is_taking_picture = false
end)
end

function main()
if is_running then
return end
is_running = true
local b2 = lens.dof_far
local fp = lens.focal_distance
local inf_reached = false
local inf = 1000000
--set the key handler
--main actually exits immediately after this b/c all it does is set the key handler
--but main's local variables stick around because the key handler "closes" on them (this is called a "closure")
event.keypress = function(key)
if is_taking_picture then return false
elseif key == KEY.JOY_CENTER then
do_take_picture()
is_running = true
    return true
elseif key == KEY.INFO then
--stop: unregister keypress handler so we stop recieving events
event.keypress = nil
is_running = true
return true
end
return false
end
end

lv.info
{
    name = "Landscape Stacker Info",
    value = "",
    priority = 100,
    update = function(this)
           this.background = COLOR.RED
           this.foreground = COLOR.WHITE
this.value = string.format("DoF %dcm",lens.dof_near)
    end
}
#1712
Scripting Q&A / Re: Lua Help!!!!
February 14, 2016, 08:45:19 PM
David

I'm close to giving up, but don't want to!

This script keeps generating semaphore errors and I can't work out how to keep the ML LV display on, ie to get the visual feedback.

Can you kindly put me out of my misery: where am I going wrong.

All the script does is set up the key handler, provide LV feedback in the ML top bar, look for the joy stick (to take a picture and continue) or look for the INFO button to stop.

--[[
Manual Landscape bracketing script
Version 0.3.1
Garry George Feb 2016
http://photography.grayheron.net/
Assumes lens is first focused at nearest bracket
in focus stack then moved towards infinity.
************************
* Must be in liveview! *
************************
--]]
is_taking_picture = false
is_running = false
b2 = lens.dof_far
fp = lens.focal_distance
inf_reached = false
inf = 1000000

keymenu = menu.new
{
parent = "Audio",
name = "Landscape Stacker",
help = "Focus at nearest point in bracket set",
help2 = "AF must be on and in LV!",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Run",
help = "Starts the script",
help2 = "Press SET",
depends_on = DEPENDS_ON.LIVEVIEW,
select = function(this) task.create(main) end,
},
{
name = "Delay",
help = "Seconds to delay start (0-10s)",
value = 5,
min = 0,
max = 10,
},
{
name = "Bracket to bracket overlap",
help = "% to overlap each bracket",
help2 = "% of current fp-2-DoF",
choices = {"1%","5%", "None"},
}
}
}

function do_take_picture()
--take the picture in another task so we don't block the key handler from returning
is_taking_picture = true
task.create(function()
msleep(1000 * keymenu.submenu["Delay"].value)
beep(4, 100, 500)
camera.shoot(64, 0)
is_taking_picture = false
end)
end

function main()
if is_running then
return end
is_running = true
local b2 = lens.dof_far
local fp = lens.focal_distance
local inf_reached = false
local inf = 1000000
--set the key handler
--main actually exits immediately after this b/c all it does is set the key handler
--but main's local variables stick around because the key handler "closes" on them (this is called a "closure")
event.keypress = function(key)
if is_taking_picture then return false
elseif key == KEY.JOY_CENTER then
do_take_picture()
is_running = false
    return true
elseif key == KEY.INFO then
--stop: unregister keypress handler so we stop recieving events
event.keypress = nil
is_running = false
return true
end
return false
end
end

lv.info
{
    name = "Landscape Stacker Info",
    value = "",
    priority = 100,
    update = function(this)
           this.background = COLOR.RED
           this.foreground = COLOR.WHITE
this.value = string.format("DoF %dcm",lens.dof_near)
    end
}
#1713
Scripting Q&A / Re: Lua Help!!!!
February 14, 2016, 05:02:00 PM
David :-)

I hope you still have time to help nudge me in the right direction.

I'm starting simple, to create a working framework, into which I'll add other functionality.

Here is the code:

--[[
Manual Landscape bracketing script
Version 0.3
Garry George Feb 2016
http://photography.grayheron.net/
Assumes lens is first focused at nearest bracket
in focus stack then moved towards infinity.
************************
* Must be in liveview! *
************************
--]]
is_taking_picture = false
b2 = lens.dof_far
fp = lens.focal_distance
inf_reached = false
inf = 1000000

keymenu = menu.new
{
parent = "Audio",
name = "Landscape Stacker",
help = "Focus at nearest point in bracket set",
help2 = "AF must be on and in LV!",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Delay",
help = "Seconds to delay start (0-10s)",
value = 5,
min = 0,
max = 10,
},
{
name = "Bracket to bracket overlap",
help = "% to overlap each bracket",
help2 = "% of current fp-2-DoF",
choices = {"1%","5%", "None"},
}
}
}

event.post_shoot = function()
      beep(4, 100, 500)
end

lv.info
{
    name = "Landscape Stacker Info",
    value = "",
    priority = 100,
    update = function(this)
           this.background = COLOR.RED
           this.foreground = COLOR.WHITE
this.value = string.format("DoF %dcm",lens.dof_near)
    end
}


The problem is, because it doesn't beed, I don't think the post shoot event is being picked up.

The LV is working and I see the DoF displayed in the bar at the top right of the ML menu. BTW how do I reposition this, or is it fixed in that location?

Cheers

Garry
#1714
Feature Requests / Re: Burning user info into an image
February 12, 2016, 06:00:06 AM
The idea was to record info in camera.

As I say, I stick with pencil and paper
#1715
Feature Requests / Re: Burning user info into an image
February 11, 2016, 03:20:06 PM
David

Thanks, I'll keep using pencil and notebook  :)

Cheers

Garry
#1716
Feature Requests / Burning user info into an image
February 11, 2016, 10:10:17 AM
Now we have Lua scripting, I wonder if it is possible to consider the follow additional ML features.

1. Writing additional user info to an image's EXIF, eg focal distance, DoF etc etc. does EXIF support adding  text info?

2. Could someone think about a way to add text direct to the sensor, raw file. Once again, info about the image or a set of brackets etc

Either if the above would 'burn in' field data to the image, or associated image, to aid subsequent post processing etc.
#1717
Scripting Q&A / Re: Lua Help!!!!
February 10, 2016, 07:38:19 AM
David

More testing of things plus deeper reading of your demo recdelay demo script.

Also I tried running your recdelay script on my 5D3, but, although I'm in movie mode and have entered times for the delay etc, pressing SET fails to trigger the script, ie when Run highlighted.

Is there a nuance I'm not picking up?

Cheers

Garry
#1718
Scripting Q&A / Re: Lua Help!!!!
February 09, 2016, 08:12:48 PM
David

Truly I thank you for your time. I get it now.

The 'only' thing I'm struggling with is how to continuously get the DoF info and provide user feedback, eg dof_far >  inf, say, but continue looking for events.

The script I'm writing continuously provides the user feedback and only needs two key presses, to take a picture or stop the script.

The user manually adjusts the lens until the lens is positioned correctly according to user feedback.

I hope this makes sense:-)
#1719
Scripting Q&A / Re: Lua Help!!!!
February 09, 2016, 08:10:12 AM
David

I studied your 'version' of my code and other pieces of code on the Lua github pages, and hope you can explain something.

If I going to use events to track changes the basic framework would seem to me like this, ie I need a main loop (note not coded, just text)):

-- Set up things here

function do_something
-- for example
task.create(function()
msleep(1000 * keymenu.submenu["Delay"].value)
camera.shoot(64, 0)
is_taking_picture = false
end)
end

function do_something_else
-- other stuff
           task.create(function()
-- other stuff that needs 'isolating'
   end)
end

function main()
  repeat
  -- provide feedback on lens position

  -- look for keypress
  event.keypress = function(key)
    if is_taking_picture then
return false
elseif key == KEY.JOY_CENTER then
    do_something
    elseif key == KEY.RATE then
    do_something_else
    end
  end
  until end condition meet
end -- function main()

-- menu set up stuff


My confusion in looking at your example of my code is that I can't see the 'infinite' loop, ie repeat-until.

Or is the event.keypress the loop? That is if event.keypress returns false it simply keeps looking.

That is event.keypress becomes the 'main loop' waiting for the end key to be pressed, ie RATE for me.

Or have I miss interpreted event handling.

Cheers

Garry

BTW what does CBRs means?
#1720
Scripting Q&A / Re: Lua Help!!!!
February 08, 2016, 06:50:06 PM
David

Many thanks for taking the time to respond, educate me and rewrite my code.

I'll look tonight.

Cheers

Garry
#1721
Scripting Q&A / Re: Lua Help!!!!
February 08, 2016, 07:51:50 AM
David

This is not the finished script, but I believe it works well, other than the console coming on and me getting the semaphore messages (which I don't understand).

This script is the manual version of the auto one that I will release, once Lua can control the lens in both directions.

I also note that when I press SET to run the script, a 0 comes up in the Run sub menu.

I hope you can find the time to cast your eyes over the script.

Cheers

Garry

--[[
Manual Landscape bracketing script
Version 0.3
Garry George Feb 2016
http://photography.grayheron.net/
Assumes lens is first focused at nearest bracket
in focus stack then moved towards infinity.
************************
* Must be in liveview! *
************************
--]]
require('keys')
function main()
-- Declare a few local variables for use only in this main function
local b2 = lens.dof_far
local fp = lens.focal_distance
local inf_reached = false
local inf = 1000000
local key
keys:start()
display.clear()
for i = keymenu.submenu["Delay"].value,0,-1
do
msleep(1000)
end
task.yield(100)
camera.shoot(64, 0)
repeat
task.yield(100)
key = keys:getkey()
if key == KEY.JOY_CENTER
then -- grab an image
task.yield(100)
b2 = lens.dof_far
fp = lens.focal_distance
if keymenu.submenu["Bracket to bracket overlap"].value == "1%"
then
b2 = b2 - (b2-fp*10)*0.01
end
if keymenu.submenu["Bracket to bracket overlap"].value == "5%"
then
b2 = b2 - (b2-fp*10)*0.05
end
-- Delay for requested seconds
for i = keymenu.submenu["Delay"].value,0,-1
do
msleep(1000)
end
task.yield(100)
camera.shoot(64, 0)
if lens.dof_far == inf then inf_reached = true end
end
-- provide feedback for next bracket position
if lens.dof_near > b2 then led_blink (3,50,500) end
if lens.dof_far == inf then beep(4, 100, 500) end
until key == KEY.RATE or inf_reached == true
-- quit script
beep(3, 100, 630)
keys:stop()
end

keymenu = menu.new
{
parent = "Audio",
name = "Landscape Stacker",
help = "Focus at nearest point in bracket set",
help2 = "AF must be on and in LV!",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Run",
help = "Starts the script",
help2 = "Take first bracket and press SET",
depends_on = DEPENDS_ON.LIVEVIEW,
select = function(this) task.create(main) end,
},
{
name = "Delay",
help = "Seconds to delay start (0-10s)",
value = 5,
min = 0,
max = 10,
},
{
name = "Bracket to bracket overlap",
help = "% to overlap each bracket",
help2 = "% of current fp-2-DoF",
choices = {"1%","5%", "None"},
}
}
}
#1722
Scripting Q&A / Lua Help!!!!
February 07, 2016, 10:29:15 PM
I'm bashing my head trying to get a Lua script to work.

It does, but I keep getting the console starting (when I'm not switch it on) and the repeated message...

"Lua semaphore time out (another task is running this script)" followed by a Save Configs,

Can anyone suggest what I'm doing wrong?
#1723
Walter

I've got round this is my script as I start at the macro end and drive the lens to the infinity end, but stop before the infinity soft stop.

The key thing that I hope that David has fixed is Lua being able to drive the lens is both directions.

Cheers

Garry
#1724
David

I've successfully written a script that does focus and exposure bracketing for landscapes, but can't fully test until the next nightly release.

My next Lua experiments revolve around exploiting accessing ETTR exposure.

I honestly wouldn't say I have a real project yet.

As I say the priority is to get the next Lua nightly, where I hope you have managed to fix a few things, critically driving the lens in both directions :-)

Cheers

Garry
#1725
Alex

Once again thanks for the pointer.

If I look at accessing ETTR and returning an exposure to subsequently use in a Lua script, how would one code this is in Lua speak.

Cheers

Garry