# Single Thresholding

This code snippet shows how to perform minimum residue thresholding, absolute thresholding and relative thresholding operations.

## C++

```cpp
#include <eVision/EasyImage/EasyImage.h>
```

```cpp
using namespace eVision;
// Images constructor
EImageBW8 srcImage;
EImageBW8 dstImage;
// ...
// Source and destination images must have the same size
dstImage.SetSize(&srcImage);
// Minimum residue thresholding (default method)
EasyImage::Threshold(&srcImage, &dstImage);
// Absolute thresholding (threshold = 110)
EasyImage::Threshold(&srcImage, &dstImage, 110);
// Relative thresholding (70% black, 30% white)
EasyImage::Threshold(&srcImage, &dstImage, EThresholdMode_Relative, 0, 255, 0.7f);
```

#### SEE ALSO
[`EBaseROI::SetSize`](../../../../../doxygen_cpp/classeVision_1_1EBaseROI.html#a8446337051c589320cfd2ea1fcbe6d16) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EBaseROI.html#a87cfe59bbf851719b3f65d6766f71dba) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EBaseROI.html#a43f0fddfd46389cc8b95d9ccb608a909), [`EasyImage::Threshold`](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#ac6f69c1aac9510ac6cd639acb27979ee) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#ae13e71e4c82873cb82b2b72bb9fb1b7e) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a0b095d913c4676c6c3be8f73e4c06dea)

## C#

```cs
using eVision;
```

```cs
// Images constructor
EImageBW8 srcImage = new EImageBW8();
EImageBW8 dstImage = new EImageBW8();
// ...
// Source and destination images must have the same size
dstImage.SetSize(srcImage);
// Minimum residue thresholding (default method)
EasyImage.Threshold(srcImage, dstImage);
// Absolute thresholding (threshold = 110)
EasyImage.Threshold(srcImage, dstImage, 110);
// Relative thresholding (70% black, 30% white)
EasyImage.Threshold(srcImage, dstImage, unchecked((uint)EThresholdMode.Relative), 0, 255, 0.7f);
```

#### SEE ALSO
[`EBaseROI.SetSize`](../../../../../doxygen_cs/classeVision_1_1EBaseROI.html#a87cfe59bbf851719b3f65d6766f71dba) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EBaseROI.html#a8446337051c589320cfd2ea1fcbe6d16) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EBaseROI.html#a43f0fddfd46389cc8b95d9ccb608a909), [`EasyImage.Threshold`](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#ae13e71e4c82873cb82b2b72bb9fb1b7e) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#ac6f69c1aac9510ac6cd639acb27979ee) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a0b095d913c4676c6c3be8f73e4c06dea)

## Python

```py
import eVision
# Image constructors
src_image = eVision.EImageBW8()
dst_image = eVision.EImageBW8()
# ...
# Source and destination images must have the same size
dst_image.SetSize(src_image)
# Minimum residue thresholding (default method)
eVision.EasyImage.Threshold(src_image, dst_image)
# Absolute thresholding (threshold = 110)
eVision.EasyImage.Threshold(src_image, dst_image, 110)
# Relative thresholding (70% black, 30% white)
eVision.EasyImage.Threshold(src_image, dst_image, eVision.EThresholdMode.Relative, 0, 255, 0.7)
```

#### SEE ALSO
[`EBaseROI.SetSize`](../../../../../doxygen_python/classeVision_1_1EBaseROI.html#a43f0fddfd46389cc8b95d9ccb608a909) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EBaseROI.html#a8446337051c589320cfd2ea1fcbe6d16) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EBaseROI.html#a87cfe59bbf851719b3f65d6766f71dba), [`EasyImage.Threshold`](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a0b095d913c4676c6c3be8f73e4c06dea) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#ac6f69c1aac9510ac6cd639acb27979ee) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#ae13e71e4c82873cb82b2b72bb9fb1b7e)
