# Check Area (Polygon)

This function block allows users to interactively define a polygonal area on an image and check whether specified points fall within that area. It provides visualization tools for drawing and managing coordinates on the image.

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

`Input Image` The image in which you will define a polygon and check point locations.

`Position Coordinate List` A list of coordinates (points) that will be checked against the defined polygon.

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

`Output Image` The original image with the defined polygon area highlighted.

`Polygon Coordinates` The coordinates of the defined polygon.

`Object In Area` A boolean indicating whether any of the specified points fall inside the polygon.

`Detected Positions` The coordinates of the points that fall within the defined polygon area.

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

`Mouse Clicks` Use left mouse clicks to draw points that form the polygon; press `C` to clear the points or `U` to undo the last added point.

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

`Interactive Polygon Drawing` Users can easily define polygonal areas on the image using mouse clicks.

`Real-Time Feedback` The image is updated in real-time to reflect the currently defined polygon and detected points.

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

1. **Connect Input Image**: Provide an image to the `Input Image` input of the block.
2. **Define Polygon**: Click on the image to create points that form the vertices of the polygon.
3. **Check Points**: Connect points to the `Position Coordinate List` to check if they lie within the defined polygon.
4. **Clear or Undo Points**: Use the `C` key to clear all points or `U` to undo the last point added.

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

When executed, this block will check if the provided points are inside the drawn polygon and return the modified image, along with polygon coordinates and detection results.

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

<details>

<summary>Point Precision</summary>

Ensure that the points added to define the polygon are as precise as necessary for your application, as they directly impact the area checked against the specified coordinates.

</details>

<details>

<summary>Polygon Complexity</summary>

For complex shapes, create additional points as necessary. The more points you add, the more accurately the polygon shape will represent your intended area.

</details>

<details>

<summary>Overlay Transparency</summary>

Adjust the `alpha` value in the code to change the transparency of the overlaying polygon in the output image.

</details>

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

<details>

<summary>No Points Detected Inside</summary>

If no points are detected inside the polygon, verify that the points used are indeed within the defined area. Double-check the coordinates for accuracy.

</details>

<details>

<summary>Polygon Not Appearing</summary>

If the polygon does not appear upon clicking, ensure that the mouse events are being registered properly. Verify that the input image is correctly connected.

</details>
