# Minimum Circle

This function block finds and draws the smallest enclosing circle around a provided shape (contour) and returns the circle's center and radius along with a visual result image. It is useful for estimating object size, position, or for simple shape-based measurements.

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

`Image Any`\
The image used as the drawing surface and visual reference for the result. A copy of this image will be returned with the detected circle overlaid.

`Contour`\
A shape (contour) that defines the object to enclose. This typically comes from a contour detection or shape-extraction block.

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

`Image`\
A copy of the input image with the minimum enclosing circle drawn on it.

`Center`\
The center position of the enclosing circle (x, y). Use this value for alignment, measurements, or further geometric operations.

`Radius`\
The radius of the enclosing circle. Useful for size estimation, thresholds, or triggering downstream logic.

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

This block has no interactive controls—just provide the required input sockets and it will produce the outputs when run.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

When the block runs it accepts a contour and an image. It computes the smallest circle that fully encloses the contour, draws that circle onto a copy of the provided image, and outputs the annotated image together with the circle's center and radius. The block expects a valid contour input; if no contour is provided, the result will be empty or unchanged.

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

* Produces a visual result image with the enclosing circle drawn for easy verification.
* Returns numeric geometric outputs (`Center`, `Radius`) that can be used by downstream blocks for measurement or logic.
* Lightweight and fast—suitable for real-time pipelines when contours are available.
* Works with any contour-producing block; no additional parameters are required.

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

1. Provide a contour to the `Contour` input — typically the result from a contour detector or shape extractor.
2. Provide an image to the `Image Any` input for visualization.
3. Run the scenario; the block will output the annotated image and the circle properties.

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

* To obtain contours, use the `Find Contour` or `Find Object` blocks before this block.
* If the contour is irregular or too detailed, use `Approximate Contour` to simplify the shape before feeding it into this block — this can produce a more meaningful enclosing circle for noisy contours.
* Crop to a region of interest with `Image ROI Select` or `Image ROI` to speed up processing and avoid unrelated contours.
* Preprocess the image with `Blur` or `Image Threshold` to improve contour detection quality upstream.
* Visualize or annotate final results using `Draw Rectangle`, `Draw Result On Image`, or send the result to `Show Image` for a larger viewer window.
* Use the numeric outputs (`Center`, `Radius`) with measurement or logic blocks (for example to compare sizes, to trigger alerts, or to store values).

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

* No circle appears: ensure a valid contour is provided. Use a contour-producing block such as `Find Contour` and verify the contour is not empty.
* Circle seems too large or too small: try simplifying the contour with `Approximate Contour` or refine contour detection by adjusting upstream preprocessing (e.g., `Image Threshold`, `Blur`).
* Unexpected results on noisy images: crop the area of interest with `Image ROI Select` and filter noise first.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/detections-shapes/shape-analysis/minimum-circle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
