# Are Computer Stereo Vision techniques appropriate for sub-millimetre measurements?

I have a project where I would like to image an object and be able to derive the heights of features in this image to sub-millimetre precision (exactly how precise is still yet to be determined, but let's say 100ths of a millimetre for now).

I have been previously advised that direct laser ranging techniques will not be appropriate

• the travel time will be too small and thus will require too much precision to make precise calculations
• minor vibrations (such as a person walking near the apparatus) will perturb the results

### Stereo imaging

Given the large field of view you need in relation to the accuracy you want, and how close you want to be, I think that stereo imaging may be a challenging, so you need to somehow amplify the differences you are trying to measure.

### Structured lighting

If you are essentially trying to measure the profile of an object, have you considered a single high resolution camera and structured lighting?

Thanks to looptechnology for this image, used without permission, but hopefully attribution will be enough.

Note, the shallower the grazing angle, the the greater accuracy you can measure, but the lower the supported depth of field would be, so for your application you would need to optimise for your needs or make your system adjustable (one laser angle for 0-500um, another for 500-1500um and so on). In this case though, you would probably have to calibrate each time you changed laser position.

Incidentally, a very cheap way to try this out would be to pick up a pair of Laser Scissors which include a basic line laser LED.

Finally, you can remove the vibration problem by sampling multiple times, rejecting outliers and then averaging. A better solution though would be to mount the whole test apparatus on a block of granite. This worked well for laser micro-machining tools I've worked with in the past, which require micron level position and depth of focus accuracy, even when located in factories.

### Some back of the envelope calculations.

Lets assume an incident angle of 10 degree from horizontal, and a camera with a 640x480 resolution and a field of view of 87 x 65mm. If we place the beam so that it is right at the bottom of the portrait frame with no sample, and then place the sample with the beam crossing it, this should give us a maximum height of around 15mm and thus an uncorrected resolution of around 24um for each pixel the line walks up the screen. With this setup, a 0.1mm variation should be visible as a 4 pixel variation in position.

Similarly, if we use an incident angle of 2 degrees from horizontal then this should give us a maximum height of around 3mm (Tan(2deg)*87mm) and thus an uncorrected resolution of around 4.7um per pixel, for a much more noticeable 20 pixel jump. This would probably require a much more accurate line laser however.

Note, if the camera is close enough then the you may need to do a second trig calculation, using the camera height, to determine the the true position of the line relative to the base line.

Also note that if you don't need absolute accuracy, and local repeatability is enough (say you are profiling the flatness of a sample to ensure it is within given tolerances) then just being able to see the relative position of the laser line might be enough.

• I'm not against going beyond 2 cameras, or 2 laser sources and so forth to achieve the required precision if it will help :) This would solve the calibration problem I think, but of course introduces the question of "how much is enough"? Your suggestion seems to indicate that multiple structured light sources and a single high res camera might provide the required information. Sep 30 '11 at 14:03
• For very high resolution systems lasers aren't ideal. There is a minimum speckle size that limits how 'smooth' you can make a laser line. Ironically you do very high resolution structured light be using a random speckle pattern and multiple cameras Mar 27 '12 at 17:09

The precision of a stereo system is limited by the pixel size. Theoretically high-end cameras should have sufficient pixel density for such precision. Of course, the cameras will need to be calibrated, and the object will have to be reasonably close to the cameras.

• carlosdc's answer has some questions that should help determine what "reasonably close" means. Aug 16 '11 at 22:03

It depends on the geometry, but certainly in principle.

Your objects need to have sufficient "texture" that you can match identifying features from one camera to another, and then your cameras need to have a sufficient number of pixels that a depth discrepancy of 0.01mm corresponds to > 1 pixel when projected onto the image plane.

Mapping out lens distortions may be a bigger issue than it normally is at these scales.

• "Texture" can be added to the object's surface by structured lighting (like Kinect). Usually it is generated from an affordable laser diode and a diffraction grating designed for this purpose. (A video projector might be able to generate such patterns; getting it to focus on a short distance would be difficult.) Aug 17 '11 at 8:09

For very fine resolution your best bet is likely a cheap and readily available laser depth gauge from Keyence. They work, they're relatively cheap, and they're an industry standard. http://www.keyence.com/products/measure/laser/laser.php

The cheapest 2D optical technique could be to create a "shadow Moire" system using Ronchi rulings. With the guidance of an optical engineer some years ago, I designed some handheld devices to measure small deformations in matte metal surfaces. We were able to detect depth changes of about 100 microns (0.1 millimeters) fairly readily, and although I don't recall exactly we might have been able to detect depth differences of about 10 - 20 microns. The fringe pattern is easy to interpret, and also provides a convenient height map.

Here's a reasonable explanation of the shadow Moire technique: http://www.ndt.net/article/wcndt00/papers/idn787/idn787.htm

A Ronchi ruling can cost about $100: http://www.edmundoptics.com/products/displayproduct.cfm?productid=1831 The device itself consists of a Ronchi ruling (which is a slab of glass with precision deposited lines), a light source mounted at a fixed angle to the ruling, and a viewing tube which is also set to a precise angle relative to the ruling. Our device was placed in direct contact with the surface, but you could also create a non-contact device. Once you've cobbled the device together you'll want to calibrate it. Whatever the expected number of fringes per millimeter may be according to the math, you'll still need to calibrate it. For calibration we used thin gauge blocks, the thinnest being a mylar sheet of a known thickness of 1/2 mil (0.0005 inches, about 12.5 microns). You place the device with the ruling on a flat, semi-reflective surface with the gauge block tucked under one edge of the ruling. This generates a series of fringes. You know the height of the gauge block and the length of the ruling, so using a little trigonometry you can calculate the number of fringes per millimeter. Laser triangulation with a single camera is also an option, but is generally much trickier than it first appears. It can take a lot of work to achieve a depth accuracy of about 0.1mm using laser triangulation, and there are quite a few gotchas involved. For high accuracy surface scanning you could spend up to$100k to buy a really nice system based on confocal microscopy. They're wicked cool. http://en.wikipedia.org/wiki/Confocal_microscopy

In theory there's nothing to stop you. However, I can think at least of a couple image capture issues that will manifest themselves at this scale. I'm not an expert in the issues of microscopy, here are a couple of issues:

• What would the depth variation along the line of sight be compared to the distance from the camera to the object? While rectification is easier under scaled orthographic constraints (the depth change of the object is tiny compared to the distance along the line of sight from the object to the camera) this would not give you the desired detail. So the camera would need to be quite close to the object.

• What would the baseline be, compared to the size of the object? Wide baselines are hard, while there are good techniques for narrow baselines. It sounds like at this scale physically locating two cameras that are close to each other can be challenging.

• I have edited my answer a little bit. Aug 16 '11 at 21:18
• One of the "harder" interesting objects would be about 20mm square, 1.25mm high. The surface features in question would be on the order of .1 - .3mm I'm estimating. The camera position would likely be on the order of 6" above. Does this give you better insight? Aug 17 '11 at 15:15

(Posting this answer in the hope of helping OP, even though my answer is off-topic for this site)

Edited: My calculations below were for horizontal and vertical measurements across the image. They are not valid for stereo-based depth estimation. To see a valid calculation for stereo-based depth estimation, see Martin Thompson's answer.

According to Wikipedia, confocal laser scanning microscopy is useful for surface profiling.

10μm (100th of a millimetre) is the starting point of usefulness of all sorts of microscopy devices, because it is just one order of magnitude below the usefulness of digital imaging devices (about 100μm per pixel, at maybe 10 - 20 cm distance).

My assumptions are:

• Distance from object: 15cm
• field of view: 10cm
• image width in pixels: 3000
• raw resolution power: 30 pixels per mm
• Assuming correctly focused, and due to noises, optics and compression artifacts,
• (point spread function) objects may be blurred up to 5 pixels apart
• estimated resolution power: 6 pixels per mm (160μm)

That said, it's a matter of building a number of laser, optics and imaging components (and the enclosure, which is very important) at the required machining precision. I'm not sure whether it is feasible to build a poor man's confocal laser scanning microscopy. (I also don't know the second-hand price of such machines.)

