# Performing an Inverse Warping

This code snippet shows how to unwarp a straight rectangle into a straight ring-wedge shape.

## C++

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

```cpp
using namespace eVision;
EImageBW8 img;
img.Load("...");

// sampling of the ring
int numberOfRadialSampledPoints = 400;
int numberOfTangentSampledPoints = 800;

// prepare the LUT, the size of WarpX and WarpY are set automatically
// numerical parameters must be changed depending on the context
EImageBW16 WarpX;
EImageBW16 WarpY;
EasyImage::SetInvCircleWarp(1000, 1000, numberOfRadialSampledPoints, 103, 455, numberOfTangentSampledPoints, 0, 221, &WarpX, &WarpY);

// allocate and clear the destination image
EImageBW8 imgWarped(WarpX.GetWidth(), WarpX.GetHeight());
EasyImage::Oper(EArithmeticLogicOperation_Copy, EBW8(0), &imgWarped);

// perform the transformation
EasyImage::Warp(&img, &imgWarped, &WarpX, &WarpY);
```

## C#

```cs
using eVision;
```

```cs
// Load Image
EImageBW8 img = new EImageBW8();
img.Load("...");

// sampling of the ring
int numberOfRadialSampledPoints = 400;
int numberOfTangentSampledPoints = 800;

// prepare the LUTs, the size of WarpX and WarpY are set automatically
// numerical parameters must be changed depending on the context
EImageBW16 WarpX = new EImageBW16();
EImageBW16 WarpY = new EImageBW16();
EasyImage.SetInvCircleWarp(1000, 1000, numberOfRadialSampledPoints, 103, 455, numberOfTangentSampledPoints, 0, 221, WarpX, WarpY);

// allocate and clear the destination image
EImageBW8 imgWarped = new EImageBW8(WarpX.Width, WarpX.Height);
EBW8 background = new EBW8(0);
EasyImage.Oper(EArithmeticLogicOperation.Copy, background, imgWarped);

// perform the transformation
EasyImage.Warp(img, imgWarped, WarpX, WarpY);
```

## Python

```py
import eVision

# Load Image
img = eVision.EImageBW8()
img.Load("...")

# sampling of the ring
numberOfRadialSampledPoints = 400
numberOfTangentSampledPoints = 800

# prepare the LUTs, the size of WarpX and WarpY are set automatically
# numerical parameters must be changed depending on the context
WarpX = eVision.EImageBW16()
WarpY = eVision.EImageBW16()
eVision.EasyImage.SetInvCircleWarp(1000, 1000, numberOfRadialSampledPoints, 103, 455, numberOfTangentSampledPoints, 0, 221, WarpX, WarpY)

# allocate and clear the destination image
imgWarped = eVision.EImageBW8(WarpX.Width, WarpX.Height)
eVision.EasyImage.Oper(eVision.EArithmeticLogicOperation.Copy, eVision.EBW8(0), imgWarped)

# perform the transformation
eVision.EasyImage.Warp(img, imgWarped, WarpX, WarpY)
```
