I work in a marijuana testing lab in Washington. Part of our workflow is to capture an image of each sample as it is weighed, for later reference/analysis. We're pretty excited to be creating high quality standardized scientific images tied to a wealth of data, and hope to pass on this value to the public through some creative applications.

The trouble is I'm having difficulty getting sharp enough images with sufficient depth of field (about 2" for most samples) with our Nikon D5000 + Nikkor Micro 40mm lens. We had been using the kit Nikkor lens, but it simply was not sharp enough. We're using Digicam Controller to tether the camera to our lab's web application. To minimize workload, the camera needs to be on autofocus with no parameter adjustment from the technician.

We have a camera enclosure that I built which allows the camera to be moved up or down about a foot, with a minimum distance of about 6 inches to about a foot and a half. Currently, the lens is about 11" away from the muffin cup, which produces a full-frame shot. White balancing will be handled in post-processing, and you can see there is a neutral grey card affixed to the scale for reference.

I imagine that one of the main problems is that we're not getting enough light from the fluorescent lamp in the box, so I'm considering getting an LED ring light to help reduce the aperture width.

We want uniform lighting that produces as little shadow as possible, and allows for resolution of the small features on the buds, such as trichomes and hairs.

The general principles I'm working with are:

  • As much light as possible
  • Narrowest aperture possible, for greatest depth of field (But with the flash, this seems to be not actually true?)
  • fastest shutter that produces acceptable exposure
  • Low ISO

Am I on the right track here? I took a handheld shot with my iPhone 4S and it's sharper and more in focus than anything I've gotten with the DSLR yet... With the flash, the kit lens is actually looking the best so far, which doesn't seem right.

I've uploaded an album showing the camera enclosure and some test shots:


  1. Camera Enclosure
  2. Nikkor Micro 40mm, ISO 200, 1/200th, f/5.6
  3. Nikkor Micro 40mm, ISO 200, 1/200th, f/25
  4. Nikkor Micro 40mm, Flash, ISO 100, 1/200th (fastest flash sync), f/18 (Not sure why it's so unsharp! I can't really seem to get any good flash shots out of the 40mm Micro)
  5. Nikkor Kit lens @ 45mm zoom, Flash, ISO 400, 1/200th, f/20
  6. Handheld iPhone 4S

Thanks for your help!


3 Answers 3


I would use a flash. The intensity of a flash and the extremely short light duration are unbeatable for sharp macro images. However what you want is GOOD flash illumination.

What I have used in the past is a box made of white foam core board with a translucent window on one side and an off camera flash fired into the window on high power (although even half power is very very bright from that distance).

The translucent (not transparent) window increases the relative size of the light source to the subject, which reduces shadows (think about the shadows on a clear day- point source of the sun versus on a cloudy day - light source size of the entire sky).

The internal reflections from the white box walls then distribute the light all around the subject.

If you want to modify your set up minimally, mount an off-camera flash on the hotshoe and point it forward, out of the the box at a large piece of white card in front of the box; that gives the large relative light source.

That might be too much extra work in moving that reflector for each sample, I don't know.

If you do not have access to an off-camera flash, you could jerry-rig something around the on-board; just remember that the final aim is to have the light source as big as possible.

Also the flash plus kit lens looks better than the iPhone to me, but the flash looks too harsh. You want to soften it as above.

The shutter speed is pretty irrelevant with the flash. I'd have it as high as possible to reduce ambient light and ensure the only illumination is the flash however.

Aperture is very relevant, and you want it as small as you can go without diffraction effects.

I would not set the camera on auto at all; this is a completely controlled static situation so you will get better results by setting everything up manually once (even, if not especially, the flash power) then just clicking away each time.

EDIT: Image 4 is very odd, it looks motion blurred to me and the auto flash exposure has obviously gone wrong, which is a good reason to use manual settings as above. It almost looks like it balanced the ambient 50/50 with the flash and the enclosure was knocked or something.

  • \$\begingroup\$ I think your main problem is not depth of field or focusing, but lighting. Using a ring light, or direct flash, from the direction of the lens inevitably provides very flat lighting. You probably have enough depth of field, but features are not well registered, due to poor contrast. To get the features you need directional light from the side as the image at: foto.ifokus.se/u2/bfcda66ed4e87e49ade5db589c1fad2e/default/… \$\endgroup\$
    – Inkanyezi
    Aug 21, 2015 at 19:20

Take a look at a depth of field calculator. There are fundamental physical limits, so you want to learn what is possible with a perfect lens.

You can see what different arrangements can do for you, on paper.

The phone is a physicly smaller aperture, so will give a deeper field and better cover the 2 inches. If you scale up your setup to keep the proportions, your dslr would be several times farther away. Draw a scale based on the sensor size and multiply it out for the difference between the phone sensor and dslr sensor; the f-stop number scales by design and you seee the larger physical aperture for the same number. Your subject distance will also be much farther.

A subject 60 inches and 62 inches are about the same distance: the rays from each distance are almost the same angle. Compare with 10 inches cs 12 inches, which is a solid 20% and a different focal position.

  • \$\begingroup\$ Depth of field calculation assumes printing to a certain size. If you want pixel-level sharpness (or almost pixel-level), then you should not choose standard camera models from here dofmaster.com/dofjs.html but rather a specific circle of confusion (CoC) about twice the size of your sensor elements. For example, a D5000 has about 5 micron elements, so choose 10 micron as CoC. \$\endgroup\$
    – FarO
    Aug 12, 2015 at 8:50
  • \$\begingroup\$ Ok, good to know about the relationship between sensor / aperture size and depth of field. I'll take this into consideration. And thanks OlafM for the info about CoC. Good to know. \$\endgroup\$
    – Ethan BB
    Aug 12, 2015 at 19:26

You are on the right track. A few things could help here.

First would be to get more light in the box. A florescent light typically makes quite poor light. It can be inconsistent in quality and usually isn't all that bright either.

Next I would recommend pushing your aperture up to the diffraction limit but not beyond. Your third example image was close but I would increase the aperture to somewhere near f/16 and also bump up your ISO to 400 or so depending on how bright your new ring light is.

Take a look at - How do I get adequate depth of field in macro photography?

Note that you may have to stack images to get the depth of field you desire.

  • \$\begingroup\$ Thanks so much for your answer. We can't do depth of field stacking because we have to get an adequate image with one exposure, to minimize the burden on lab technicians. Good to know to research the diffraction limit, though. And I'll definitely get a better flash. \$\endgroup\$
    – Ethan BB
    Aug 12, 2015 at 19:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.