# Path Sampling

This code snippet shows how to retrieve and store the pixel values along a given path together with the corresponding pixel coordinates.

## C++

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

```cpp
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// ...
// Vector constructor
EBW8PathVector path;
// Path definition
path.Empty();
for (int i = 0; i < 100; i++)
{
  EBW8Path p;
  p.X = i;
  p.Y = i;
  p.Pixel = 128;
  path.AddElement(p);
}
// Get the image data along the path
EasyImage::ImageToPath(&srcImage, &path);
```

#### SEE ALSO
[`EVector::Empty`](../../../../../doxygen_cpp/classeVision_1_1EVector.html#a8e09d7806e6d31ab8259ca8473eb4766) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EVector.html#a4cb4fc6cc6b5e19344b2837b7f98f0f8) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EVector.html#adcb9d6f8c4a6365e81fbecf7744269e7), [`EBW8PathVector::AddElement`](../../../../../doxygen_cpp/classeVision_1_1EBW8PathVector.html#a53eb571da56cddef3f9168d9c56b6a36) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EBW8PathVector.html#a515c018b12a951e6067ff2b458d18ec4) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EBW8PathVector.html#a81b8eafdd0a07f54723f897ebe04a81e), [`EasyImage::ImageToPath`](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a7a20aeb4668c584c840d456070caa420) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a7f15e8d5dfe5662eccbcd2b748e0a55d) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a82e44732dfb13bcf1bad6d9d1affbfb6)

## C#

```cs
using eVision;
```

```cs
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// ...
// Vector constructor
EBW8PathVector path = new EBW8PathVector();
EBW8 bw8 = new EBW8(128);
// Path definition
path.Empty();
for (int i = 0; i < 100; i++)
{
  EBW8Path p;
  p.X = (short)i;
  p.Y = (short)i;
  p.Pixel = bw8;
  path.AddElement(p);
}
// Get the image data along the path
EasyImage.ImageToPath(srcImage, path);
int pixel = path.GetElement(20).Pixel.Value;
```

#### SEE ALSO
[`EVector.Empty`](../../../../../doxygen_cs/classeVision_1_1EVector.html#a4cb4fc6cc6b5e19344b2837b7f98f0f8) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EVector.html#a8e09d7806e6d31ab8259ca8473eb4766) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EVector.html#adcb9d6f8c4a6365e81fbecf7744269e7), [`EBW8PathVector.AddElement`](../../../../../doxygen_cs/classeVision_1_1EBW8PathVector.html#a515c018b12a951e6067ff2b458d18ec4) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EBW8PathVector.html#a53eb571da56cddef3f9168d9c56b6a36) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EBW8PathVector.html#a81b8eafdd0a07f54723f897ebe04a81e), [`EasyImage.ImageToPath`](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a7f15e8d5dfe5662eccbcd2b748e0a55d) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a7a20aeb4668c584c840d456070caa420) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a82e44732dfb13bcf1bad6d9d1affbfb6)

## Python

```py
import eVision
# Image constructor
src_image = eVision.EImageBW8()
# ...
# Vector constructor
path = eVision.EBW8PathVector()
bw8 = eVision.EBW8(128)
# Path definition
path.Empty()
for i in range(100):
    p = eVision.EBW8Path()
    p.X = i
    p.Y = i
    p.Pixel = bw8
    path.AddElement(p)
# Get the image data along the path
eVision.EasyImage.ImageToPath(src_image, path)
pixel = path.GetElement(20).Pixel.Value
```

#### SEE ALSO
[`EVector.Empty`](../../../../../doxygen_python/classeVision_1_1EVector.html#adcb9d6f8c4a6365e81fbecf7744269e7) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EVector.html#a8e09d7806e6d31ab8259ca8473eb4766) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EVector.html#a4cb4fc6cc6b5e19344b2837b7f98f0f8), [`EBW8PathVector.AddElement`](../../../../../doxygen_python/classeVision_1_1EBW8PathVector.html#a81b8eafdd0a07f54723f897ebe04a81e) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EBW8PathVector.html#a53eb571da56cddef3f9168d9c56b6a36) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EBW8PathVector.html#a515c018b12a951e6067ff2b458d18ec4), [`EasyImage.ImageToPath`](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a82e44732dfb13bcf1bad6d9d1affbfb6) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a7a20aeb4668c584c840d456070caa420) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a7f15e8d5dfe5662eccbcd2b748e0a55d)
