edges_sub_pix — 2D contour op

• Data kinds: image → contour

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

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

• GPU: yes (mechanical GPU path from the allow-list, CuPy). device="auto" chooses the GPU from the measured size (4,194,304 pixels) up

edges_sub_pix: 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):

▸ edges_sub_pix: knob a sweep (docs site)

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

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

▸ edges_sub_pix: other inputs (docs site)

*The 4th column is a colour (H,W,3) input. This op handles colour without crossing channels (it does not convolve the colour channel as a third spatial axis).*

Usage

Sub-pixel-accurate edge contour extraction. Computes the gradient and its normal direction (gradient_normals), thins it to one pixel by non-maximum suppression (as in Canny: only pixels stronger than both neighbours along the normal), links the pixels above the threshold (0.15+0.5*a, strength normalised by the maximum gradient) into contours ordered along the curve (split into separate contours at branch points; a closed edge is closed at its start point), and refines each point along the normal to sub-pixel position by parabola fitting (subpixel_refine_edges, an implementation shared with the same-named op on the ops side -- a 2026-09-02 fix made it genuinely sub-pixel; the old implementation returned integer pixel coordinates). Equivalent to HALCON's edges_sub_pix (Extract sub-pixel precise edges using Deriche, Lanser, Shen, or Canny filters.).

The points of each contour are in order along the curve (neighbouring points about 1 px apart), so length_xld measures the length of the edge and area_center_xld / circularity_xld the shape enclosed by a closed edge (a disc with r = 18 px gives length_xld about 113 px = 2πr).

★Until 2026-11-03 the pixels of the 2–3 px wide band above the threshold were put into one contour in raster order — the same disc gave length_xld 2508 px (the points zig-zagged row by row). Quantities that do not depend on point order (line fits such as fit_line_contour_xld) stay close to their earlier values.

a sets the edge-strength threshold. b is unused.

Raises:

FsValueError: an image containing NaN / inf.

Detailed usage guide

• gallery2d_contour_measure 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.

edges_sub_pix 0.50 0.50

▸ Load this pipeline  ·  Load & run

Runnable examples (verified samples that actually call this op)

• gallery2d_contour_measure — py -3.11 examples/gallery2d_contour_measure.py

• quickstart — py -3.11 examples/quickstart.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 (contour)

select_contours · smooth_contours · fit_line_contours · contours_to_region · sk_find_contours · lines_gauss · select_contours_xld · smooth_contours_xld


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