CHDK Wiki
Line 85: Line 85:
 
[[Category:Scripts A590]]
 
[[Category:Scripts A590]]
 
[[Category:Scripts A560]]
 
[[Category:Scripts A560]]
[[Category:SD600]]
+
[[Category:Scripts SD600]]

Revision as of 13:32, 2 June 2010

Focus Bracketing

Written for/on: Canon A640
Also works on: Theoretically all Other Canon AXXX (Not all tested),
Tested and working on: PowerShot S3, PowerShot A590IS, Powershot A560, SD600/Ixus 60
Doesn't work on: Ixus 850 IS (crashes camera)

Focus Bracketing by Johan Van Barel (http://www.vanbarel.com)

The Canon A640 has an impressive macro mode. "Disadvantage" can be the very limited DOF (Depth Of Field). The purpose of this script is to take a set of images at different focus settings around the current focus.

So if you take 3 pictures, it will take the first picture at a focus smaller then the current one, the second at the current focus, and the third at a focus bigger then the current one. The steps are calculated so that they are not linear and thus more natural. You can later stitch the images together with an image stacking program like CombineZM (http://www.hadleyweb.pwp.blueyonder.co.uk/CZM/combinezm.htm)


Documentation/Help (save as a small FocusBracket.txt" file to your /CHDK/SCRIPTS/ folder)


Select P, Tv, Av, M or C mode on your Canon A640.

Set the focus to manual focus and focus your image.

Parameters:

  • Number of Pics (Odd) (Default=5)
  • Focus Step Size (x6) (Default=1)
  • Initial Delay (Sec) (Default=1)

Script Code (save as "FocusBracket.bas" to your /CHDK/SCRIPTS/ folder)

rem Johan Van Barel 23-07-2007
rem Focus-Bracketing for Canon A640

@title Focus Bracket (Set Focus Manual)
@param a Number of Pics (Odd)
@default a 5
@param b Focus Step Size (x6)
@default b 1
@param c Initial Delay (Sec)
@default c 1

a=a/2
if a<1 then let a=1
if b<1 then let b=1
if c<0 then let c=0

print "Pics:"; a*2+1 , "Step:"; b

sleep c*1000

get_focus f

for s=-a to a
    g=f
    if s<0 then gosub "negative"
    if s>0 then gosub "positive"
    print "Pic", s+a+1, "Focus", g; "mm"
    if g<62 then let g=62
    if g>65535 then let g=65535
    set_focus g
    shoot
next s
set_focus f

end

:negative
    for i=s to -1
        g=6*g/(b+6)
    next i
return

:positive
    for i=1 to s
        g=g*b/6+g
    next i
return