Detect Scratches

using Euresys.Open_eVision;

static partial class Snippet
{
  static void ESpotDetector_DetectScratches()
  {
    ////////////////////////////////////////////////////
    // This code snippet shows how to detect scratches//
    // in an image with EasySpotDetector              //
    ////////////////////////////////////////////////////

    // Image constructor
    EImageBW8 srcImage = new EImageBW8();

    // Spot detector constructor
    ESpotDetector detector = new ESpotDetector();

    // Setup the scratch detector parameters with adequate values
    EScratchDetectionParameters detectionParams;
    detectionParams.Polarity = ESpotPolarity.White;
    detectionParams.Threshold = 5;
    detectionParams.NominalWidth = 14;
    detectionParams.MinLength = 500;
    detector.ScratchDetectionParameters = detectionParams;

    // Activate the scratch detection only
    detector.EnableParticleDetection = false;
    detector.EnableScratchDetection = true;

    // Perform the detection and get the number of detected spots
    uint nSpot = detector.Detect(srcImage);

    // Finally, get the detected spots
    ESpot[] spots = detector.Spots;
  }
}
#include <Open_eVision.h>

void DetectScratches()
{
  ////////////////////////////////////////////////////
  // This code snippet shows how to detect scratches//
  // in an image with EasySpotDetector              //
  ////////////////////////////////////////////////////
  using namespace Euresys::Open_eVision;

  // Image constructor
  EImageBW8 srcImage;

  // Spot detector constructor
  ESpotDetector detector;

  // Setup the scratch detector parameters with adequate values
  EScratchDetectionParameters detectionParams;
  detectionParams.Polarity = ESpotPolarity_White;
  detectionParams.Threshold = 5;
  detectionParams.NominalWidth = 14;
  detectionParams.MinLength = 500;
  detector.SetScratchDetectionParameters(detectionParams);

  // Activate the scratch detection only
  detector.SetEnableParticleDetection(false);
  detector.SetEnableScratchDetection(true);

  // Perform the detection and get the number of detected spots
  int32_t nSpot = detector.Detect(srcImage);

  // Finally, get the detected spots
  std::vector<ESpot> spots = detector.GetSpots();
}
def ESpotDetector_DetectScratches():
    #####################################################
    ## This code snippet shows how to detect scratches ##
    ## in an image with EasySpotDetector.              ##
    #####################################################

    import open_evision as oev

    # Image constructor
    srcImage = oev.EImageBW8()

    # QR code reader constructor
    detector = oev.ESpotDetector()

    # Setup the particle detector parameters with adequate values
    detectionParams = oev.EScratchDetectionParameters()
    detectionParams.Polarity = oev.ESpotPolarity.White
    detectionParams.Threshold = 5
    detectionParams.NominalWidth = 14
    detectionParams.MinLength = 500
    detector.ScratchDetectionParameters = detectionParams

    # Activate the scratch detection
    detector.EnableParticleDetection = False
    detector.EnableScratchDetection = True

    # Perform the detection and get the number of detected spots
    nSpot = detector.Detect(srcImage)

    # Finally, get the detected spots
    spots = detector.Spots