Find Contour

This function block detects and selects contours in a grayscale image. Use it to locate shapes, get their position, area, rotation, and preview the selected contour on the image. Adjustable area limits and approximation methods help you filter and refine results.

πŸ“₯ Inputs

Image Gray Input grayscale image used for contour detection (single-channel image).

πŸ“€ Outputs

Selected Contour The chosen contour (shape) based on selection or automatic selection.

Contours A list of all detected contours that passed filtering.

Contour Image Preview image with the selected contour drawn and center marked.

Object Position The center (x, y) position of the selected contour.

Object Rotation The orientation angle of the selected contour (degrees).

Object Area The area value of the selected contour (pixel units).

Object Count Number of contours found after filtering.

πŸ•ΉοΈ Controls

Minimum Contour Area (%) A horizontal range slider to set minimum and maximum contour area as percentages of the image area; contours outside this range are ignored.

Approximation Method A dropdown to choose contour approximation strategy (affects contour detail vs. simplification).

Contour Selection A dropdown that lists detected contours (with area percentages) so you can pick one for inspection or measurement.

🎨 Features

  • Visual preview of the selected contour with center marker and drawn contour lines.

  • Area-based filtering to ignore very small or excessively large shapes.

  • Multiple approximation options to control contour detail and smoothing.

  • Outputs both geometry (shape, center, angle, area) and a list of all validated contours.

  • Automatic guarding against overwhelming results by limiting the number of processed contours for performance.

βš™οΈ How it runs

When executed, the block analyzes the supplied grayscale image, detects contours, filters them by the configured area range, sorts them by size, and makes a selected contour available for inspection. The preview image shows the selected contour and its center, and the block exports numeric and shape data for further processing.

πŸ’‘ Tips and Tricks

  • Preprocess images with Image Threshold, Image Adaptive Threshold, or Blur to improve contour detection on noisy inputs.

  • Use Image ROI Select or Image ROI to crop the area of interest before running this block to avoid irrelevant contours.

  • Pair with Approximate Contour, Minimum Rectangle, Minimum Ellipse, or Minimum Circle to derive simpler geometric representations from the selected contour.

  • Use Translate Shape to shift detected shapes into a common coordinate frame when combining multiple inputs.

  • Visualize or annotate results using Draw Rectangle, Draw Result On Image, or Draw Detections for clearer UI overlays.

  • If you need polygonal areas as inputs or to limit analysis, combine with Image ROI Polygon or Image ROI Polygon Multi.

  • Log images or results using Image Logger, Image Write, or export numeric data with CSV Export / Data to JSON.

  • Combine with Find Object (template matching) or Feature Detector to perform finer object identification after rough contour filtering.

  • For quality control systems, connect downstream to Measure Object Distance, Check Area, or Rectangles in Rectangle to implement pass/fail logic.

πŸ› οΈ Troubleshooting

  • If no contours are found, widen the Minimum Contour Area (%) range or improve input contrast with Auto Contrast or Denoising.

  • If many small spurious contours appear, increase the minimum area or apply Image Threshold / Blur to remove noise.

  • If contours appear too detailed, choose a simpler Approximation Method to reduce vertex count and simplify shape outputs.

Last updated

Was this helpful?