"DoF Stacking" using CHDK Focus Bracketing & CombineZM[]

"Bracketing " is the taking of a series of shots with an incremental, usually subtle change in a variable between each one. Bracketing can be done with changes in shutter speed, ISO, aperture value, focus, etc, and though a bit challenging, several variables can be bracketed in combination, as well. Usually bracketing is done in order to cover a range of the variable values in an effort to capture the best of several shots. In such cases, bracketing can be done hand held, "on the fly" so to speak, and is most likely done in "continuous shooting" mode. More probably, the photos are viewed after download side by side as thumbnails (or further scrutinized in a browser), the "pick(s) of the litter" is kept, and the rest are discarded.
Focus Bracketing is the taking of a series of photographs where the point of focus is moved incrementally between each shot. This is usually applied to macro applications where depth of field is notoriously shallow. But there's something much more fun we can do with a handful of focus bracketed shots!
"DoF Stacking" (Depth of Field Stacking) is where we combine a selection of focus bracketed photos in a similar manner to the way that three or more images are combined to make single HDR photos. Presumably, the term "stacking" most likely comes from the physical stacking of different negatives to obtain a desired effect of a photo during processing in a darkroom. (-Anybody remember those?) The resulting image from DoF stacking can have usually paradoxic qualities; the superb detail of a macro shot with the depth of field of a landscape shot. CHDK makes it possible, and a program called CombineZM makes it easy!
To appreciate what a DoF stacked image is, compare a photo you have taken at infinity with your favorite macro shot. Notice the tremendous range of distance of objects that are in focus in the photo taken at distance as compared to the extremely short focus range in the macro shot. We will create a macro shot where everything is in focus.
We need:
A camera running CHDK
A tripod
A computer running Windows with CombineZM installed on it
First download CombineZM. CombineZM will take our photos of differing focus points and merge them all into one single digital image that illustrates a depth of field far beyond the capability of most P&S (point and shoot digital) cameras, and in some cases, beyond the capabilities of any known lens configuration. It is free and easy to use, and although it offers great customization, it will produce a stunning result straight from it's initial download. (It's also great for superimposing two or more completely different images for some very interesting results.)
There are a few other freebies out there, but CombineZM is referred to quite a bit throughout the CHDK wiki and forum, so you're more likely to get help with this program than the others out there. It's also still constantly being upgraded by its author(s), which is always a good thing.
Next thing we need to do is pick out a subject and set up a tripod. Choose something static for now. Let's take as close-up of a macro as we can get and we'll take about a dozen shots the first time to get a feel for how the camera behaves. With very little experience you'll quickly find that you can get a wonderful result with only a few shots. Ready the camera, and load up CHDK. Turn off all other priorities you may have enabled in CHDK so that we are only utilizing the DOF bracketing.
In the CHDK ALT menu, go in to
  • Extra Photo Operations, scroll down to
  • Bracketing in continuous mode, making certain all other functions are set to "off" along the way. In that menu, navigate down to
  • Subj. Dist. Bracket Val.
Next to this you'll see this:
  • [ 0].
This is your "distance", and it can be changed by increments of "1". The next menu item below that is the "multiplier", and that can be changed by exponential factors of "ten". In this manner, very long distances of many meters can be set. It says:
  • Value factor (mm)[ Off]. Assuming you are photographing something very close, a good bet for now would be to set the focus change to move 3 millimeters in between shots. To do this, we will set the
  • Subj. Dist. Bracket Val. to 3, and the
  • Value factor (mm) to 1. This will make the focus increment 3mm. Navigate down to
  • Bracketing type, and set that to [ + ]. This will ensure that the focus gets moved outward 3mm for each shot. Navigate down to
  • Back, and then up to the top of the previous menu,
  • Extra Photo Operations. Be certain that the option
  • Disable Overrides is ON (see the note below)
Exit the CHDK ALT menu, and set your camera using the built-in Canon functions for
  • Macro Manual mode
  • shoot continuously.
  • your ISO preferences.
  • your shutter speed preferences.
