Monday, May 30, 2016

You can never have enough batteries

This is a short post as I'm off work today for the late spring bank holiday in the UK, which originally was the Monday after Pentecost. This is also known as Whitsun or Whit Monday here in the UK, or also known as Monday of the Holy Spirit. It was a moveable feast in the Christian calendar because it is determined by the date of Easter. BTW Whit Monday gets its English name from "Whitsunday", an English name for Pentecost, one of the three baptismal seasons. The origin of the name "Whit Sunday" is generally attributed to the white garments formerly worn by those newly baptized on this feast

The Banking and Financial Dealings Act 1971, moved this bank holiday to the last Monday in May, following a trial period of this arrangement from 1965 to 1970.

As all photographers know, two things are guaranteed  to kill you in the field: full memory cards or flat batteries. 

Until now the only solution for a flat battery was to carry more batteries, whether you used one at a time or two in a battery grip: I personally own 6 for my 5D3 alone. 

The folks over at Tether Tools have come up with the Case Relay Camera Power System, which provides constant, uninterruptible power for your camera. 

All you need to do is connect the Case Relay EPS to an External Battery Pack, I had a few laying around already, and you’ll be able to shoot considerably longer than you would with your standard camera battery. For example, a 10,000 mAh external battery provides 3-10 times the power of most camera batteries. Need more power? Just hot swap in another power bank and continue shooting while never losing power to your camera. 

The system looks like this:


 I also bought a few extras to allow me to carry the battery pack on my tripod.


As a Magic Lantern shooter I bought the Case Relay system as I find myself making extensive use of Live View, which will drain your batteries. So far I'm impressed and I'll provide further reports in future posts.
 

Saturday, May 28, 2016

Another Update towards the Ultimate Bracketing In-camera Script

As readers of my blog are aware, I have been putting some effort into writing a bracketing script for (non-macro) focus bracketing.

In this post I offer my latest version for testing and feedback.

I have tried to make the script 'robust' and have built in some error checking (but still read the comments at the start of the script).

The script will automatically do the following things:

  • Take a set of focus brackets from near to infinity
  • Take a set of exposure brackets from the user set shadow end exposure (hint use ML's RAW spotmeter), to the ETTR position
  • Take exposure and focus bracket sets together
  • Take a set of exposure brackets, ie to simulate (in post) a longer ND time
  • Take any number of the same exposure brackets, eg for post processing for super-res or eliminating people
The usual caveats apply, ie I wrote the script for my use and to run on my 5D3 with my lenses. However, I'm confident it should run on any non-EOSM camera that runs the ML Lua module. 

Note the lens must report focus distance, ie have AF.

Finally, I really would welcome feedback from others, ie to help me in my efforts and to make the script even better.


UPDATED: 29th May 2016

--[[
Auto Bracketing Script
Auto focus bracketing with exposure bracketing
Plus the script does both time and frame bracketing, ie for LE situations
Release 0.95
This version has some error detection, but the user must be aware of certain things:
* Check the correct DoF diffraction options are set in ML, eg diffraction aware is on for best data
* Must use a lens that reports focus distance and DoF can be calculated
* Lens must be in AF mode
* Must be in manual mode
* Switch stabalisation off as you will not be hand holding ;-)
* Must be in LV mode: script won't run unless in LV
* ETTR ON: settings recommended are - no link to dual, SNRs to OFF, highlights very low or zero (your choice_, and not Always On or Auto Snap
* as this may 'confuse' the script
* You can switch focus bracketing on/off in the menu, ie use LE and/or exposure mode alone. The script handles the logic, ie if LE mode is being used,
* then you can't use focus or exposure bracketing
* Image review must not be set to HOLD in Canon menu
* Assumes lens is focused at nearest point to start a focus stack, ie script moves to infinity
* Script takes last bracket with focus point at infinity
* When exposure bracketing, set base exposure to capture shadows (the script will calculate the ETTR of the scene)
* If ETTR fails, then try adjusting ETTR set time to give your camera more time (or experiment with less)
* Final thought: photography should be relaxing, hence I personally don't mind that this script takes time to run. As it's
* running, look around you and enjoy nature and the moment :-)
*******************************************************************************************************
*                                                                                  *
* If you reference this script, please consider acknowledging me at http://photography.grayheron.net/ *
*                                                                                  *
*******************************************************************************************************
--]]

