Refactor depth reference handling and cleanup

- Unified reference depth calculation to use a single implementation in common/depth.py.
- Removed server-side reference depth computation and adjusted depth.json to only include image_size and intrinsics.
- Updated depth texture handling to ignore transparent, invalid, and non-positive pixels when calculating reference depth.
- Changed reference depth calculation to use the 95th percentile of valid depth values.
- Adjusted depth direction fitting to return a flat direction when no samples are available.
- Removed cleanup threshold parameters from Cutout and related nodes, simplifying the interface.
- Updated tests to verify new reference depth logic and ensure compatibility with existing functionality.
This commit is contained in:
2026-09-15 22:50:16 +08:00
parent 94130ff38f
commit 2dfa9b2add
37 changed files with 665 additions and 639 deletions

View File

@@ -128,8 +128,8 @@ def test_client_processing_updates_and_packs_color_and_depth_together():
depth = Image(depth_values)
metadata = {
"intrinsics": ((8.0, 0.0, 8.0), (0.0, 8.0, 8.0), (0.0, 0.0, 1.0)),
"reference_depth": 12.0,
}
original_metadata = dict(metadata)
pad_cutout_images(color, depth, metadata, content, 0.9, 2)
@@ -139,5 +139,5 @@ def test_client_processing_updates_and_packs_color_and_depth_together():
assert padded_color[2, 8, 3] == 1
assert padded_depth[2, 8, 2] > depth_values[3, 8, 2]
assert padded_depth[2, 8, 0] == 0
assert metadata["reference_depth"] == 12
assert metadata == original_metadata
assert (color.updated, color.packed, depth.updated, depth.packed) == (1, 1, 1, 1)