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, orBlurto improve contour detection on noisy inputs.Use
Image ROI SelectorImage ROIto crop the area of interest before running this block to avoid irrelevant contours.Pair with
Approximate Contour,Minimum Rectangle,Minimum Ellipse, orMinimum Circleto derive simpler geometric representations from the selected contour.Use
Translate Shapeto shift detected shapes into a common coordinate frame when combining multiple inputs.Visualize or annotate results using
Draw Rectangle,Draw Result On Image, orDraw Detectionsfor clearer UI overlays.If you need polygonal areas as inputs or to limit analysis, combine with
Image ROI PolygonorImage ROI Polygon Multi.Log images or results using
Image Logger,Image Write, or export numeric data withCSV Export/Data to JSON.Combine with
Find Object(template matching) orFeature Detectorto perform finer object identification after rough contour filtering.For quality control systems, connect downstream to
Measure Object Distance,Check Area, orRectangles in Rectangleto implement pass/fail logic.
π οΈ Troubleshooting
If no contours are found, widen the
Minimum Contour Area (%)range or improve input contrast withAuto ContrastorDenoising.If many small spurious contours appear, increase the minimum area or apply
Image Threshold/Blurto remove noise.If contours appear too detailed, choose a simpler
Approximation Methodto reduce vertex count and simplify shape outputs.
Last updated
Was this helpful?