-- Declare a few variables for the script whick load when camera switced on
a1 = 0
b1 = 0
a2 = 0
b2 = 0
fp = 0
inf = 100000
base_tv = 0
delay = 0
factor = 0
num_brackets = 0
ETTR_tv = 0
base_tv = 0
user_tv = 0
LE_brackets = 0
running = false
no_tv_error = true
brackets_requested = false
flash = true

function reset()  -- tidy up at the end
    no_tv_error = true
    brackets_requested = false
    running = true
    display.notify_box("***FINISHED***",4000)
    beep (3, 200 , 1000)  -- notify end of script
    display.clear()
end

function my_shoot()
    if camera.shutter.apex < -4 then
        camera.bulb(camera.shutter.value)
        else
        camera.shoot(64, false)
    end
end

function check_bookend()
if keymenu.submenu["Bookends?"].value == "yes"
    then
        local tv = camera.shutter.ms
        local av = camera.aperture.value
        camera.shutter.ms = 1
        camera.aperture.apex = 9
        my_shoot()
        camera.shutter.ms = tv
        camera.aperture.value = av
    end
end

function find_ETTR()
-- Find the ETTR shutter value: make sure you have set ML ETTR values correctly
    local m = menu.get("Auto ETTR","Trigger mode")
    menu.set("Auto ETTR","Trigger mode",0) -- set ETTR menu to get an ETTR exposure
    local check_tv = 0
    repeat -- hang around until ETTR value has stabilised
        check_tv = camera.shutter.apex
        msleep (keymenu.submenu["ETTR Set Time?"].value*1000)  -- adjust this for your camera. The time delay allows the ML ETTR process to settle down
    until check_tv == camera.shutter.apex
    ETTR_tv = camera.shutter.apex
    menu.set("Auto ETTR","Trigger mode",m) -- reset to user ETTR menu setting
    if ETTR_tv < base_tv
    then -- base TV needs resetting
        display.notify_box("Warning Shadow Tv < ETTR Tv",4000)
        beep (3, 200 , 500)  -- warning message
        no_tv_error = false
    end
end

function calc_brackets()
    if no_tv_error then
        num_brackets = (ETTR_tv - base_tv)/factor
        num_brackets = math.floor(math.abs(num_brackets))
        if num_brackets <= 1 then num_brackets = 1 end
    end
end

function check_LE()
--    Check to see if user has requested LE bracketing of some kind
    if keymenu.submenu["LE mode?"].submenu["select"].value ~= 0
    then
    if keymenu.submenu["LE mode?"].submenu["Mode?"].value == "time"
    then
    LE_brackets = math.ceil(keymenu.submenu["LE mode?"].submenu["select"].value/camera.shutter.value)
    else
    LE_brackets = keymenu.submenu["LE mode?"].submenu["select"].value
    end
    brackets_requested = true
    end
end

function take_brackets()
    local i
    if LE_brackets == 0
    then
        if no_tv_error and brackets_requested then -- take exposure brackets
            camera.shutter.apex = ETTR_tv
            my_shoot()
            for i = 1, num_brackets , 1
            do
                camera.shutter.apex = camera.shutter.apex - factor
                my_shoot()
            end
            if camera.shutter.apex > base_tv
            then
                camera.shutter.apex = base_tv  
                my_shoot()
            end
        else -- take a single image
            camera.shutter.apex = base_tv
            my_shoot()
        end
    else -- take some LE bracketing images
        for i = 1, LE_brackets , 1
        do
            my_shoot()
        end
--        if no_tv_error then check_bookend() end
    end
end

