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

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

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

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

⚙️ Running mechanism

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

  • 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

  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

  • 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

  • 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.

Last updated

Was this helpful?