additional article by the author : Focus Bracketing Scripts for Macro Setting and for Closeup Lenses
Some Technical Aspects of Stacking Macro with Canon SX-Series Cameras[edit | edit source]
Hossam Saad ElDin Abd Alhalim Farg, in a thread posted June 10/13, http://www.dpreview.com/forums/thread/3501101#forum-post-51615525 stacked some superb macro images of a wristwatch, using the 3-shot focus bracketing of the SX50 and stacking them with Zerene Stacker software. In that thread, I posted an example with 38 stacked shots (subject approximately 10 cm deep), where I adjusted the focus manually between each shot. Besides being tedious and time consuming, it is not possible to control the focus distance as precisely as is necessary for a subject close to the lens.
Why stack macro when it is possible to get quite wonderful results with single shots? In another thread posted by Hossam: http://www.dpreview.com/forums/post/51618458 , I estimated that my SX30 has a DOF of approximately 3mm at f/2.7 and about 13 mm at f/8.0. Since then, I have done more experimenting and found that maximum sharpness is only slightly larger than 1 mm at f/2.7 and less than 10 mm at f/8.0 (within a few centimetres from the lens). Sometimes you want more total depth-of-field than that.
In that thread, Hossam had begun using a focus-bracketing script in CHDK to automatically bracket a series of shots of a wrist-watch. The result was spectacular sharpness using his SX50 over approximately 20 mm by using 0.3 mm focusing steps. So Hossam has rapidly become the teacher and I am his student, trying to learn how to do what he does. Neither Hossam nor I was able to get CHDK's focus-bracketing script to work, but Hossam found two other scripts to add to the CHDK "Scripts" folder:
Focus-Bracketing Script "brack.bas"[edit | edit source]
I could not get either of these scripts to work with my SX30. Eventually, I got them to run by accidentally saving the files as Unicode (UTF-8) rather than the specified Unicode (UTF-16) format. The scripts ran but I could not get them to produce usable results. Today, I modified the first script, written by Bubendorf, and added the "shoot infinity" option of the second script by arne182. The resulting script, which works well with my SX30, is provided in the appendix below.
Using the Script "brack.bas" at f/2.7 (SX30 & SX40) [f/3.5 for the SX50][edit | edit source]
Activating the DOF calculator in CHDK, gives you the subject distance (S.D.) in metres to 3 decimal places, as well as other parameters. So this allows you to manually set the initial manual focus value with a precision of 1 mm. By then using the script brak.bas, setting a=5 & b=0 (for 50 steps) and c =1 (for a 1 mm step size), I generated 50 shots along a millimetre ruler, focused 1 mm apart. By examining the shots, I found that the end of the lens-barrel corresponds to a focus setting of S.D. = 0.008 (8mm). (If you want to stack images right up to touching the lens, this corresponds to approximately S.D. = 0.004 (4 mm).
By examining which parts of the millimetre ruler were in focus and comparing this to the S.D. number of each shot, the distance of the focus-point to the end of the lens-barrel, in millimetres, is given by:
Dist = 1.04 x (1,000 x S.D.) - 8.36 (1a)
For most purposes, it is satisfactory to use the approximation:
Dist ~ (1,000 x S.D.) - 8 (1b)
For the Canon SX30, a step size of 1 mm at f/2.7 was adequate to give the stacked image maximum sharpness over the whole range of focus. For the SX50 at f/3.5, I estimate that a 2 mm step size would be adequate.
Using the script "brack.bas" at f/8.0[edit | edit source]
Specifying a=1 & b=5 (for 15 steps) and c=10 (step-size 10 mm) and d=1 (include a shot with infinite focus), another series of shots was made at f/8.0. The 10-mm step-size was not enough to cover the whole range at maximum sharpness, so next time I will use a step-size of 5 mm at f/8.0. Another problem with this series of shots was that the the stacked image for approximately the first 30 mm was of poorer quality (less sharp) than sharp areas of the individual images. It may be that the stacker software has difficulties with high f-number (small aperture) close to the lens. Another possibility is that I may have done something wrong.
The 15-cm shot at the far end of the focus range captured a fair amount of detail at the edge of the room about 2 m (6.6 ft) away. The optional "infinite-focus" shot was sharper but not dramatically so. As the author of the subroutine, arne182 suggests, this option could be useful for backgrounds.
Summary[edit | edit source]
- cites some others that demonstrate what can be achieved by focus-stacking macro shots.
- provides a focus-stacking script that some may find useful.
- Calibrates distance from the lens-barrel in terms of the camera's (and CHDK's) subject distance (S.D.) for the 4.3 mm macro focal length of the SX30, 40 & 50.
- I don't know the exact definition of depth-of-field (DOF). (I couldn't find a precise definition in terms of transfer functions.) But it was a surprise to me that the depth of maximum sharpness for macro is as shallow as it is, both at f/2.7 and f/8.0. This may be helpful as an indication of what step-size to use for focus-bracketing.
Focus-Bracketing Script "brack.bas"[edit | edit source]
rem Author Barrett (Modifying Bubendorf and adding Infinity Subroutine from arne182) @title Brack @param a Tens of steps @default a 0 @param b Plus unit steps @default b 1 rem s is number of steps rem Number of shots is s + 1 rem e.g. for 53 steps, a=5 & b=3 1 initial shot + 53 steps = 54 shots rem + optional infinity shot = 55 shots s=10*a+b @param c Step size ±mm @default c 1 @param d Infinity included, yes = 1 @default d 0 sleep 500 get_focus f for i=0 to s g=f+i*c print "Step", i, "(", g, ")" set_focus g shoot next i if d=1 then gosub "infinity" end :infinity g = 65530 print "Shoot infinity", "(", g, ")" set_focus g sleep 100 shoot return