function albs()
    if brackets_requested and keymenu.submenu["LE mode?"].submenu["select"].value == 0 then
        find_ETTR()
        calc_brackets() -- number of exposure brackets
    else
        msleep(delay)
    end
    if no_tv_error then check_bookend() end
--     Get DoF info & take first(only) exposure(s)
    a2 = lens.dof_near
    b2 = lens.dof_far
    if no_tv_error then take_brackets() end
-- take focus brackets to infinity if requested
    if keymenu.submenu["Focus bracketing?"].value == "yes"
    then -- do focus bracketing
    if lens.focus_distance < inf and no_tv_error then
        repeat
        a1=a2
        b1=b2
            repeat
                lens.focus(-1,1)
                b2 = lens.dof_far
                a2 = lens.dof_near
                fp = lens.focus_distance
            until a2 > b1 or fp >= inf
        lens.focus(1,1) -- move back one step for focus bracket overlap
        take_brackets()
        until fp >= inf
    end
    end
    if no_tv_error then check_bookend() end
    reset()  -- do some tiding up beforing exiting
end

function setup() -- does some checking before calling the main function
    menu.close()
    factor = tonumber(keymenu.submenu["Ev bracket delta per image"].value) -- set exposure bracketing offset (0, 1 or 2)
    if not lv.enabled then lv.start() end -- just in case
    if camera.model_short == "EOSM" then
        display.notify_box("Sorry doesn't work with the EOSM", 3000)
    else
        check_LE()
        if factor ~= 0 then brackets_requested = true else brackets_requested = false end
        if running -- then script has already been used since camera switched on
        then -- reset some stuff...just to be sure :-)
            no_tv_error = true
        end
        if lens.focus_distance ~= 0 and lens.af -- lens is OK
        then -- fit to run the main function
            base_tv = camera.shutter.apex
            albs()
        else  -- lens not OK!
            beep (3, 200 , 500)  -- warning message
            display.notify_box("Check your lens", 5000)
        end
    end
end

keymenu = menu.new
{
    parent = "Shoot", -- change this to position the script into other ML menu locations
    name = "Auto Bracketing",
    help = "Remember: LV, DoF & AF on",
    depends_on = DEPENDS_ON.LIVEVIEW,
    warning = function(this)
            if menu.get("Expo","Auto ETTR") == 0 then return "ETTR switched off" end
            end,
    submenu =
    {
        {
            name = "Run Script",
            help = "Does what it says after pressing SET",
            warning = function(this)
                flash = not flash
                if not lv.enabled then return "LV not enabled" end
            end,
            select = function(this)
            if menu.get("Expo","Auto ETTR") ~= 0 and lv.enabled then
            task.create(setup)
            end
            end,
        },
        {
            name = "Focus bracketing?",
            help = "Switches focus bracketing mode on/off",
            choices = {"no","yes"},
            update = function(this)
                if keymenu.submenu["LE mode?"].submenu["select"].value ~= 0 then
                menu.set("Auto Bracketing","Focus bracketing?",0)
                end
            end,
            warning = function(this)
                flash = not flash
                if keymenu.submenu["LE mode?"].submenu["select"].value ~= 0 then
                if flash then
                    return "LE mode on"
                    else
                    return ""
                end
                end
            end,
        },
        {
            name = "Ev bracket delta per image",
            help = "0 = no auto exposure bracketing",
            min = 0,
            max = 2,
            update = function(this)
                    if keymenu.submenu["LE mode?"].submenu["select"].value ~= 0 then
                    menu.set("Auto Bracketing","Ev bracket delta per image",0) end
            end,
            warning = function(this)
                if keymenu.submenu["LE mode?"].submenu["select"].value ~= 0 then
                if flash then
                    return "LE mode on"
                    else
                    return ""
                end
                end
            end
        },
        {
            name = "LE mode?",
            rinfo = function(this)
                if keymenu.submenu["LE mode?"].submenu["select"].value == 0
                    then return "off"
                    else return "active"
                end
            end,
            help = "In seconds or frames. Zero = no LE bracketing",
            halp2 = "LE or frame bracketing trumps all other bracketing modes",
           submenu =
            {
                {
                    name = "select",
                    min = 0,
                    max = 120,
                    rinfo = function(this)
                        if keymenu.submenu["LE mode?"].submenu["Mode?"].value == "time" then return "secs" else return "frames" end
                    end,
                    update = function(this)
                        if keymenu.submenu["LE mode?"].submenu["select"].value ~= 0 then
                        menu.set("Auto Bracketing","Ev bracket delta per image",0)
                        menu.set("Auto Bracketing","Focus bracketing?",0)
                        end
                    end,
                    warning = function(this)
                    if keymenu.submenu["LE mode?"].submenu["Mode?"].value == "time" then
                    LE_brackets = math.ceil(keymenu.submenu["LE mode?"].submenu["select"].value/camera.shutter.value)
                    if LE_brackets == 0 then
                    return "LE bracket taking switched off"
                    else
                    return "Note: "..tostring(LE_brackets).." brackets will be taken"
                    end
                    end
                    end
                },
                {
                    name = "Mode?",
                    choices = {"time","# frames"},
                    help = "In seconds or #frames. Zero = no LE bracketing",
                }
            }
        },
        {
            name = "Bookends?",
            help = "Places a dark frame at start and end of focus bracket set",
            choices = {"no","yes"},
        },
        {
            name = "Delay",
            help = "Delays script start by stated number of secs",
            choices = {"2","5","0"},
            update = function(this)
                delay = tonumber(keymenu.submenu["Delay"].value)*1000 -- delay in ms
            end,
        },
        {
            name = "ETTR Set Time?",
            help = "A camera specific variable in seconds",
            help2 = "Only change if ETTR fails to find a solution",
            min = 2,
            max = 8,
            value = 4 -- set this to time that works in your camera
        }
    }
}

