Focus Bracketing v1.1
AUTHOR'S NOTE: This script was written in the very earliest phases/builds of CHDK, before the get_focus and set_focus commands were available. There are much better scripts written for focus-bracketing now. Please refer to those similar and better scripts. While this script should still work as-is, it is a rather poor work-around to using the more efficient set_focus/get_focus commands in focusing scripts. I'd delete this script from the lists here, but it might be handy for a learning example or just for archival reasons.
Written for/on: Powershot S3 IS, CHDK Build 106 Changeset 159, or later, required.
- For Powershot A610: change all occurances of click "down" to click "right" and click "up"' to click "left". NOTE: Not sure if this new version with those edits will work on A-series cameras with the new "press" and "release" commands of CHDK Build 106, can someone confirm?
Also works on: (unknown at this time)
I wrote this script because the camera's built-in focus-bracketing was just WAY too limited for my needs. When doing macro-photography you are working with a minuscule DOF most times. It can take up to 20 or more new focal-planes to get all parts of a subject completely in focus. Using programs like CombineZ (excellent freeware) or Helicon Focus (nice costware) you are able to combine the "in-focus" bits from as many frames as you are able to take. Thus, the need for this more advanced focus-bracketing script. A future version may include an exposure-bracketing option for HDR macro-photos. You'd not only get an amazing DOF but also HDR (high-dynamic range) images too. However, with this script just the way it is, if you put your camera into it's own exposure-bracketing mode you can still get 3 different exposures for each shot -- just not with as much exposure latitude as a CHDK script might create for you. Keeping in mind you will get 3X's more shots for each focus-bracketing step. (CHDK is pretty amazing, no? :-) I know of no other cameras on earth that can automatically do what CHDK cameras are now capable of.)
Documentation/Help (save as a small "focus-brkt.txt" file to your /CHDK/SCRIPTS/ folder)
When starting out, make sure your subject's focus distance is not too close to infinity or the nearest focus setting of the camera. Meaning: allow some focus-space for the bracketing steps chosen so it won't bottom-out hitting a focus limit. Set your "Script shoot delay" to 0, 1, or 2 (depending how fast your camera can use this script). Set the number of bracketing steps you desire, keeping in mind that there will be twice this number of shots taken. 5 bracketing steps = 5-near + chosen-focus + 5-far, 11 shots in total. Step sizes of 2, 3, 4, 5, and even 6 work well. Much will depend on what zoom-setting you are using at the time. More zoom (longer lens FL) means more shallow DOF. And the more you zoom-in the more finer focusing steps are available for you to use. i.e. Wide-angle = few manual-focus steps available. Long-zoom (telephoto) = more manual-focus steps available.
Script Code (save as "focus-brkt.bas" to your /CHDK/SCRIPTS/ folder)
rem Author ~Keoeeit~ rem For S-Series cameras rem May work on others with edits rem See documentation @title Focus Bracketing @param a Number of +/- steps @default a 2 @param b Step size @default b 3 if a<1 then let a=2 if b<1 then let b=3 print "Preparing..." press "mf" for n=1 to a*b click "down" next n print "Shoot 1 of", a*2+1 shoot for s=1 to a*2 for n=1 to b click "up" next n print "Shoot", s+1, "of", a*2+1 shoot next s print "Finalizing..." for n=1 to a*b click "down" next n release "mf" end