Impossibly Huge Depth of Focus in Microscope Photographs

Sometimes, less is more. Sometimes, more is more. There is a type of person who believes that if enough photos of the same subject are taken, one of them will shine above the rest as a gleaming example of what is possible with a phone camera and a steady hand. Other people know how to frame a picture before hitting the shutter button. In some cases, the best method may be snapping a handful of photos to get one good one, not by chance, but by design.

[The Thought Emporium]’s video, also below the break, is about getting crisp pictures from a DSLR camera and a microscope using focus stacking, sometimes called image stacking. The premise is to take a series of photos that each have a different part of the subject in focus. In a microscope, this range will be microscopic but in a park, that could be several meters. When the images are combined, he uses Adobe products, the areas in focus are saved while the out-of-focus areas are discarded and the result is a single photo with an impossible depth of focus. We can’t help but remember those light-field cameras which didn’t rely on moving lenses to focus but took many photos, each at a different focal range.

[The Thought Emporium] has shown us his photography passion before, as well as his affinity for taking the cells out of plants and unusual cuts from the butcher and even taking a noble stab at beating lactose intolerance.

14 thoughts on “Impossibly Huge Depth of Focus in Microscope Photographs

  1. Does anybody know of any halfway decent open source focus stacking projects that are actually scriptable and, well, actually work fairly well as a mostly automated solution for both static focus stacking capture and post processing? The only two open source solutions I have come across sort of worked but both were very hacked together and not polished at all or barely worked and had not been updated in ages. Not sure the Adobe solution is even that good to be honest either though in theory it can be scripted to do batch work?

    There’s a few other closed source projects as well, such as Helicon but none seem to actually be polished, easy to use and scriptable such that you can automatically integrate it with a decent enough DSLR that can actually handle automatically moving the focal point for the entire static image you are trying to capture and don’t crash. I have only fooled around with focus stacking fairly briefly and am by no means an expert here though by any means.

    1. Helicon is supposed to be one of the best in the field. the problems is that usually not two objects are alike and there are multiple algorithms/settings to do the stacking some work better than others and some work better only in special cases.
      my personal experience with image stacking is that often even specialized commercial offerings can suck and the more general algorithm like Photoshop although not perfect work quite well. producing excellent to perfect stack is hard work and i don’t believe it can be completely automated ( i assume that’s what you want?).
      working with microscopic sample usually makes matters worse because you need image stacking and stitching and I’m not aware of any program that can do both simultaneously (PTgui and Autopano pro work very nicely for stitching microscopic images).
      in many academic and industrial applications images with huge DOF is a hot topic. so much so that most big name manufacturer like Leica and Keyence offer digital microscopes that have this function built in hardware multi mm DOF are doable easily with such systems.

      are you referring to images done on conventional lenses or on microscopes?

    1. CombineZP’s last stable release was June 6, 2010; 7+ years ago.
      It’s not being actively developed. It sort of sometimes works but is pretty limited and not really scriptable.

      Zerene Stacker at least has batch options but they are very difficult to easily script and I wasn’t very impressed overall with it either.

      Does Helicon have any kind of actual robust scripting ability yet to process batches of different focus stacked images? It has been a few years since I toyed around with it and it was not script friendly at all back then. Perhaps that has changed in the last year or two?

      From the Helicon developer back in 2016: “We might add an advanced batch processing command line support later, but for now you can write a script to iterate over a set of folders and invoke Focus for each of them one by one.”

      You can also sort of hack something together with Helicon’s command line mode but it’s really not robust at all. http://www.heliconsoft.com/focus/help/english/HeliconFocus.html#HF_COM_LINE

      The dcraw, Hugin, and ImageMagick script you posted seems promising. Those are all scriptable by design. Not sure how well it works though but might play around with it a bit and see.

  2. It’s an embedded fonction in all high end Olympus OMD,s, you can have the pictures stacked in the camera, or edit them in the Olympus software, so maybe the Olympus software can deal pictures taken with another brand ?

  3. “We can’t help but remember those light-field cameras which didn’t rely on moving lenses to focus but took many photos, each at a different focal range.” — that’s not light field. You’re thinking of Light’s 16-lens camera, the L16. A light field camera (e.g., Lytro Illum) takes only one picture. But it has a screen over the sensor that passes a small fraction of the light (say 1/25) to the sensor, but with the benefit that many pixels in the sensor will receive light from each opening in the screen (say 25 pixels per 1 opening), allowing processing algorithms to sort out the direction of the light and from that synthetically recreate various focal lengths.

  4. Photoshop shouldn’t get “confused” if the focus stacking thing were coded properly. What defines an in focus region of an image? High frequency information. If you were to split multiple images into high and low frequency bands and then combine the images in this domain using the right math to preserve maximum differences (as opposed to a simply averaging these layers which would tend to average out the difference between pixels) then you could recombine the resulting frequency layers to get a final image with detail preserved in all regions. Perform a high pass filter in Photoshop on an image with in focus regions and out of focus regions and you will see the out of focus regions are mostly gray, while the in-focus regions have detail. Conversely, a gaussian filter is like subtracting the high frequency information from the image, and if you were to blur an image and invert it and then reapply it to itself you would be left with the higher frequency data. I use this method to smooth out my lighting sometimes cause the uneven lighting is low frequency information.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s