Flatbed scanner eliminates the perils of macro photography

IMG_7728

If you have ever played around with macro photography, you’ll know how hard it is to get a focused image of something that isn’t two-dimensional. For virtually every 3D object, you’ll have to deal with the depth of field – the small region where things are actually in focus. [David] came up with a neat homebrew solution for making sure everything in his macro photos is in focus using a discarded flatbed scanner and a Raspberry Pi.

[David]‘s technique relies on focus stacking. Basically, [David] takes dozens of images of the same object, moving the camera closer by a fraction of an inch before snapping each frame. These pictures are stitched together with CombineZ, a piece of software used for extending the depth of field in images.

The hardware part of the build is a Raspberry Pi hooked up to a stepper motor driver and the shutter button of [David]‘s camera. By attaching his camera to the carriage of a flatbed scanner, [David] can inch his camera ever closer to his object of study while grabbing the images for CombineZ.

The results are impressive, and would be nearly impossible to replicate any other way without tens of thousands of dollars in camera equipment.

Comments

  1. northstreetlabs says:

    Could something like this be done with video, in real time? like for use under a digital microscope?

    • freax says:

      Focus stacking might work in “real-time” for slowly-moving objects if you used a high-fps camera on a vibrating mount… Or combined multiple cameras with clever optics.
      Or, depending on what you consider real-time, you could use a video camera, move it back and forth and stack always the last n images. Then it is just a question of computational power. Probably not on a Raspberry Pi ;)

  2. Sprite_tm says:

    If you have a Canon DSLR that’s supported, you can do this using Magic Lantern. Look for ‘focus stacking’. It even drops a small shell script to automatically combine the stack of images into one.

  3. Oleg Mazurov says:

    This is much easier way to do focus stacking

  4. mazurov1965 says:
  5. You can get impressive depth of field in macro with an extension tube (which can be built, or bought for a few dozen dollars), a very small aperture and a long exposure.

    • fartface says:

      Exactly. Macro Photography done with the right gear does not need tricks like this.

    • Quin says:

      small apertures require lots of light (strobes) or long exposures. I personally prefer strobes, because then the background ends up with even less detail.

      But tens of thousands of equipment? come on, HAD, a tilt-shift bellows costs about $400 depending on your (d)SLR model. An older model Lensbaby and some $20 aluminium extension tubes cost less, and both will let you get the selective focus without stacking.

      I’m not against focus stacking, btw. Sometimes, you have the lens so far out of alignment with the film plain that even at f22 you can only get a little bit in focus at a time. But it’s not needed in most cases. Focus stacking is for objects magnified, things that are smaller than your image sensor that you’ve made appear a lot bigger; not objects larger than the film sensor.

    • Darren says:

      With the total extension of about 6 inches I can get out of the bellows I made for my camera… the smallest aperture available results in an effective depth of field of less than a millimeter (assuming I can get enough light).

      A rig like this would let me produce photos of tiny things that are optically impossible for me to capture now.

      • Darren says:

        eh… I exaggerated that a bit… still, the focus stacking rig is one of my planned future projects as it allows me to produce photos with a greater depth of field than is optically possible.

  6. Json says:

    I use the small aperture and long exposer, good lighting, non issue

  7. mathias says:

    maybe he should just alternate the focus rather than moving the camera…cause if you move the camera your angle of view changes.

    • freax says:

      actually, this is the “better” way to do that, because changing the focus also changes the focal length, and the effects of that are worse.

      • Quin says:

        That’s what prime lenses are for: no change in focal length as you change the focus. Or use adjustable bellows to move the focus, at 3 inches of extension the change in fcoal length over 1 inch of focus is pretty minimal with the right lenses.

  8. macona says:

    10’s of thousands of dollars? I have one of the most expensive macro lenses made and they are “only” $1900 new.

    Like other have said, you can do the same thing that he has done with a dSLR with a extension and a small aperture with a lot of light or long exposure. And many Point and Shoots have very good macro modes too.

    Now, I am going to use this post as an excuse to link to some of my macro photos!

    http://www.flickr.com/photos/67292116@N00/sets/72157627041373036/

  9. sethasaurus says:

    Ridiculous!
    Herd of photography?

  10. ryan says:

    1) moving the camera is the correct way vs “zoom”ing or focusing.

    2) this is better than stopping down to f/32 or whatever, because, regardless of your fancy lens, extension tubes, etc. diffraction starts tossing your megapixels out the window above ~f/5.6.

    • Tyler says:

      False. Lenses are typically happiest around f/4-f/6. The “diffraction issues” threshold depends on the size of the lens, the sensor size, and a few other factors..and is usually much higher, at least f/16.

  11. ryan says:

    Not at the sensor densities today. f/16 maybe for a FF 6mp or film.

  12. Truth says:

    I was about to ask “Is there any UNIX equivalent to the windows CombineZ software ?”
    When I found the answer to my own question, which may be of interest others:

    http://en.wikipedia.org/wiki/Focus_stacking#Software

  13. Mark Burban says:

    while this is totally impressive, it can be done with nothing more than a $15 “Macro Focusing Rail Slider” & a bit of time NOT “nearly impossible to replicate any other way without tens of thousands of dollars in camera equipment.”

  14. Barry Kidd says:

    Although I will use focus stacking from time to time in my case it’s usually no more than four or five images. I also realize that each of us do what we need to do to achieve the results we want the stacking 40+ images seems a bit excessive. I’m certain however that there are things that I do that people would find excessive so it’s acceptable.

    As an evidence photographer perhaps 70 or 80% of my work is macro photography. Because of this I can only guess that I’m accustomed to the shallow depth of field and accept it as part of what I do.

    • Ren says:

      So, have any defense lawyers tried to throw out any of your stacked photos as evidence because they’ve been “altered” by focus stacking? Have you been called in as an “expert witness” to defend photographic evidence?
      Do you work with cute babes like the stars in those TV programs do? B^)
      CSI/NCIS fans want to know!

      • Barry Kidd says:

        Oh god no. Evidence photos may only have minimal alterations. Nothing more than color correction (basically a white balance adjustment and basic sharpening. That happy stacking is just for me and my own photos every once in a blue moon.

        Never once I have I been called to testify about any of my photos but it’s not out of teh question that it will happen one day.

        And no, It’s most certainly not like TV. I always tell people, it’s not glamorous and we NEVER get the girl at the end of the show. LOL More photos of broken door jams than anything else.

  15. Kris Lee says:

    You could actually use the flatbed scanner itself for quite decent results of mostly 2 dimensional objects like PCB’s. I think even that some of the scanners allow you to modify the focus of the scanner.

  16. Bobikas says:

    You can also use CHDK hack for canon point and shoots. It has focus bracketing.

  17. j s says:

    Keyence’s video microscopes use a similar technique for enhancing depth of field.

  18. bitxdeadweight says:

    Surprised that no one pointed out that Lytro can do the same thing. The build is still cool, I just question the “tens of thousands of dollars” statement.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 94,598 other followers