Height Profile

Height Profile

Calculates the height profile of a surface that is illuminated with stripe of light. It is designed to be used in applications where the target to be measured is scanned with a laser line to obtain its 3D shape.

The tool is configured with a reference line that indicates the visual location of the laser line on the xy plane of the world coordinate system (z = 0). The calibration of the tool is most easily performed by taking a picture of the inspection area (world xy plane) without the target object and placing the reference line on top of the laser line in the picture.

It is also possible to use any other flat object as the calibration target. This however requires that the thickness of the object is known and given as the zOffset parameter. The tool assumes a flat and opaque world xy plane behind the object and produces no negative heights. Giving a too small offset can cause cutting.

3D triangulation is performed by calculating the perpendicular distance from the reference line to the detected location of the light stripe. Deviation to the right (traversing from startPoint to endPoint) increases height and deviation to the left decreases it, although this can be changed by making scale negative.

The width of the search area defines the limit for the search of the laser line. Depending on zOffset and scale, only the part of this area that would produce positive height measurements will actually be taken into account. For example, if zOffset is zero and scale is negative, only the left half will be considered.

Inputs

image
Input image.
startPoint
The expected location of the start of the light stripe on a flat surface at z = zOffset.
endPoint
The expected location of the end of the light stripe on a flat surface at z = zOffset.
width
The width of the window to search for the light stripe. The width of the window places a hard limit to the maximum height.
scale
The conversion ratio between world units and height. The tool first calculates the shortest distance from a detected point on the light stripe to the reference line in world units. This distance is then multiplied by scale to get the relative height.
zOffset
The height of the calibration surface the reference line lies on in world units. Positive value means closer to camera. zOffset has to be smaller than the distance between the camera and the surface at z = 0 in world coordinates.
invert
By default, the tool looks for the brightest spot in the search area. In some situations, the measurement line is however a shadow rather than a light stripe. Enabling invert makes the tool search for the darkest spot.
interpolation
If true, improve accuracy by calculating the location of the brightest/darkest spot in sub-pixel accuracy. If false, round pixel coordinates to the nearest integer. Notice that interpolation is a significantly slower operation than rounding.
sampleDistance
The distance between height profile samples in world units. Note that the requested sample distance may not be exactly achievable; the tool rounds it so that the last sample is exactly at endPoint. In addition, the length of the resulting vector is limited to 10000. Setting sampleDistance to zero makes the tool to automatically select the sampling distance so that it is close to the distance between adjacent pixels in the image.

Outputs

profile
1-by-N matrix that contains the height at each sampled point along the reference line. The height values are given in world coordinates.
sampleDistance
The distance between height samples in world coordinates. Since the distance between startPoint and endPoint may not be exactly divisible by the sampleDistance input parameter, this value may be slightly different from it.