Using Focus Stacked Photos to Create 3D Reconstructions


Creating a 3D scan of an object can be done several different ways. We’ve seen everything from long distance laser cameras and hacked Kinects used to great effect. Computer engineer Giancarlo Todone’s take on creating a 3D reconstruction takes another approach: using focus stacking.

This method isn’t new. It’s called depth from focus, and it was proposed as far back as the late 1980’s in a research paper by P. Grossman. Todone simply managed to do it using only a Canon Powershot with some custom firmware.

Without getting extremely technical, the method basically works by taking a focus stack of an object, and then analyzing the luminance of each pixel in relation to its neighbors. The luminance difference between a pixel and those around it will tell you how well in focus it is, giving the pixel a “focus rank.” Knowing the focus distance that each photo in the stack was taken at, you can then use that focus rank to generate a depth map of the object.




The cool thing about this technique is that the individual pixels aren’t messed with, and so they retain their original color. The final point clouds that Todone created in MeshLab using the data he collected are color-accurate 3D representations of the subjects created from a focus stacked 2D image.

Of course, the technical details are a bit more complex, but you can learn all about the process and its challenges over on Todone’s blog if you so choose. And if you wanna try the technique yourself or get your hands dirty (in a programmer sort of way) you can find all of the necessary details — including the code, setup and more sample photos — on that blog as well.

(via Hack a Day)