Skip to content

Commit 2cdec2c

Browse files
feat: implement GeometricSymmetry feature for skeletal spatial symmetry analysis
1 parent 15e4e63 commit 2cdec2c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pyeyesweb/low_level/geometric_symmetry.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ def compute(self, frame_data: np.ndarray, **kwargs) -> GeometricSymmetryResult:
106106
# Calculate instantaneous Euclidean distance
107107
error = np.linalg.norm(left_joint - reflected_right)
108108

109+
# Scale-invariant normalization via Triangle Inequality:
110+
# max possible distance between L and R' is ||L|| + ||R'|| = ||L|| + ||R||
111+
norm_l = np.linalg.norm(left_joint)
112+
norm_r = np.linalg.norm(right_joint)
113+
normalized_error = error / (norm_l + norm_r + self.EPSILON)
114+
109115
pair_key = f"{left_idx}_{right_idx}"
110-
pair_errors[pair_key] = float(1.0 - error)
116+
pair_errors[pair_key] = float(max(0.0, 1.0 - normalized_error))
111117

112118
return GeometricSymmetryResult(is_valid=True, pairs=pair_errors)

0 commit comments

Comments
 (0)