# Find Shapes Using Geometric Models

The predefined geometric models [`ELineGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html), [`ECircleGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ECircleGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ECircleGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ECircleGauge.html), [`ERectangleGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ERectangleGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ERectangleGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ERectangleGauge.html), [`EWedgeGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1EWedgeGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1EWedgeGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1EWedgeGauge.html) or [`EPolygonGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1EPolygonGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1EPolygonGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1EPolygonGauge.html)  can be fit over the edges of an object. The targeted edge must be defined, and points sampled along it at regularly spaced point measurement gauges. Model fitting in the least square sense can be applied.

* **Line**: Measures position and orientation of straight edges.
  ![](assets/images/easygauge/modelfitting_line.webp)![](assets/images/easygauge/edgefittingline.webp)
* **Circle**: Measures position and curvature of a circle or arc.
  ![](assets/images/easygauge/modelfitting_circle.webp)![](assets/images/easygauge/edgefittingcircle.webp)![](assets/images/easygauge/edgefittingarc.webp)
* **Rectangle**: Measures position, orientation and size of a rectangle.
  ![](assets/images/easygauge/modelfitting_rectangle.webp)![](assets/images/easygauge/edgefittingrectangle.webp)
* **Wedge**: Measures position, orientation and size of a ring/ disk sector / curvilinear rectangle.
  ![](assets/images/easygauge/modelfitting_wedge.webp)![](assets/images/easygauge/wedgefittingsector.webp)![](assets/images/easygauge/wedgefittingringsector.webp)
* **Polygon**: Fits a polygon to an object and measures the exact position of the polygon, the relative orientation of the edges or the path of the contour.
  ![](assets/images/legacy_easygauge/polygon_shape_4b.webp)![](assets/images/legacy_easygauge/polygon_shape_5b.webp)![](assets/images/legacy_easygauge/polygon_shape_6b.webp)

All gauge types share these common features:

* **Point sampling**
  - Point gauges are placed along the edges and point measurement carried out at regularly spaced spots, which can be adjusted differently per side in rectangle and wedge gauges. All point measurement parameters and operating modes are available.
  - [`ELineGauge::GetSamplingStep`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#a4bff76ccb220709e33e4512c120aca42) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#a90e65cc00f566b6f4247509c982cfc32) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a340b30d067bad3d5604e49b0272bc3c9) sets the spacing of point location gauges along the model.
  - [`ELineGauge::GetNumSamples`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#a2c850ed596a1dd48649696deb3ae316f) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#ac11855d691a4e1004afcd6b2d6a44f50) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a3f31941f01e67ec0fe37d7222eb835aa) returns the number of points sampled during the model fitting operation.

  ![image](assets/images/easygauge/samplingpathssampledpoints.webp)
* **Model fitting**
  - The model is adjusted to minimize error residue and provide the best edge parameter estimates. Rectangles and wedges have parallelism and concentricity constraints. Image shows sampled points and fitted line.

  ![image](assets/images/easygauge/sampledpointsfittedline.webp)
* **Outlier rejection**
  - After model fitting, some points will be too far away from the fitted model and may harm location accuracy. EasyGauge can tag them as outliers to be ignored using the [`ELineGauge::GetFilteringThreshold`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#a042a2de43a9886ec6831d4763da0921f) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#aac7f6d918d5f52a7e37ebc21a98449a2) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#aa1d2e07d655bf2aa080c93d4e09fbdc6) property.
  - The outlier elimination process can be repeated several times using [`ELineGauge::GetNumFilteringPasses`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#ad2acbec8c8eea2de80fd26e709268ad3) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#abe2f1b4592327b0a4bb9380cde5f4508) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#aa588f290432e47404067a0e2b419ae25).<br />
    \\\\
    The number of valid sample points remaining after a model fitting operation is kept in [`ELineGauge::GetNumValidSamples`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#ad49e351b29afd946ee4ca1a2969e8071) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#ac93232cdad4e749d12e9dfa27c03592e) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a0f82221d7f621a0bc0059035d8add9cf).<br />
    \\\\
    The average distance of these points to the fitted model is returned by [`ELineGauge::GetAverageDistance`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#a6ca3c51cd319bef24300e78a58cc18ee) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#a1144b50904d04352558b0c57787eb39d) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#aed273f6b4085981c68c1c3a18c3bfb98).

  ![image](assets/images/easygauge/outlierrejection.webp)
* **Skip range**
  - The skip ranges define exclusion ranges for the paths. The sample point indexes in the skip ranges are not taken into account to fit the model.
  - The skip ranges apply to all gauge models: [`ELineGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html), [`ECircleGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ECircleGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ECircleGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ECircleGauge.html), [`ERectangleGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ERectangleGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ERectangleGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ERectangleGauge.html), [`EWedgeGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1EWedgeGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1EWedgeGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1EWedgeGauge.html) and [`EPolygonGauge`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1EPolygonGauge.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1EPolygonGauge.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1EPolygonGauge.html).
  - To define several skip ranges, use [`ELineGauge::AddSkipRange`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#ac1ce6019854b74ee11347fe2574b1397) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#aa69b6ccd8264c6f627ce980a529fc50e) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a23f1d7c1cf66fc61bf65a4bc7c1a4a9e).
  - To manage the skip ranges, use [`ELineGauge::RemoveSkipRange`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#acc0ce2812e376828592e79131b7be718) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#a09ef2af15171b1b3b4f8ca8258773e34) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a552766ed174fb56edbd3a096d205a6c8), [`ELineGauge::RemoveAllSkipRanges`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#a5f1ed1912ff9e44d2fc98f6631cedbd7) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#aa84e4f9646fa3454b87b61afc4317da1) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a122357f969c5282f3f71814c32912270) and [`ELineGauge::GetSkipRange`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#a729ed34cd1153bea2cbb7a8d7245a096) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#a117cf73bc0d7c5cb1da7eb28e15fcf7c) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a45df2a3ed9f08b51389c7bf788a32388).
  - You must call the method [`ELineGauge::Measure`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#ad926d1b61146b49d70bb753edd077576) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#adcb4f62134ea078700f45bc08d3aeb2c) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a066474d2be5d8be21e972ead773e3fd5) to take a skip range into account.
  - Use the attribute [`EDrawingMode_PointsInSkipRange`](../../../../doxygen_cpp/namespaceeVision.html#a46a5eff0a429fb8f7157564a9c7e620c) [<sub>.NET</sub>](../../../../doxygen_cs/namespaceeVision.html#a22d98bfe7b35ea321e8d60e62e838438) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EDrawingMode.html) with the method [`ELineGauge::Draw`](../../../../doxygen_cpp/classeVision_1_1Legacy_1_1ELineGauge.html#a649c58dfacbb57430cdc200281744916) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1Legacy_1_1ELineGauge.html#a79e87308d96fff8799a42cd24d6a45f6) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1Legacy_1_1ELineGauge.html#a62475bc608dfcbb0e0077f63e1061d02) to display the skipped points.

  ![](assets/images/legacy_easygauge/find_shapes_skip_range.webp)
