test(viz): pin arkit max-len behavior change

Review follow-up: make the v2 filter's rejection of legacy 0.707
diagonal fixtures explicit instead of silently retuned, and document
the close-up caveat on max_len (ARKIT_BONE_MAX raises it live).
This commit is contained in:
L'électron rare
2026-07-02 10:37:02 +02:00
parent 039abaa4a8
commit 0a4f51ebfb
2 changed files with 16 additions and 0 deletions
+3
View File
@@ -23,6 +23,9 @@ def arkit_segments(arr2d, valid, parents, max_len: float = 0.5, bounds: float =
parents: parent index per joint (-1 = root).
max_len: maximum bone length in normalized units; bones longer than this
are skipped (garbage coords during ARKit tracking loss).
Caveat: on an extreme close-up (subject filling the frame) a
legit bone can approach 0.5 — raise ARKIT_BONE_MAX live if
the skeleton visibly loses bones when very near the camera.
bounds: margin outside [0,1] that is still accepted; endpoints outside
[-bounds, 1+bounds] in x or y are rejected.
"""
@@ -80,3 +80,16 @@ def test_segments_in_bounds_endpoint_passes():
parents = [-1, 0]
segs = arkit_segments(arr2d, valid, parents, bounds=0.1)
assert len(segs) == 1
def test_segments_legacy_diagonal_bone_now_filtered():
"""Regression pin: the pre-filter test fixtures used a full-diagonal
bone (0,0)->(0.5,0.5), length ~0.707. The max_len=0.5 default now
REJECTS it — this is the intended behavior change of the v2 filter,
made explicit here instead of silently retuning old fixtures."""
arr2d = [(0.0, 0.0), (0.5, 0.5)]
valid = [True, True]
parents = [-1, 0]
assert arkit_segments(arr2d, valid, parents) == []
# ...and the env-tunable knob restores it for close-up shots.
assert len(arkit_segments(arr2d, valid, parents, max_len=0.8)) == 1