Detect and Classify Spots

This code snippet shows how to detect the spots in a image and submit them in a trained deeplearning classifier.

C++

#include <eVision/EasySpotDetector/ESpotDetector.h>
using namespace eVision;

// Image constructor
EImageBW8 srcImage;

// Spot detector constructor
ESpotDetector detector;

// Setup the scratch detector parameters with adequate values
EParticleDetectionParameters detectionParams(ESpotPolarity_Any, 12, 5, 50, 25);
detector.SetParticleDetectionParameters(detectionParams);
detector.SetEnableParticleDetection(true);

// Declare a Deep Learning classifier path
// The classifier will be used on all detected spot during the Detect() call
detector.SetDLClassifierPath("...");

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

// Finally, get the detected spots
std::vector<ESpot> spots = detector.GetSpots();

C#

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

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

// Setup the scratch detector parameters with adequate values
detector.ParticleDetectionParameters = new EParticleDetectionParameters(ESpotPolarity.Any, 12, 5, 50, 25);
detector.EnableParticleDetection = true;

// Declare a Deep Learning classifier path
// The classifier will be used on all detected spot during the Detect() call
detector.DLClassifierPath = "...";

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

// Finally, get the detected spots
ESpot[] spots = detector.Spots;

Python

import eVision

# Image constructor
srcImage = eVision.EImageBW8()

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

# Setup the particle detector parameters with adequate values
detector.ParticleDetectionParameters = eVision.EParticleDetectionParameters(eVision.ESpotPolarity.Black, 12, 5, 50, 25)
detector.EnableParticleDetection = True

## Declare a Deep Learning classifier path
## The classifier will be used on all detected spot during the Detect() call
detector.DLClassifierPath = "..."

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

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