Sunday, May 22, 2016

Long Exposure Simulation in Lightroom

One technique that many photographers ‘ignore’ is long exposure photography. The reasons are simple: if shooting in bright conditions then getting to long exposures is near impossible without the use of Neutral Density (ND) filters; with NDs you need to carry extra equipment, the NDs, to cover you various lenses as well as various NDs to ensure you can cover a wide LE domain; if you try and ‘save some equipment’, by using a variable ND, then you may generate exposure variability across the sky if shooting too wide.

One technique that overcomes the above limitations is to ‘simulate’ LEs by taking multiple images and post processing them. For example, if my base exposure was, say, 1/10s, and I wanted to take a 2 second exposure; then I would take 20 consecutive images and post process then to simulate the 2 second exposure I could not take.

If you have Magic Lantern enabled on your Canon EOS, then you could make use of the RAW video feature and lower the fps to capture the 20 x 1/10 exposures. But what if you wanted to simulate, say, a 60 second exposure. Well you could exend the RAW video technique, but you will need to post process some 600 images!

This is why I developed the following ‘hybrid’ approach. That is carrying a single ND to slow the shutter to a reason speed for LE simulation. In the test example in this post I set myself the task of taking a 60 second exposure in daylight. The base exposure was about 1/300s, but I had access to a 10 stop ND. But this ‘only’ shifted my exposure to about 3 seconds, ie a factor of 20 down from a 60 second exposure goal, hence I still needed to capture 20 images: still a lot better than some 18,000 images, ie 60/(1/300).

Rather than try to do this by hand, I decided to write a simple Lua script to do all the hard work for me. In addition, I decided to make use of the Magic Lantern Full Resolution Silent Picture (FRSP) feature, that directly reads the imaging sensor without (sic) any shutter actuation. The downside of FRSP is that you need to limit the exposure time to between about 0.1s to 15s; which for my LE use was fine. In my script, I coded this to 0.25s to 14s.

To run the script, all you need to do is to compose, set your exposure and ensue your shutter speed is between the limits above (the script will warn you if you don’t satisfy the FRSP limits). In the test example below (shot in my garden this morning), I used my ND1000 on my 24-105mm at 24mm, which reduced the exposure to 3.2s at my selected F/10 aperture.

