xg_area_center — 2D xldgeom op

• Data kinds: contour → feature

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

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

xg_area_center: 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_area_center: stages (docs site)

Usage

Polygon area of the contour(s) via the shoelace formula (summed abs).

Treats each contour of the contour dict {"shape": (H, W), "cs": [Nx2 (row, col) point arrays, ...]} as a polygon, computes its area with the shoelace formula 0.5*|Σ(x_i*y_{i+1} - x_{i+1}*y_i)|, and returns the sum over all contours. Contours with fewer than 3 points are ignored as 0. a, b are unused.

Returns a numpy.float64 (unit pixel², not normalised). Missing contours, input that is not a dict, and contours containing non-finite values are skipped and do not contribute to the sum (0.0 if empty). Note that even an open contour yields the area of the "closed polygon joining the last point to the first" (0 for a straight open contour, but nonzero for an open polyline). Because the absolute value is taken, the orientation of the point sequence (clockwise/counter-clockwise) does not affect the result. For self-intersecting contours, signs cancel at the crossings and the result is smaller than the true area. Despite the name, it does not return the centroid (area only). The 2nd-order moments of the same point set are xg_moments; the aspect ratio of the bbox is xg_height_width_ratio.

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_area_center 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_eccentricity · xg_orientation · xg_elliptic_axis · xg_height_width_ratio · 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.