# ContoursUnit

The `ContoursUnit` class represents a unit that contains contours as intermediate results. It is derived from the `IntermediateResultUnit` class.

## Definition

*Namespace:* Dynamsoft.Core.intermediate_results


```csharp
class ContoursUnit : IntermediateResultUnit
```

## Methods

| Method                    | Description |
|---------------------------|---------------------------------------------|
| [`GetContours`](#getcontours) | Gets the contours.  |
| [`SetContours`](#setcontours) | Sets the contours.  |

### Inherited Methods

Checkout inherited methods from [IntermediateResultUnit](https://www.dynamsoft.com/capture-vision/docs/server/programming/dotnet/api-reference/core/intermediate-results/intermediate-result-unit.md) for more details.

### GetContours

Gets the contours.

```csharp
int GetContours(out Contour[] contours, out Vector4[] hierarchies)
```

**Parameters**

`[out] contours` The contours in the unit.

`[out] hierarchies` The hierarchies of the contours in the unit.

**Return value**

Returns 0 if successful, or an error code if the contour could not be retrieved.

**See Also**

[Contour](https://www.dynamsoft.com/capture-vision/docs/server/programming/dotnet/api-reference/core/basic-classes/contour.md)

[Vector4](https://www.dynamsoft.com/capture-vision/docs/server/programming/dotnet/api-reference/core/basic-classes/vector4.md)

### SetContours

Sets the contours and hierarchies in the unit.

```csharp
int SetContours(Contour[] contours, Vector4[] hierarchies, double[] matrixToOriginalImage = null)
```

**Parameters**

`[in] contours` The contours in the unit.

`[in] hierarchies` The hierarchies in the unit.

`[in] matrixToOriginalImage` The matrix to original image.

**Return Value**

Returns 0 if the operation succeeds, or a nonzero error code if the operation fails.