To run the script, I simply went into Live View, turned on the script (it’s in the ML Shoot menu), selected bookends (which places a dark frame at the beginning and end of the LE bracket set to help differentiate bracket sets in post), set a 60s LE exposure request and a 2 second delay.

The script then automatically captured 22 DNGs (20 LE brackets + 2 bookends), silently and without any shutter actuation.

I then ingested the DNGs into Lightroom and things looked like this:


I then adjusted the first LE image to my liking and synced the other 19 to this first image. I then used the LR/Enfuse plugin to process the 20 images, making sure that contrast weight was set to maximum and exposure weight to minimum. I then tweaked the post processed image in Lightroom.

For comparison, here is one of the 3.2s base images, clearly showing that at 3.2s there was little (LE) impact in the sky:



And here is the 60s simulated (Enfused) image, showing the LE effect in the sky (including a sensor/lens spot I should have dealt with!):



Finally, some may be saying why bother. Well apart from the LE simulation for artistic reasons, the attached script will also generate a fixed exposure bracket set (without shutter action) and this could be useful for the following situations:
  • Eliminating people from a scene (as long as they are moving) 
  • Super-resolution processing, eg doubling the resolution for large prints 
  • Increasing dynamic range (or S/N of the image), eg 16 images will reduce the ‘dark end’ noise by 2Ev.
For Canon users, that wish to play around with Shutterless LE bracketing, here is the Lua script.

Enjoy!

--[[
LE simulation using shutterless, Full Res Silent Picture bracketing.
Creates (same exposure) brackets for post processing a simulated LE exposure, eg via PS-CC mean smart filter stack
User must re-select FRSP mode, ie DNG or MLV and Dual-ISO if required
Base exposure must be between 0.25-14 secs
Finally, because of my 'work arounds' for triggering the intervalomter function in Lua, the LV will flash on and off a few times
Version 0.5
*******************************************************************************************************
*                                                                                  *
* If you reference this script, please consider acknowledging me: http://photography.grayheron.net/   *
*                                                                                  *
*******************************************************************************************************
--]]

function my_shoot()
    -- Grab a/some timelapse image(s)
    lv.pause()  -- switch off LV, if on, but keep shutter open
    menu.open()
    menu.close()
    repeat -- hang around until finished
        msleep (300)
    until interval.running == 0 -- when intervalometer has finished
end

function check_bookend()
if keymenu.submenu["Bookends?"].value == "yes"
    then
        lv.pause()  -- switch off LV, if on, but keep shutter open
        local tv = camera.shutter.ms
        local av = camera.aperture.value
        menu.set("Expo","Expo. Override",1)
        camera.shutter.value = 0.3
        camera.aperture.value = 20
        menu.set("Intervalometer","Start after",0)
        menu.set("Shoot","Intervalometer",1)
        menu.set("Intervalometer","Take Pics...",0)
        menu.set("Intervalometer","Start trigger",0)
        menu.set("Intervalometer","Stop after",1)
        menu.set("Shoot","Silent Picture",1)
        menu.set("Silent Picture","Silent Mode",5)
        my_shoot()
        camera.shutter.ms = tv
        camera.aperture.value = av
    end
end