At such resolution, stereo vision alone without the help of a special light source (structured light, laser, etc), would suffer from the "lack of texture" problem.

Theoretically it is possible. Practically... it seems like a difficult problem that would require very high resolution stero cameras and figuring out some math equations.

Specifically, you will need to come up with at the very least a math equation to figure out what is the minimum resolution stereo camera you need. Then you will need to figure out what kind of ranging algorithm you need and how good a quality metric is needed so that you are measuring what you calculate you measure.

But bottom line is that theoretically it is possible to measure sub-milimeter ranging using stereo camers... this is more of a "engineering" problem to try and get it working.

• Definitely I think you would need to do more than just get a really high resolution camera. Sep 13 '11 at 17:32
• One of the very first things I would look into after getting a high-resolution-stero-camera-setup is how to "increase the texture variation through the use of added artificial lighting". (This is a necessity IMO because lots of objects do not have good texture varition to let you accurately measure the depth... especially at high precious like you want.) Sep 13 '11 at 17:36

I've worked in metrology in a past life. Systems like this one both use the stereoscopy and claim to achieve about 1 microns precision (sub-pixel accuracy).

The solution with a laser scanner and an encoder would be another solution.

My job was to test those systems. It was not possible to achieve desired precision reliably. In fact, most vendors were artificially boosting their numbers.

I would suggest going for a microscope. The automated way is highly dependent on a large number of factors that will restrict you from achieving the precision you need. The aerospace industry uses CMMs for measuring parts, which goes well over 100k$and are having a hard time achieving such precision in a controlled temperature room with controlled atmospheric pressure and humidity. Also these systems suffer from wear and must be recalibrated all the time. But above all, all trade secrets of those systems are in the calibration algorithms. This really makes the secret sauce and this is how software and a few 5k$ cameras can sell for over 100k\$