Now with your tripod/subject in place, focus (usually half shoot) in on the subject at the closest point, or even on something just in front of it, and lock your focus. (Remember, each shot will focus 3mm farther away from the last, so we want to ensure we don't miss the closer focus.) Set or lock your EV (light metering) to ensure as much continuity as possible.
Now reenter the CHDK ALT mode and enter the menu. In
  • Extra photo operations, be sure that
  • Disable Overrides is OFF.
Exit the CHDK ALT mode, and you should be all set to shoot.
NOTE : The reason we had to disable the CHDK overrides before setting the focus lock is because in some instances (at least with my TX-1) I have had the camera shut down because at half-shutter button, my camera tries to auto focus and I have no manual focus on my model. I suspect it's receiving two commands to the same bit of hardware and doesn't like it. So the overrides need to be disabled first, at least for me. I believe the automated shutdown of the camera is a safety feature that does not harm the camera. As such, once you are familiar with the set-up for focus bracketing, I suggest you try omitting the override disabling step to see if you can shorten setup time for yourself.
Please keep in mind that these are generic instructions. Most Canon P&S cameras have the same focus and Ev locking methods, as far as I know, but if you are having difficulty with that part, please consult your owner's manual before asking on the forum.
Please find the DOF Stacking thread, located HERE, and post any questions you have to that thread to make searching easier for everyone.
Fire away!
Depending on your subject size, you should take between 2 and 3 dozen shots. Better more than less because I can't definitively say that when CHDK tells my TX-1 to focus 3mm out before the next shot, it really actually is 3mm, nor can I guarantee that the fifth shot it takes has focused out the same distance as the second. Even if I could, who is to say that there are not disparities from one Canon model to the next with this regard, or even from one camera to the next of the same model?
Next is that after you download the images you'll immediately see images that need to be discarded because the subject is out of focus. You'll also most likely become selective in which images you actually choose to compile in CombineZM.
So snap away, and get a feel for how your own camera reacts to CHDK's focus commands by comparing thumbnails. My personal approach to this is to snap a few dozen and eliminate what I won't use. For example, I once shot over 75 shots of a subject. I didn't know at the time that it wasn't necessary, as I was still unfamiliar with my own camera's reaction to CHDK's focus commands. After downloading the images, I discarded everything before and beyond the focus range of the subject. I was left with about 36 images, still too many to use. (I had found out the hard way earlier that stuffing 3 dozen images into CombineZM takes a LONG time for it to compile, and yields poor results!) So starting with the first one, I simply kept every third image, and discarded the rest. I ended up with a dozen equally spaced images that yielded a great result. As it turns out, I could have even used less of them.
So take a lot of images, but select only what you think you'll need for CombineZM to cover the focus range. Soon you will know what to set the bracketing distance to in CHDK to nail something animated with only a few shots in a quick burst, such as an insect that graciously stays still for a few seconds.
Now the EASY part!
After downloading your images, open CombineZM. In the tool bar at the top click File, and then click New. A small window will open that says, Combine ZM Progress..." on the top. In Windows OS*, it will also prompt the automated File Open Microsoft window. Navigate to the folder containing the photos, select all of them and click the "Open" button. The program will load all of the files one by one and list them in the progress window. A composite image will show in the main window when it has finished loading. It is now ready to task.
At the top tool bar of the CombineZM main window, click Macro, and click Do Stack. The progress window will become prominent again, and will show you the, uhmmm... progress. :-)
Be sure to save the resultant image by going to File at the top of the window and clicking Save Frame/Picture As.
*I am only familiar with the Windows OS. However if you are running Mac, upon entering the download site for CombineZM, you will happily find that the good folks there have a Mac version just for you! (Intel) Also, they do offer help pages for any complications.
The following series of photos is an example of what can be done by DoF Stacking.
The subject of my macro stack is a bouquet of roses...

IMG 8461 (Medium)

I got down low to the ground with the tripod very close to the flowers, shooting to include the infinitive landscape. Here are the first, middle, and last shots of the dozen or so that I actually put in CombineZM:

IMG 8602 (Medium)

IMG 8650 (Medium)

IMG 8701 (Medium)

This is my result...

Combined (Medium)

Notice the abnormalities and blotching around the edges of some of the rose pedals. I call this "digital aberration" for lack of a better phrase, and I think that by optimizing the many options in CombineZM, much of that can be avoided. There are so many different variables that can be causing them, but too many photos used in the stack is certainly one of the biggest. I suspect inconsistency in settings or even in CCD data can also contribute. I also often have to crop roughly 8% total of the edge of the finished image, as I did with this one. There is a strange mirror-imaging that takes place framing the photo, but as you can see, once cropped, it does still show the subject in its entirety. The only other problem is the limitation of the camera glass. Vignetting at "super" macro for example, as expected, can cause the stacked image to have fuzzy or even blotchy corners. As with any other shortcomings in camera equipment or processing limitations, so long as these things are taken into consideration while composing a stack, you should have very satisfactory results.
The resulting DoF Stacked images are often considered by many critics to be lacking in artistic character, as limited depth of field is said to add warmth to composed shots. But with virtually no manipulation other than the simple strategic omission of a few focused images in a series, DoF Stacking offers complete control over the use of focus, artistic or otherwise.
It's my opinion that DoF Stacking (as I'm quite smitten with the whole concept) offers a photographic perspective that is instantly recognizable as highly unusual, and for most people (non-photographers) that I show stacked images to for the first time, they are uncertain why the image seems to be so striking to them.

Remember, if you're having difficulty with this, please post in THIS thread, and you can even PM me on the forum to ensure that I see it and respond. If I have missed something or given incorrect information, or you can add something of value, please do so. There is still much to be added to this page, as CombineZM is just one of several stacking softwares, and I have not even begun to explore its options in any appreciable manner.