function go() -- and run the script
    if camera.shutter.value < 0.25 or camera.shutter.value > 14 then -- not fit for FRSP use
        -- Set to a 'safe' condition before exiting
        menu.close()
        menu.set("Shoot","Intervalometer",0)
        menu.set("Shoot","Silent Picture",0)
        menu.set("Intervalometer","Start trigger",1)
        beep (3, 200 , 500)  -- display warning message
        display.notify_box("Adjust your shutter time: 0.25-14 secs", 5000)
    else -- alright to use FRSP
        lv.start()  -- just in case
        check_bookend()
        local LE_brackets = math.ceil(keymenu.submenu["LE Time?"].value/camera.shutter.value)
        local delay = tonumber(keymenu.submenu["Delay"].value)
        if keymenu.submenu["Bookends?"].value == "yes" then delay = 0 end
    -- Ensure Intervalometer and FRSP menus are set correctly
        menu.set("Shoot","Intervalometer",1)
        menu.set("Intervalometer","Take Pics...",0)
        menu.set("Intervalometer","Start trigger",0)
        menu.set("Intervalometer","Start after",delay)
        menu.set("Intervalometer","Stop after",LE_brackets)
        menu.set("Intervalometer","Manual FocusRamp",0)
        menu.set("Shoot","Silent Picture",1)
        menu.set("Silent Picture","Silent Mode",5)
        menu.set("Expo","Expo. Override",1)
    -- trigger intervalometer via ML menu close
        my_shoot()
        msleep(100)
        check_bookend()
        lv.resume() -- switch LV back on, from using intervalometer, to signify end of bracketing
    -- Set Intervalometer and FRSP to a 'safe' condition before exiting
        menu.set("Shoot","Intervalometer",0)
        menu.set("Shoot","Silent Picture",0)
        menu.set("Intervalometer","Start trigger",1)
        display.notify_box("LE sim script finished", 5000)
        beep(3)
    end
end

keymenu = menu.new
{
    parent = "Shoot",
    name = "LE Simulator",
    help = "Only uses FRSP",
    depends_on = DEPENDS_ON.LIVEVIEW,
    submenu =
    {
        {
            name = "Run Script",
            help = "Does what it says after pressing SET",
            depends_on = DEPENDS_ON.LIVEVIEW,
            select = function(this) task.create(go) end,
        },
        {
            name = "LE Time?",
            help = "Simulated LE time in seconds",
            min = 1,
           max = 600,
            value = 1
        },
        {
            name = "Delay",
            help = "Delays script start by stated number of secs",
            choices = {"2","5","0"},
        },{
            name = "Bookends?",
            help = "Places a dark frame at start and end of focus bracket set",
            choices = {"no","yes"},
        }
    }
}


Friday, May 13, 2016

St Nonna's Church in Altarnun Cornwall

One of the advantages of having an IR converted Canon 50D is that I can make full use of Magic Lantern to capture the best data.

These three images are from the village of Altarnun (meaning: "altar of Nonn"). 


Wiki tells us that the dedication is to Saint Non or Nonna, who was the mother of St David. The church is mentioned in Daphne du Maurier's Jamaica Inn; it is the church in which the evil vicar of Altarnun depicts himself in a painting as a wolf while the members of his congregation have the heads of sheep.

The image was taken near noon and I used the following workflow to get the best out of my 10-20mm Sigma lens:
  • I set an aperture of F/3.5 for the Church and F/8 for the bridge shots (as an experiment);
  • Once I was composed I used ML's Auto ETTL to set the correct exposure: 1/500s at F/3.5 and 1/100s at F/8;
  • I moved the lens focus ring to the full macro setting and ran my auto focus stacking script, with bookends enabled;
  • Once I had ingested into Lightroom, and did some basic corrections on one of the images in a stack, I then synced the other images in the focus stack to this base image;
  • I then did a round trip to Helicon Focus and tweaked a few things in Photoshop and SilverEfex Pro.
As usual I welcome any feedback on this post.



Saturday, May 7, 2016

Christ Church, Ramsdell, Hampshire


We are very fortunate to have some lovely churches within a few miles of us, and this evening was a chance to pop along to one just up the road in Ramsdell.

Christ Church was built by John Colson in 1867, with the tower (including clock and bell) added in 1876.  

Colson was born in Southampton in 1820 and worked in Winchester from 1845 until his death there in 1895. His practice was mainly concerned with the design and restoration of churches, parish schools and parsonage houses and he is thought to have built 20 churches, and was also, for nearly 40 years, architectural surveyor to the Dean and Chapter of Winchester Cathedral. 

As usual these images are multi-bracketed exposure and focus stacks; and each explores a different look in post processing. Please let me know which one 'works for you'?



Friday, May 6, 2016

SUV? Who needs an SUV when you have a tank collection

