# Caliper

## Summary

Caliper Tool measures widths of gaps along a given line. The line may contain any number of light and dark gaps. The maximum number of reported gaps and the gap type of interest can be set with the Max Gap Count and Gap Type parameters, respectively.

## Detailed description

Start and end points and the width of the caliper line can be set easily by dragging and dropping any of these three parameters on an image. Notice that the line can be rotated when holding down the Ctrl key. Likewise, the line can be moved when holding down the Shift key.

The measurement can be done using one of three different algoritms:

Absolute Threshold
determines the edges of the gaps by comparing the intensity values along the caliper lines directly to the threshold. This is the most common use case.
Differential Threshold
measures the rate of change between consecutive samples. A new gap begins when the diffences exceeds the threshold.
Gaussian Zero Cross
tries to find points where the difference between samples have local extrema. Note that this algorithm is more susceptible to noise than the other two and should only be used with high-quality images.

The measurement accuracy in blurred images can be improved by setting Smoothness to a value larger than zero. The bigger the value, the more blurred the image is assumed to be.

The threshold can be set easily by looking at Filtered Profile output. For example in the image below, it is easy to see that the threshold should be somewere between 150 and 200.

In this demo, a quick-and-dirty calibration is performed by manually adjusting the Focal Length input parameter of the image source. If the lens exhibits no significant non-linear distortions and if the camera is perpendicular to the world's xy plane, the focal length tells the number of pixels per millimeter.