piv_outlier_mask — PIV validate op

• Data kinds: flow2d → mask

• Call: import fullseye as fs; fs.ledger.piv_outlier_mask(flow, threshold=2.0, epsilon=0.1) (to call the implementation directly, import pivops; pivops.piv_outlier_mask(flow, threshold=2.0, epsilon=0.1); from the registry, opspiv.get("piv_outlier_mask"))

Usage

Finds outlier vectors with the normalised median test (Westerweel & Scarano 2005).

For each vector, the residual from the median of its 8 neighbours is divided by the median of the neighbours' residuals. epsilon (default 0.1 px, a rough measure of PIV measurement uncertainty) is added to the denominator to prevent the denominator from becoming 0 in a uniform field and everything becoming an outlier —— without this term, the more ideal the input, the more the test breaks.

★It does harm in fields with steep gradients (measured 2026-09-06). Running multi-pass PIV on a Rankine-type vortex (core radius 28 px), the 5 vectors picked by threshold 2 all lay on the edge of the core (32 px from the centre), and their actual errors were 0.07-0.45 px —— not outliers but places where the velocity profile has a kink. Smoothing with the neighbour median worsens the RMS from 0.134 to 0.230 (threshold 5 picks none and stays at 0.134).

The test rests on the assumption "different from the neighbours = wrong", so it calls a genuine discontinuity an error. Decide whether to apply it by looking at the nature of the field.

Args:

flow: (2, h, w).

threshold: an outlier if this value is exceeded. 2 is customary.

epsilon: offset of the denominator [px].

Returns:

bool of (h, w). True is an outlier (nan is also True).

Detailed usage guide

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

Runnable examples (verified samples that actually call this op)

• piv_flow_from_particles — py -3.11 examples/piv_flow_from_particles.py

• poc_change_detection_misreg — py -3.11 examples/poc_change_detection_misreg.py

• poc_river_surface_velocity — py -3.11 examples/poc_river_surface_velocity.py

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

piv_replace_outliers

Same category (validate)

piv_replace_outliers


*Provenance: pivops.py — PIV 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.