Great weather for our 9-day fortnight Friday off, and a chance to grab some images care of a friend of a friend: who happens to have a small military vehicle collection.

For me it was a chances to try out my focus & exposure stacking scripts, as well as Magic Lantern Dual-ISO and ETTR setting.

Wednesday, May 4, 2016

Field Report on Auto Focus/Exposure Stacking

Although I was confident I'd proved out my ML Lua Auto Bracketing Script at home, tonight was my first chance to explore this new in-camera tool in the field. 

We are lucky to have a lovely church a mile from us and with the help of an App it was easy to see when the Golden Hour would occur. Of course the App doesn't provide any real time info on the weather. 

Because I knew I would be focus and exposure stacking, the dominant weather variable was wind: I needed still conditions. The other weather variable for a great sunset is the right cloud cover. Last night the wind was near zero, but the clouds dissipated towards the horizon and I had a clear sky, so the the sky would be a little featureless. 

I used my Sigma 12-24mm at 12mm and the following shooting workflow:
  • Switch on LV and select an exposure to compose by;
  • Compose the scene;
  • Move the ML Raw Spotmeter to the shadow region where I wish to see detail and set the base exposure;
  • Move the lens focus ring all the way to macro end, as I wished to grab a full focus stack;
  • Run the script.
I processed the resultant images in Lightroom HDR, processed the resultant exposure stacks in Helicon Focus via a round trip from LR, and finished off in Photoshop. Here are a couple of the test images, where I also explored different post processing looks.


Sunday, May 1, 2016

Revision 2

A short post today to simply publish the latest version of my auto focus and exposure script for Magic Lantern users.

This one is as automated as I can get it. As with previous versions, this one has little error detection so the user must be aware of certain things:
  • Check the correct DoF diffraction options are set in ML, eg diffraction aware is on 
  • Must use a lens that reports focus distance and DoF can be calculated 
  • Lens must be in AF mode 
  • Must be in manual mode 
  • Switch stabilization off as you will not be hand holding ;-) 
  • Must be in LV mode
  • ETTR settings should be no dual-ISO, S/Ns to zero, highlights very low or zero 
  • ETTR mode, eg SET or SNAP, can be left as your default as the script will protect this
  • Image review must not be set to HOLD in Canon menu 
  • Assumes lens is focused at nearest point to start, ie script moves to infinity 
  • Script takes last brackets with focus point at infinity 
  • When exposure bracketing, set base exposure to capture shadows (the script will calculate the ETTR of the scene) 
  • If ETTR fails, then try adjusting line 58 to give your camera more time (or experiment with less)
As photography should be relaxing, I personally don't mind that this script takes time to run. So, as it's running, look around you and enjoy nature and the moment :-)

Finally, I haven't had a chance to test every scenario, but I'm content it works for me. Here are a couple of test images I took to 'prove things out'. The outdoor shoot was taken in our back garden and there was a little bit of a breeze, so you will see motion in the foliage.

I processed these two (24mm) images fully in Lightroom, using the LR 32-bit HDR technology to process each exposure set of brackets, adjusted one and synced to the others, then took this processed/synced exposure set on a round trip to Helicon Focus from within LR.

As usual I welcome feedback, especially if you are having problems with the script or would like to see some changes.






--[[
Landscape auto exposure & focus bracketing script
Release 0.7
This version has little error detection so the user must be aware of certain things:
* Check the correct DoF diffraction options are set in ML, eg diffraction aware is on
* Must use a lens that reports focus distance and DoF can be calculated
* Lens must be in AF mode
* Must be in manual mode
* Switch stabalisation off as you will not be hand holding ;-)
* Must be in LV mode
* ETTR settings should be no dual, S/Ns to zero, highlights very low or zero
* Image review must not be set to HOLD in Canon menu
* Assumes lens is focused at nearest point to start, ie script moves to infinity
* Script takes last bracket with focus point at infinity
* When exposure bracketing, set base exposure to capture shadows (the script will calculate the ETTR of the scene)
* If ETTR fails, then try adjusting line 58 to give your camera more time (or experiment with less)
* Final thought: photography should be relaxing, hence I personally don't mind that this script takes time to run. As it's
* running look around you and enjoy the moment :-)
--]]

