# Double Thresholding

This code snippet shows how to perform a thresholding operation based on low and high threshold values.

## 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);
// Double thresholding, low threshold = 50, high threshold = 150,
// pixels below 50 become black, pixels above 150 become white,
// pixels between thresholds become gray
EasyImage::DoubleThreshold(&srcImage, &dstImage, 50, 150, 0, 128, 255);
```

#### SEE ALSO
[`EasyImage::DoubleThreshold`](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a2a224c0765addcb26073a721571da48d) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a08f4bdaca7cad63ab81d4c16ce161b93) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#ae759f1761e42e4970b80895e723912f2)

## 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);
// Double thresholding, low threshold = 50, high threshold = 150,
// pixels below 50 become black, pixels above 150 become white,
// pixels between thresholds become gray
EasyImage.DoubleThreshold(srcImage, dstImage, 50, 150, 0, 128, 255);
```

#### SEE ALSO
[`EasyImage.DoubleThreshold`](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a08f4bdaca7cad63ab81d4c16ce161b93) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a2a224c0765addcb26073a721571da48d) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#ae759f1761e42e4970b80895e723912f2)

## Python

```py
import eVision
# Images constructor
src_image = eVision.EImageBW8()
dst_image = eVision.EImageBW8()
# ...
# Source and destination images must have the same size
dst_image.SetSize(src_image)
# Double thresholding, low threshold = 50, high threshold = 150,
# pixels below 50 become black, pixels above 150 become white,
# pixels between thresholds become gray
eVision.EasyImage.DoubleThreshold(src_image, dst_image, 50, 150, 0, 128, 255)
```

#### SEE ALSO
[`EasyImage.DoubleThreshold`](../../../../../doxygen_python/classeVision_1_1EasyImage.html#ae759f1761e42e4970b80895e723912f2) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a2a224c0765addcb26073a721571da48d) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a08f4bdaca7cad63ab81d4c16ce161b93)
