This script provides a complete HDR / Exposure Bracketing environment. It combines various aspects of many existing HDR scripts and will work on any CHDK equiped camera. It has no embeded keyboard presses or fixed parameter set variables that would make it specific to a particular camera.
Script Description
The script allows the user to vary one of the three camera exposure parameters (Tv, Av, Sv) while holding the other two fixed. This results in several shots at different exposure settings, suitable for creating HDR images in your computer.
Note : as many Canon P&S cameras do not have adjustable aperature.
Script Operation
The UltraHDR script has five parameters that can be set. These are :
- HDR mode - choose better shutter (Tv), Iris (Ev), or ISO (Sv).
- Exposure Steps - this determines the number of photos taken at different exposures.
- 1/2 f-stops per step - the exposure adjustment made between shots
- Eposure offset - allow you to shift the exposure of all shots up or down by a fixed amount.
- Raw - override current RAW setting (restored on script exit)
Lua Script - UltraHDR.lua
--[[
@title Ultra HDR
@param m HDR Exposure Mode
@default m 0
@values m Shutter Iris ISO
@param n Exposure Steps
@default n 3
@range n 2 8
@param a 1/2 f-stops per Step
@default a 2
@range a 1 10
@param e Exposure Offset (stops)
@default e 0
@range e -4 4
@param r Raw & DNG
@default r
@values r Ignore Disable Enable
--]]
-- release AF lock & restore RAW state on exit
function restore()
if ( r>0 ) then set_raw(rawmode) end
set_aflock(0)
end
--setup
set_console_layout(1, 0, 45, 12)
rawmode=get_raw()
if( r>0 ) then set_raw(r-1) end
print("Ultra HDR started...")
-- switch to shooting mode
if ( get_mode() == false ) then
sleep(1000)
set_record(1)
while ( get_mode() == false) do
sleep(100)
end
end
sleep(100)
-- focus and take exposure
press("shoot_half")
repeat
sleep(50)
until get_shooting() == true
release("shoot_half")
repeat
sleep(50)
until get_shooting() == false
set_aflock(1)
av=get_av96()
sv=get_sv96()
tv=get_tv96()
-- configure the shots
print( "start","tv=", tv, "av=", av, "sv=", sv )
s=a*48
tv_inc=0
av_inc=0
sv_inc=0
if(m==0) then
tv=tv-n*s/2+e*96
tv_inc=s
elseif ( m==1 ) then
av=av-n*s/2+e*96
av_inc=s
elseif ( m == 2 ) then
sv=sv-n*s/2+e*96
sv_inc=s
end
--shoot
for i=1, n, 1 do
print(i, "tv=", tv, "av=", av, "sv=", sv )
set_tv96_direct(tv)
set_av96_direct(av)
set_sv96(sv)
shoot()
tv = tv + tv_inc
av = av + av_inc
sv = sv + sv_inc
end
restore()
print("...done")