<a id="easygauge-advanced-usage"></a>

# Advanced Usage

<a id="easygauge-advanced-usage-analyze"></a>

## Analyzing the Results

* Use [`MeasureSamplePath(n)`](../../../doxygen_cpp/classeVision_1_1EBaseGauge.html#a675cb0d501015c87e0ec28479055bd31) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EBaseGauge.html#af77230f583f0520bdcca677b1790417a) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EBaseGauge.html#a19ff9fce228507c08a3f311b933f017e) to perform the measurement of the n-th sample path.
  * This measurement can be useful to tune the transition measurements parameters. See the [section below](#easygauge-transitions-tuning).
  * This method returns an [`ESamplePath`](../../../doxygen_cpp/classeVision_1_1ESamplePath.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePath.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePath.html) object:
    * Use [`GetSamplePath`](../../../doxygen_cpp/classeVision_1_1ESamplePath.html#ada5869e81e15d5c4c4aa06eaf9aca53d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePath.html#ab817c20629eb088f4f47acb848c3f14a) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePath.html#affa4a07aadb34c5017627d2c968e06d8) to get the line segment of the path.
    * Use [`GetMeasuredPoint`](../../../doxygen_cpp/classeVision_1_1ESamplePath.html#aadce42b9490904de0978489c8cf41e43) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePath.html#a5793e0aa05bd36d399e12eb77c408f88) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePath.html#a98205125e7d8ce5885c4510fcdaff71a) to get the selected measured point or use [`GetMeasuredPoints`](../../../doxygen_cpp/classeVision_1_1ESamplePath.html#a5723497c0484d05b3abb9e249af8bb7e) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePath.html#a8499dffd9090b99e707f69b185ad2ed4) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePath.html#a003e3a2eb7d1437da68f872a5f73505d) to get all the measured points.
    * Use [`Plot`](../../../doxygen_cpp/classeVision_1_1ESamplePath.html#a5f0df3c24f415d0e03b60ea470d5fa3e) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePath.html#a565250bc0606785f67511654ff30dbb3) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePath.html#a5ac5626792dc7280318b73409c4178df) to plot the profile and/or the derivative of the path.
    * Use [`DrawPath`](../../../doxygen_cpp/classeVision_1_1ESamplePath.html#a85630325d6952309938389ba038deded) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePath.html#ac65877d702eec9e70f644ef534f124d1) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePath.html#a59b074fdfb741adeb450de31f02e0164) to draw the path.
* After having measured the gauge with [`EBaseGauge::Measure`](../../../doxygen_cpp/classeVision_1_1EBaseGauge.html#a09dbcb0c1bb7681ba31870c626fd0231) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EBaseGauge.html#a3fa25d60234bce338c219c93e591626f) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EBaseGauge.html#addcbfdee6ba540ab56d43c653a06e8e2)
  * Use [`GetSample(n)`](../../../doxygen_cpp/classeVision_1_1EBaseGauge.html#ad8c734183ea33359237f662fbcc0395c) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EBaseGauge.html#ab41393e2e281ce62bf2d19898f0148d5) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EBaseGauge.html#a97669298f4de34aeff01df37e7804e35) to get the measured [`sample point`](../../../doxygen_cpp/classeVision_1_1ESamplePoint.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePoint.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePoint.html) of the n-th sample path. The sample point contains:
    * Its [`position`](../../../doxygen_cpp/classeVision_1_1ESamplePoint.html#a7b53a3bc047876b079b2a299f41519e3) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePoint.html#aa647f63bd3feb81ba831986115073ba0) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePoint.html#a182287b150437ace6380e345a2cd3903).
    * Information about the edge crossing ([`EPeak`](../../../doxygen_cpp/classeVision_1_1ESamplePoint.html#ab5e1f6039178e781542f3b1cf1263cd7) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePoint.html#a2d826186b594ddeae8a6b935fc87a19a) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePoint.html#a050155e82deadec9c41e1fc5bfd091c2)).
    * Its [`validity`](../../../doxygen_cpp/classeVision_1_1ESamplePoint.html#addec7ebc15850c5987600d4675d0178b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePoint.html#a385d9f6f6077adab7e02857ac2ba4ef5) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePoint.html#a5fc40fcb522da4785f204cc9ee9e4d21): a point is valid if at least one transition point was found matching the transition measurement parameters and it wans’t rejected as an outlier or due to the skip ranges.
    * Whether it was rejected as an [`outlier`](../../../doxygen_cpp/classeVision_1_1ESamplePoint.html#aed7de3a10d498671a4079c28310b195b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESamplePoint.html#aa652356f0dca0bfe9bfdba60a327627a) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESamplePoint.html#aa9433ac0b2f4be2fac1ad37f63c393e0).
  * Use [`GetNumValidSamples`](../../../doxygen_cpp/classeVision_1_1EBaseGauge.html#afac19326d6d23ea89410e6a040a8e1d9) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EBaseGauge.html#a971da697d294a055cbeab0a3700d89f2) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EBaseGauge.html#a5f9c9603dd846bfe0f29f0921206d974) to get the number of valid sample points remaining after the model fitting operation.
  * Use [`GetAverageDistance`](../../../doxygen_cpp/classeVision_1_1EBaseGauge.html#aee2e8789e129d26e1f2f8a0d8d248bc8) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EBaseGauge.html#a0dd5cd08cec568f5f6b91a0fd5bd2c60) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EBaseGauge.html#affceb8ab67681f2b16e9b4371f302b95) to get the average distance of these points to the fitted model.

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

## Tuning the Transition Measurement Parameters for Unclear Transitions

The **EasyGauge** default parameters and working modes are good for clear transitions.

More complex situations may need the tuning of additional parameters. Here, we show how to tune a point gauge. However, you can apply the same method to the other gauges by analyzing their sample paths.

1. **Set the gauge point location and tolerance.**
   - Sets the nominal line of the point gauge. Its [`center position`](../../../doxygen_cpp/classeVision_1_1ELine.html#a3df0fc707a72d8e064f18843aea4f54d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ELine.html#a0803a690352c0e24f9b411f3ac1b5802) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ELine.html#ab5c15196c16b43d70a7879e70dd4d5a9) and [`orientation`](../../../doxygen_cpp/classeVision_1_1ELine.html#aadf02c440675419fd93968a6a238e022) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ELine.html#a20651aeef27892d7999900b2038c60be) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ELine.html#ab3774d2119f8320688eea94323f69a84) are easy to decide based on a sample image or on the coordinate considerations.
   - The [`tolerance`](../../../doxygen_cpp/classeVision_1_1EPointGauge.html#a07be747a927ab3989c81fc0b09da6744) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EPointGauge.html#adb712e65f7ef17a0af239636f880265f) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EPointGauge.html#a5586841fde4eb89bcbdbb6e1b703b247) depends on the edge position variations. A larger tolerance increases the likelihood of hitting an edge, but it may be a false edge or an extraneous feature.

   ![image](assets/images/easygauge/17836.webp)
2. **Decide whether a noise reduction is required.**
   - Lay the gauge over the desired location and observe the profile curve and its derivative (play with the filtering parameters while looking at the plotted curve).
   - The curve regularity gives an indication of the spread of the gray-level values.
   - When these coefficients are set, the gray-level profile will not change anymore.

   ![image](assets/images/easygauge/17837.webp)
3. **Set the threshold value.**
   - Set a value low enough for useful parts of the peaks to cover enough pixels (to achieve better sub-pixel accuracy), but not lower than the ambient image noise.

   ![image](assets/images/easygauge/17838.webp)
4. **Remove weak or false transitions.**
   - Use the list of peak amplitudes and areas.
   - Plotting these values along with good and extraneous peaks can help find appropriate peak rejection limits.

   ![image](assets/images/easygauge/17839.webp)
5. **Choose whether all transition points are needed or just the most relevant**.
   - If all the transition points are required, you can query them one after the other.
   - Otherwise, choose a point selection strategy based on the strength, the order or the transition polarity (black to white and/or conversely).

   ![image](assets/images/easygauge/17840.webp)
