xg_clip_contours — 2D xldgeom op

• Data kinds: contour → contour

• Call: fullseye.apply(img, "xg_clip_contours", a=0.5, b=0.5) (the 2-D model is one image plus two scalar knobs a,b∈[0,1])

xg_clip_contours: input → output

*The figure is the actual output on a synthetic 128×128 input. Left: input, right: output. Point clouds are drawn as a top-down scatter (brightness = z), 1-D series as a line plot, volumes as the maximum-intensity projection along z, videos as the middle frame, complex images as magnitude; return values that are not pictures are shown as the values themselves.*

Sweeping knob a (0.1 / 0.5 / 0.9, the other knob at its default):

▸ xg_clip_contours: knob a sweep (docs site)

*Knob b does not change the output (measured: identical at 0.1 / 0.5 / 0.9).*

Stages (the ops that come before → this op, left to right):

▸ xg_clip_contours: stages (docs site)

On other images (synthetic scene / photo / coins. Top row: inputs, bottom row: their outputs. Knobs at default):

▸ xg_clip_contours: other inputs (docs site)

Usage

Drop contours whose polyline length is below a * max-length (a in [0,1]).

Computes the polyline length of each contour (sum of Euclidean distances between adjacent points) and, relative to the length L_max of the longest contour, keeps only contours satisfying length >= a * L_max. a is clipped to [0,1]; a=0 keeps all contours, and a=1 keeps only the longest contour (several if equally long). b is unused.

Returns a contour dict in the same {"shape", "cs"} format as the input (point arrays are copied). If there are no contours, cs is empty. If L_max <= 1e-12 (every contour is 1 point), all contours are returned unchanged. Because the threshold is "relative to the longest contour" rather than to the image size, the selection criterion moves when the longest contour changes (to select by an absolute point count, use select_contours_xld). Unlike the rectangular cutting the name suggests, it is selection by length (cutting with a rectangle is xg_crop_contours / hx_clip_contours). The duplicated end point of closed contours is included in the length, but as an edge of length 0 it has no effect.

Detailed usage guide

• gallery2d_geometry family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Try it in Studio

The program below has been verified to run (same input as the figure). In Studio's help this block becomes buttons that load and run it on the spot.

threshold 0.50 0.50
sk_find_contours 0.50 0.50
xg_clip_contours 0.50 0.50

▸ Load this pipeline  ·  Load & run

Runnable examples (verified samples that actually call this op)

• gallery2d_geometry — py -3.11 examples/gallery2d_geometry.py

Ops the type connects to (they accept contour as input)

identity · select_contours · smooth_contours · fit_line_contours · contours_to_region · count_contours · total_length · select_contours_xld

Same category (xldgeom)

xg_moments · xg_area_center · xg_eccentricity · xg_orientation · xg_elliptic_axis · xg_height_width_ratio · xg_regress_contours · xg_gen_polygons


*Provenance: ops.py — 2D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.