Structured Light Scanning

Superior Scans

I had learned a great deal while designing and building my laser scanning fixture, and all the while, I kept thinking about the inherent weaknesses and limitations of using a laser line to extrapolate 3D surface data. I wanted something faster, easier to use, that could produce cleaner data sets. Maybe too much to ask, but I’ve got a lot of time on my hands.

So I set about to address what I felt were shortcomings in the laser scanning process.

First, the scanning speed was lacking. The digitization process uses a digital camera to map the shape of a straight laser projection, and essentially must take a unique snapshot of the laser for every vertical pixel of the scanning window. At a capture rate of 20 frames per second, a single 800×600 capture would take 30 seconds (600 frames / 20 frames per second) to travel the entire surface of the part. In real application, the scanner had to travel a bit slower than that, and I had to make multiple scans of any given surface before I could produce clean surface data. For high resolutions scans, however, things got a lot worse.

My camera (and many low end digital video cameras) could only capture 1600×1200 at a 5 frames per second. So for higher resolution scans,  it takes 240 seconds (4 minutes) per scan, which can be a very long time when I needed to rescan each surface multiple times to get clean surface data. This setup is also sensitive to motion and shake, as it effectively scans the part one line at a time, and any motion between line scans shows up as rippling and distortion in the resulting 3D surface.

The second issue was the finite thickness of a projected laser line. My first laser projected a line that was nearly 1.5mm thick, which had a big impact on the quality of the scans. This thick laser line produced wavy surface scans, and washed out some of the detail on my parts. With a focusing laser, the results were much better, but I still had a finite laser thickness of 0.5mm. With careful attention to the camera settings and good part preparation, I could generate smooth surfaces with little distortion, but small details, like chips and surface roughness were washed out, and nearly impossible to pick up with the scanner. I was now intending to use the scanner to measure surfaces, rather than just reproduce them as parametric models, so for castings and similar surfaces, which have subtle surface textures, I really needed a process that would pick out the details better.

laser_scan_pic

High resolution laser scan, with smoothing filter

So enters structured light and white light scanning.

Structured light follows the same basic triangulation principles of the laser and camera combination, but does so in a more efficient manner. Rather than scanning the image one line at a time, as was done with the laser, structured light effectively scans the entire image with only a few frame captures. It does this by using a digital projector in place of the laser, which is used to project a sequenced pattern of light and dark bars over the surface of the part. The unique pattern consists of a series of light and dark patterns ordered in a binary fashion, where the projected sequence starts with half light and half dark, then 2 light stripes, and 2 dark stripes, 4 stripes, 8, 16, 32, etc for 10 or more frames.

Pattern08Pattern09Pattern10Pattern11

This projection pattern is really a binary progression, and can be used to extract a whole lot of information from relatively few images. With just 10 image frames, you can actually reproduce 1024 (2^10) unique photos of the part by simpling adding and subtracting image data. Imagine if you stacked all 10 images on top of each other like transparent slides, and you would see an image of the part with a single 1/1024th frame wide strip of light projected across the part. This thin strip of white light can then be used to extract 3D surface data much in the same manner as the laser, only with more detail, and much faster than before. By reordering which frames you use, and adding and subtracting the image data in an orderly manner, you can reproduce that impossibly thin line in any of the 1024 possible locations on the part.

The binary series is one of a few techniques used in structured light scanning. Three phase patterns, which use a series of three smooth light to dark banding patterns work in a similar fashion, and are also capable of producing series of reference lines on the part. Each pattern is offset 1/3 the distance between the darkest bands and by combining the resulting images from only three projections, it is possible to extract 3D data as well. There are lots of techniques, and a brief review of scientific white papers will turn up hundreds of promising light patterns for 3D data reconstruction.

Pattern02

Sinusoidal pattern

So now, instead of capturing 1024 unique frames to scan a part, I only need to capture 10 frames. Pretty slick, and the results are stunning.

There more advantages than speed. Projected light is much safer than lasers to work with, and it makes it possible to safely scan human faces without risk of permanent damage to the eye. It is also much easier to work with and more forgiving than a laser, which has a tendency to produce reflections and artifacts in the 3D scan. The structured light is also capable of generating impossibly thin light stripes and can pick up far more surface detail than a laser. There are no moving parts to introduce distortion in my scans, and the results are truly astounding. It is also the only technology that can sensibly make high resolution scans, and it works very well with high resolution still image cameras.

