xg_height_width_ratio — 2D xldgeom op

• Data kinds: contour → feature

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

• HALCON equivalent: height_width_ratio_xld (the HALCON reference is a useful guide to its meaning and parameters)

xg_height_width_ratio: 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.*

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

*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_height_width_ratio: stages (docs site)

Usage

Axis-aligned bounding-box height/width ratio of the point set.

Merges all contour points (excluding the duplicated end point of closed contours) and returns the ratio of the extent in the row direction h = max(row) - min(row) to the extent in the column direction w = max(col) - min(col), h / w. a, b are unused.

Returns a numpy.float64. 0.0 if there are no points. For w < 1e-12 (all points in the same column = a vertical straight line): 1e6 if h > 1e-12, otherwise 0.0. The upper limit is 1e6. Since it uses the axis-parallel bbox, it is not rotation-invariant (an elongated contour tilted by 45° approaches 1). For rotation-invariant elongation, use xg_elliptic_axis / xg_eccentricity. h, w are ranges of point coordinates (distances between pixel centres), 1 less than a pixel-count-based width. With several contours, it is the ratio of the 1 bbox enclosing them all.

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_height_width_ratio 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 feature as input)

identity · feature_to_img

Same category (xldgeom)

xg_moments · xg_area_center · xg_eccentricity · xg_orientation · xg_elliptic_axis · xg_regress_contours · xg_clip_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.