# Fill Contour

This function block allows you to fill the inside or outside of a specified contour in an image, enabling effective shape analysis and manipulation.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Input Image` The image in which you want to fill the specified contour.

`Contour` The coordinates of the contour that defines the area to fill. This must consist of at least two points.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Output Image` The image after the specified contour has been filled according to user settings.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Fill Inside` A checkbox that lets you specify whether to fill the area inside the contour or outside it. By default, it is checked to fill the inside.

## 🎨 Features <a href="#features" id="features"></a>

`Contour Filling` The block can be used to fill either the inside or outside of a given contour, enhancing image processing tasks.

`Dynamic Contour Handling` The block handles both rectangular contours defined by two points and arbitrary contours defined by multiple points.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. **Connect Input**: Provide an image to the `Input Image` input and the contour points to the `Contour` input.
2. **Select Filling Option**: Use the `Fill Inside` checkbox to choose whether to fill within the contour (checked) or outside the contour (unchecked).
3. **Evaluate**: Execute the block to fill the specified area in the image, and the modified image will be output.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When executed, this function block will return an image filled according to the contour specifications and user's choice of filling direction.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

<details>

<summary>Using Accurate Contours</summary>

Ensure that your contours are defined correctly and are continuous. You may want to utilize other analytical blocks like `Find Contour` to refine your contours before using this block.

</details>

<details>

<summary>Dynamic Applications</summary>

Consider using this block alongside other processing blocks like `Image Threshold` or `Blur` to improve the quality of the contours drawn before filling.

</details>

<details>

<summary>Experimenting with Different Shapes</summary>

Shapes can be combined by passing multiple contours for advanced filling operations. Make sure to carefully manage the input to produce desired results.

</details>

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

<details>

<summary>Invalid Contour Data Error</summary>

If you receive an error stating that the contour must have at least two points, verify that at least two valid points are provided in the contour array.

</details>

<details>

<summary>Filling Not Working as Expected</summary>

Ensure that the checkbox reflecting your desired filling option (inside or outside) is set correctly and that the contour is properly defined without any discontinuities.

</details>
