CHDK/uBASIC/Scripts: yet another DOF stacker

yet another DOF stacker

 * Written for/on: Powershot A710


 * Also works on: Should work on A-series with minor modification

This script tries to make DOF stacking easy & accurate for every aperture & zoom value.

Usage is pretty straightforward: dial to M/Av, set parameters, use MF to focus to one end of the desired DOF (MF has to have focus, use +/- to change if necessary...). Run the script and set the other end. No need to estimate subject depths, guess needed steps to get gapless DOF...

Script should work ok with reasonably small focus values.

Feel free to contribute.

Script Code (save as "yaDOFs.bas" to your /SCRIPTS/ folder) @title yaDOFs @param a move DOF @default a 1 @param b by (a/b) @default b 2 @param c bigger step (up/down) @default c 5 @param j delay 1st shot (sec) @default j 5

if a<1 then let a=1 if b<1 then let b=2 if c<1 then let c=5 if j<1 then let j=5

get_av v get_zoom z get_focus f

rem since real Av can't be read by scripts(, right?), based on max Av values ...ish

if v=9 then let v=2960 if v=10 then let v=3230 if v=11 then let v=3880 if v=12 then let v=4320 if v=13 then let v=4760 if v=14 then let v=5360 if v=15 then let v=5910 if v=16 then let v=6450 if v=17 then let v=7750 if v=18 then let v=8010

rem Focal Length table, based on grand/platform/a710/main.c rem should be easy enough to edit for a6x0

if z=0 then let z=5800 if z=1 then let z=6420 if z=2 then let z=7060 if z=3 then let z=7700 if z=4 then let z=8340 if z=5 then let z=9950 if z=6 then let z=11550 if z=7 then let z=13160 if z=8 then let z=14750 if z=9 then let z=17150 if z=10 then let z=19570 if z=11 then let z=22760 if z=12 then let z=26750 if z=13 then let z=30750 if z=14 then let z=34800

rem HYP calculation based on grand/core/gui_osd.c

h=z*z/5/v

print "-set M/Av and MF" print "-use down/left or" print " up/right to change focus"

wait_click cls print "-set/shoot_half continues"

is_key k "left" if k=1 then goto "focus_in" is_key k "down" if k=1 then goto "focus_in_more" is_key k "right" if k=1 then goto "focus_out" is_key k "up" if k=1 then goto "focus_out_more"


 * loop_zoom

wait_click is_key k "left" if k=1 then goto "focus_in" is_key k "down" if k=1 then goto "focus_in_more" is_key k "right" if k=1 then goto "focus_out" is_key k "up" if k=1 then goto "focus_out_more" is_key k "shoot_half" if k=1 then goto "theotherside_set" is_key k "set" if k=1 then goto "theotherside_set" goto "loop_zoom"


 * focus_in

click "left" goto "loop_zoom"
 * focus_in_more

for i=1 to c		click "left" next i	goto "loop_zoom"
 * focus_out

click "right" goto "loop_zoom"
 * focus_out_more

for i=1 to c		click "right" next i	goto "loop_zoom"


 * theotherside_set

cls for t=0 to j-1 print "waiting", (j-t) "sec" sleep 930 next t cls get_focus g if f=g then goto "shoot_last" rem dof=r2-r1 d=((h*f)/(h-f)-(h*f)/(h+f)) shoot e=d*a/b if e<1 then e=1 t=(f+e) :loop_focus set_focus t		get_focus f		if t=f then goto "loop_shoot" t=t+1 goto "loop_focus"


 * shoot_last

set_focus g	shoot

end

Script should work on A6x0 with the Focal Length table replaced with:

if z=0 then let z=7300 if z=1 then let z=8460 if z=2 then let z=9565 if z=3 then let z=10835 if z=4 then let z=12565 if z=5 then let z=14926 if z=6 then let z=17342 if z=7 then let z=21709 if z=8 then let z=29200

--Jucifer