HDR Fast Shooter
Talk0this wiki
A Lua script to implement rapid HDR shooting.
Edit
There are many HDR (or exposure stacking) scripts on the CHDK wiki and forum. However, many of them are camera specific as they use script driven key presses or set property case values that depend on the OS release of the camera.
Listed below is an HDR script that is camera model independent. It measures what the camera thinks is the correct current exposure and then makes a user specified number of exposures at faster and slower shutter speeds than what the camera specified. Using HDR stacking software on the PC, it will be possible to use some (or all) of these images to create a final high dynamic range image.
The script will take each picture as quickly as the camera will allow. The focus is locked in at the start using a "half press" and the script fires each successive exposure as soon as the camera is ready. Note that you probably want to disable the camera's flash - the actual exposure when the flash fires will ruin the HDR effect.
This script should work on every CHDK equipped camera - contains no camera specific key presses or property case settings. Remember to save with the .lua file name extension ( e.g.fastHDR.lua ).
--[[ @title HDR Fast Shooter @param n Number of Steps @default n 5 @param s tV step size @default s 96 --]] -- release AF lock on exit function restore() set_aflock(0) end -- setup set_console_layout(10, 0, 40, 14) props=require("propcase") propset=get_propset() pTV=props.TV if( propset > 3) then pTV2=props.TV2 end print("Started...") -- make sure we are in shooting mode if ( get_mode() == false ) then sleep(1000) set_record(1) while ( get_mode() == false) do sleep(100) end sleep(1000) end -- timestamp the start z = get_day_seconds() -- focus and get exposure press("shoot_half") repeat sleep(50) until get_shooting() == true set_aflock(1) tv96val=get_tv96()-(n*(s/2)) -- take the shots as fast as possible for i=1, n, 1 do print("step=", i, "tv96=", tv96val) ecnt=get_exp_count() set_prop(pTV,tv96val) if( propset > 3) then set_prop(pTV2,tv96val) end press("shoot_full_only") repeat sleep(20) until(get_exp_count()~=ecnt) release("shoot_full_only") tv96val = tv96val+s end -- all done so cleanup z = get_day_seconds() -z print("...done in", z, "seconds") restore()
Original Version
Edit
- runs 50% slower than the version shown above as it uses a slower but possibly more reliable method to determine when each shot is complete and the next one can be starteed
--[[ @title HDR Medium Fast Shooter @param n Number of Steps @default n 5 @param s tV step size @default s 96 --]] function fastshoot(a1,s1,t1) set_av96(a1) set_sv96(s1) set_tv96_direct(t1) press("shoot_full_only") repeat sleep(50) until get_shooting() == true release("shoot_full_only") repeat sleep(50) until get_shooting() == false end set_console_layout(10, 0, 40, 14) print("Started...") if ( get_mode() == false ) then sleep(1000) set_record(1) while ( get_mode() == false) do sleep(100) end end sleep(1000) 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() print( "av96=", av, "sv96=", sv, "tv95=", tv ) tv96val=tv-n*s/2 for i=1, n, 1 do print("step=", i, "tv96=", tv96val) fastshoot(av,sv,tv96val) tv96val = tv96val+s end set_aflock(0) print("...done")