So I began work on a structure light scanner, to see what it was capable of. I started my trials with an open source software package published by Brown University online here.

After a couple of weeks of configuring, rewriting and recompiling the code and fiddling with the various settings, I was able to generate a few sample scans. I used my webcam for the tests, and from the very first trial, it was obvious that the structured light technique was capable of producing cleaner data in much less time.

To build a proper scanner, the first thing I needed to purchase was a pair of new and expensive machine vision cameras. Machine vision cameras are better suited for digital imaging and 3D reconstruction because they are designed to yield superior sensitivity and contrast, which is especially helpful for computers to see sharp edges, outlines and shapes. I picked up a pair of black and white 2 mega pixel Point Grey Scorpion cameras, and it was worth the investment. When comparing my highly regarded webcam to an image from the machine vision camera at the same resolution, the difference in clarity is astounding. Straight lines are straight, and areas of contrast pop out of the image with much more distinction. The difference was most obvious in the calibration sequences, which depend heavily on the computers ability to locate the corners of a printed checkerboard placed in front of the cameras. Where the webcam was unable to locate the corners in some light conditions, the machine vision cameras found them nearly every time, regardless of the ambient light.

DSCN2437

Portable structured light scanning fixture

The open source software was capable of creating scans, but I needed something more polished and usable for use in my business. After some research, I invested in the FlexScan software package produced by 3D3 Solutions and began working towards my goal of producing superior 3D volume reconstructions in the least amount of time. FlexScan made use of 2 cameras and the projector, which provides a notable improvement over a single camera, and the results were unlike anything I had ever achieve with any of my prior experiments. The 3D digitizations were crystal clear, completely free from waviness or serious artifacts. The 3D scans picked surface texture, paint blemishes, chips and minor cavities that were often difficult to see with my eyes. The raw data, as generated by the scan is shown below. I have a photo of the original part surface for comparison.

Original Cast Manifold

Original Cast Manifold

Raw 3D Scan data

Raw 3D Scan data

My previous laser scans depended heavily on post processing to filter out artifacts and surface waviness. After extensive filtering, a scan would look smooth, but small details, such as the surface pitting and texture would disappear. FlexScan was generating flawless surface reconstruction with no filtering whatsoever.

Automated Scanning

I had a second goal in mind. I wanted a completely hands-off scanning solution for reconstructing 3D part volumes. Both the structured light and the laser scanner can scan only a single projected surface at a time. To reconstruct 3D volumes, the part had to be repositioned and scanned from different angles, and the resulting surfaces patched back together in the computer to reconstruct the part.  Manually repositioning surfaces in the computer took a huge amount of time, and with 16 or more scan patches it became difficult to correctly orient surface patches.

I needed a faster way to reconstruct surface volumes.

Part of the appeal of the FlexScan software was an integrated feature which allowed it to communicate with an automated rotary table. With a proper table, FlexScan could automatically reposition the part and take multiple surface scans, and correctly orient the patches in the computer.

What I needed for this feature, of course was a rotary table. Which are notoriously expensive, and far beyond my budget for this project. So I needed another solution.

My local industrial surplus seller, Surplus Gizmos had just what I needed, sitting on the shelf amid industrial electronics and industrial mechanisms: A 24V DC Servo motor with a 100:1 reduction harmonic drive output. Equipped with a 500 count encoder, the motor could accurately place a part within 1/140th of a degree, with zero backlash error and outstanding torque. I grabbed a teflon table from a silicone wafer washers, a few hunks of machined aluminum, and patched together what became an incredibly precise positioning table for less than $200 bucks. I added an Arduino microcontroller with a USB interface, and ran the motor using an LMD18200 pulse width modulated (PWM) motor controller to control the motor speed and direction. Even loaded with 200lbs, the table turns fast and smooth.

DSCN2436

I wrote custom code for the Arduino to interpret the serial commands sent from the scanning software and positioned the motor using a custom PID (proportional, integral, derivative) servo control scheme. My knowledge of electronics is severely lacking, especially when it comes to digital noise, grounding, and just about every part of an electronics circuit, but after a few days of testing I was able to fully automate the table, and get it under the control of the FlexScan software. I simply position the part, set the number of scan sequences, and click start. The software takes over, automatically positioning the part, capturing the projected light sequence and fully translating the individual scans in 3D space for a final fit and 3D volume reconstruction. A basic high resolution scan sequence now takes about 2 minutes. My previous attempts with the laser took nearly 2 hours.

WordPress Themes