Space carving of gemstones
Recently a potential customer approached me, asking me for a solution to 3D reconstruct inclusions and dirt in translucent gemstones based on camera images. After going back and forth for some time, it became clear that the hardware setup was fix and that they were unable to calibrate the camera. However, given their current setup they were able to properly focus the camera and taking images from several, discrete angles to examine the objects of interest and after a few iterations, a set was sent over to me to work with.
In principle, there are many different approaches for the stable detection of inclusions from a sequence of camera images such as background subtraction or exploring the optical flow. Nonetheless, this customer asked specifically for a solution based on the 3D information and given the (admittedly strange) constraints of this project, I’ve implemented a prototype using Python and OpenCV based on a technique also known as Space carving.
Space carving aims to determine the structure of an object inside an observed scene by filling it with a grid of small blocks (so called voxels) and iteratively removing all blocks until the remaining ones converge towards the physical representation based on the camera images. As this customer used an uncalibrated setup, however, I had to estimate the camera parameters based on the images.
The animation shown above demonstrates the overall procedure. Given the constraints of this task, I think the quality of the 3D reconstruction is acceptable.
I’m available for software consultancy, training and mentoring. Please contact me, if you are interested in my services.