<a id="easyspotdetector"></a>

# EasySpotDetector - Detecting Spots with Deep Learning

![EasySpotDetector](assets/images/easyspotdetector/illu_spot_1.webp)

#### WARNING
Please note that **EasySpotDetector** is deprecated and will be removed in release 27.6.

<a id="easyspotdetector-purpose"></a>

## Purpose

**EasySpotDetector** uses local segmentation to extract salient objects from the background, then a deep learning classifier can sort them. It is applicable to many materials like films, coated surfaces, steel, battery foils, glass…

* Detection of faint defects and contamination, even in noisy images.
* Fast processing for in-line inspection.
* Compatible with acquisition from line-scan and 2D cameras.
* Optional pre-alignment of the region of interest on the part edges.
* Optional deep learning classification of the defects.

<a id="easyspotdetector-quickstart"></a>

## Detecting Spots

To detect particles in an image:

* Create an [`ESpotDetector`](../../../doxygen_cpp/classeVision_1_1ESpotDetector.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESpotDetector.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESpotDetector.html) object and configure the detection parameters.
* Call [`ESpotDetector::Detect`](../../../doxygen_cpp/classeVision_1_1ESpotDetector.html#a3416d67167a4f86aeecb64a69e321004) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESpotDetector.html#a4be1466b4dae59820add60859175c382) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESpotDetector.html#a14f79385bca052894516514e59bc0c1d).
* Retrieve the detected [`ESpot`](../../../doxygen_cpp/classeVision_1_1ESpot.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESpot.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESpot.html) objects with [`ESpotDetector::GetSpots`](../../../doxygen_cpp/classeVision_1_1ESpotDetector.html#a09da2a19b74a2d9a4cd5c3ca8d74fa5f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ESpotDetector.html#a1b2f6cb968fcc5cdb2d7862561f91c96) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ESpotDetector.html#ac8165774f7cca1072ab8b6207b2156df).

### C++

```cpp
#include <eVision/EasySpotDetector/ESpotDetector.h>
```

```cpp
using namespace eVision;

// Image constructor
EImageBW8 srcImage;

// Spot detector constructor
ESpotDetector detector;

// Setup the particle detector parameters with adequate values
EParticleDetectionParameters detectionParams;
detectionParams.Polarity = ESpotPolarity_Black;
detectionParams.Threshold = 12;
detectionParams.MinSize = 5;
detectionParams.MaxSize = 50;
detectionParams.MinArea = 25;
detector.SetParticleDetectionParameters(detectionParams);

// Activate the particle detection
detector.SetEnableParticleDetection(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();
```

### C#

```cs
using eVision;
```

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

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

// Setup the particle detector parameters with adequate values
EParticleDetectionParameters detectionParams;
detectionParams.Polarity = ESpotPolarity.Black;
detectionParams.Threshold = 12;
detectionParams.MinSize = 5;
detectionParams.MaxSize = 50;
detectionParams.MinArea = 25;
detector.ParticleDetectionParameters = detectionParams;

// Activate the particle detection
detector.EnableParticleDetection = 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;
```

### Python

```py
import eVision

# Image constructor
srcImage = eVision.EImageBW8()

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

# Setup the particle detector parameters with adequate values
detectionParams = eVision.EParticleDetectionParameters()
detectionParams.Polarity = eVision.ESpotPolarity.Black
detectionParams.Threshold = 12
detectionParams.MinSize = 5
detectionParams.MaxSize = 50
detectionParams.MinArea = 25
detector.ParticleDetectionParameters = detectionParams

# Activate the particle detection
detector.EnableParticleDetection = True

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

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

<a id="easyspotdetector-contents"></a>

## Contents

Alignment, particle and scratch detection, and deep learning classification.

<a id="easyspotdetector-quick-links"></a>

## Quick Links

List of all Classes, Structs and Enumerations of the **EasySpotDetector** library.

Easy to understand, ready to copy code snippets for the **EasySpotDetector** library.

#### SEE ALSO
The `EasySpotDetector` sample program detects particles and scratches and displays the results over the image: [EasySpotDetector](../../../resources/sample_programs/applicative_processing_tools/easyspotdetector.html.md).
