Wedge Fitting

Functional Guide | Reference: SetTransitionType, SetTransitionChoice, SetWedge, Measure, GetMeasuredWedge, GetInnerRadius, GetOuterRadius

using Euresys.Open_eVision;

static partial class Snippet
{
  static void WedgeFitting()
  {
    /////////////////////////////////////////////////////////////////////
    // This code snippet shows how to create a wedge measurement tool, //
    // adjust the transition parameters, set the nominal gauge         //
    // position, perform the measurement and retrieve the result.      //
    /////////////////////////////////////////////////////////////////////
    // Image constructor
    EImageBW8 srcImage = new EImageBW8();
    // EWedgeGauge constructor
    EWedgeGauge wedgeGauge = new EWedgeGauge();
    // Adjust the transition parameters
    wedgeGauge.TransitionType = ETransitionType.Bw;
    wedgeGauge.TransitionChoice = ETransitionChoice.NthFromBegin;
    wedgeGauge.TransitionIndex = 0;
    // Set the wedge fitting gauge position, diameter (50 units),
    // breadth (-25 units), starting angle (0°) and amplitude (270°)
    EPoint center = new EPoint(256.0f, 256.0f);
    EWedge wedge = new EWedge(center, 50.0f, -25.0f, 0.0f, 270.0f);
    wedgeGauge.Wedge = wedge;
    // Measure
    wedgeGauge.Measure(srcImage);
    // Get the inner and outer radius of the fitted wedge
    float innerRadius = wedgeGauge.MeasuredWedge.InnerRadius;
    float outerRadius = wedgeGauge.MeasuredWedge.OuterRadius;
    // Save the point gauge measurement context
    wedgeGauge.Save("myWedgeGauge.gge");
  }



}
#include <Open_eVision.h>

void WedgeFitting()
{
  /////////////////////////////////////////////////////////////////////
  // This code snippet shows how to create a wedge measurement tool, //
  // adjust the transition parameters, set the nominal gauge         //
  // position, perform the measurement and retrieve the result.      //
  /////////////////////////////////////////////////////////////////////
  using namespace Euresys::Open_eVision;
  // Image constructor
  EImageBW8 srcImage;
  // EWedgeGauge constructor
  EWedgeGauge wedgeGauge;
  // Adjust the transition parameters
  wedgeGauge.SetTransitionType(ETransitionType_Bw);
  wedgeGauge.SetTransitionChoice(ETransitionChoice_NthFromBegin);
  wedgeGauge.SetTransitionIndex(0);
  // Set the wedge fitting gauge position, diameter (50 units),
  // breadth (-25 units), starting angle (0) and amplitude (270)
  EPoint center(256.f, 256.f);
  EWedge wedge(center, 50.f, -25.f, 0.f, 270.f);
  wedgeGauge.SetWedge(wedge);
  // Measure
  wedgeGauge.Measure(&srcImage);
  // Get the inner and outer radius of the fitted wedge
  float innerRadius = wedgeGauge.GetMeasuredWedge().GetInnerRadius();
  float outerRadius = wedgeGauge.GetMeasuredWedge().GetOuterRadius();
  // Save the point gauge measurement context
  wedgeGauge.Save("myWedgeGauge.gge");
}


def WedgeFitting():
    #####################################################################
    ## This code snippet shows how to create a wedge measurement tool, ##
    ## adjust the transition parameters, set the nominal gauge         ##
    ## position, perform the measurement and retrieve the result.      ##
    #####################################################################
    import open_evision as oev
    # Image constructor
    src_image = oev.EImageBW8()
    # EWedgeGauge constructor
    wedge_gauge = oev.EWedgeGauge()
    # Adjust the transition parameters
    wedge_gauge.TransitionType = oev.ETransitionType.Bw
    wedge_gauge.TransitionChoice = oev.ETransitionChoice.NthFromBegin
    wedge_gauge.TransitionIndex = 0
    # Set the wedge fitting gauge position, diameter (50 units),
    # breadth (-25 units), starting angle (0°) and amplitude (270°)
    center = oev.EPoint(256.0, 256.0)
    wedge = oev.EWedge(center, 50.0, -25.0, 0.0, 270.0)
    wedge_gauge.Wedge = wedge
    # Measure
    wedge_gauge.Measure(src_image)
    # Get the inner and outer radius of the fitted wedge
    innerRadius = wedge_gauge.MeasuredWedge.InnerRadius
    outerRadius = wedge_gauge.MeasuredWedge.OuterRadius
    # Save the point gauge measurement context
    wedge_gauge.Save("myWedgeGauge.gge")