-- Declare a few variables for the script
a1 = 0
b1 = 0
a2 = 0
b2 = 0
fp = 0
inf = 100000
delay = 0
base_tv = 0
delay = 0
factor = 0
first_call = true
num_brackets = 0
ETTR_tv = 0
base_tv = 0

function check_bookend()
if keymenu.submenu["Bookends?"].value == "yes"
    then
        local tv = camera.shutter.ms
        camera.shutter.ms = 1
        camera.shoot(64, false)
        camera.shutter.ms = tv
    end
end

function take_brackets()
    if keymenu.submenu["Ev bracket delta per image"].value ~= "0"
    then
    if first_call
    then
-- Find the ETTR shutter value
    base_tv = camera.shutter.apex
    local m = menu.get("Auto ETTR","Trigger mode")
    menu.set("Auto ETTR","Trigger mode",0) -- set ETTR menu to get an ETTR exposure
    local check_tv = 0
    lv.start()
    repeat -- hang around until ETTR value has stabilised
    check_tv = camera.shutter.apex
    msleep (4000)  -- adjust this for your camera (this works on a 5D3). The time delay allows the ML ETTR to settle down
    until check_tv == camera.shutter.apex
    ETTR_tv = camera.shutter.apex
    menu.set("Auto ETTR","Trigger mode",m) -- reset to user ETTR menu setting
    num_brackets = (ETTR_tv - base_tv)/factor
    num_brackets = math.floor(math.abs(num_brackets))
    if num_brackets <= 1 then num_brackets = 1 end
    end
    camera.shutter.apex = ETTR_tv
    camera.shoot(64, false)
    for i = 1, num_brackets , 1
    do
    camera.shutter.apex = camera.shutter.apex - factor
    camera.shoot(64, false)
    end

    if camera.shutter.apex > base_tv
    then
    camera.shutter.apex = base_tv   
    camera.shoot(64, false)
    end
    else
    camera.shoot(64, false)
    end
    first_call = false
end

function albs()
-- check not an EOSM
first_call = true
menu.close()
if camera.model_short == "EOSM"
then
display.notify_box("Sorry doesn't work with the EOSM", 3000)
else
    base_tv = camera.shutter.apex  -- get exposure that is set for the shadows
    check_bookend()
--     Get DoF info, delay as requested & take first brackets
    msleep(delay)
    a2 = lens.dof_near
    b2 = lens.dof_far
    take_brackets()
-- take remaining focus brackets to infinity end
    repeat
    a1=a2
    b1=b2
        repeat
        lens.focus(-1,1)
        b2 = lens.dof_far
        a2 = lens.dof_near
        fp = lens.focus_distance
        until a2 > b1 or fp >= inf
    lens.focus(1,1)
    take_brackets()
    until fp >= inf
    check_bookend()
end
end

keymenu = menu.new
{
    parent = "Shoot",
    name = "Auto Focus Bracketing",
    help = "Remember: LV, DoF & AF on + focus at nearest point",
    depends_on = DEPENDS_ON.LIVEVIEW,
    submenu =
    {
        {
            name = "Run Script",
            help = "Does what it says after pressing SET",
            select = function(this) task.create(albs) end,
        },
        {
            name = "Delay",
            help = "Delays script start by stated number of secs",
            choices = {"2","5","0"},
            update = function(this)
            delay = tonumber(keymenu.submenu["Delay"].value)*1000 -- delay in ms
            end,
        },
        {
            name = "Bookends?",
            help = "Places a dark frame at start and end of focus bracket set",
            choices = {"no","yes"},
        },
       
        {
            name = "Ev bracket delta per image",
            help = "0 = no auto exposure bracketing",
            choices = {"0","1","2"}, -- change these values to your own choices
            update = function(this)
            factor = tonumber(keymenu.submenu["Ev bracket delta per image"].value)
            end
        }
    }
}