<a id="easygauge-principles"></a>

# Principles of EasyGauge

<a id="easygauge-principles-transitions"></a>

## Finding Transition Points

All gauges are based on finding the position of all the *transition* points, called  ***sample points***, along a line segment probe, called the  ***sample path***, that cross one or several object edges and selecting the most relevant ones.

To do that, **EasyGauge** extracts the pixel values along the  ***sample path*** (the red curve) then uses the *peak analysis* to determine the transition location. All the pixel values in the peak area are used to compute the transition location.

![](assets/images/easygauge/17811.webp)![](assets/images/easygauge/17812.webp)

On a sample path extracted from an image:

- An edge appears as a transition from dark to light (or vice versa).
- When plotting the pixel values along the sample path, this transition appears as an S-shaped curve.
- The first derivative of this curve exhibits a peak around the transition point.

#### HINT
* The better the contrast, the sharper the transition and the higher the peak.
* Sub-pixel accuracy is only possible if the transition is surrounded by almost uniform regions of at least 2 pixels wide.

<a id="easygauge-principles-complex-shapes"></a>

## Measuring Complex Shapes

Except for the [point gauge](gauge_types.html.md#easygauge-point-gauge), all gauges try to find and measure *complex shapes* with the following algorithm:

1. Place *sample paths* along the nominal shape at regular interval
2. Measure each *sample path* to find *sample points* on this path.
3. Select one *sample point* for each *sample path*.
4. Fit the shape to the selected *sample points*.
   * Fitting the shape means adjusting its parameters to minimize the error residue (average distance of the *sample points* to the measured shape).
   * The fitting algorithm can include an iterative **outlier rejection** process, that will reject *sample points* that may harm the location accuracy:
     1. Apply the model fitting to the *valid* *sample points*.
     2. The *sample points* that are too far away from the fitted model and may harm the location accuracy are made *invalid*.
     3. Repeat the proccess.
