Merge branch 'main' of ssh://892887cvmk08.aicp.io:24928/orisys-tech/orisys-app

This commit is contained in:
ykcheungab
2026-10-10 14:16:03 +08:00
parent f5ba64e01a
commit cf86bd0702
14 changed files with 118 additions and 4 deletions
@@ -280,6 +280,38 @@ def _plate_mode_rgb(pixels: np.ndarray) -> np.ndarray:
return values[int(np.argmax(counts))].astype(float)
def test_depth_threshold_only_changes_depth_colours(gl_widget, qt_app):
from orisys_studio.scene3d.gl_backend import lut_rgba
widget, _, _ = gl_widget
assets = synthetic.poc_scene()
values = np.full(assets.shape_hw, 0.05, dtype=np.float32)
depth = FieldDescriptor("depth_response", "1", "approximate", False)
flow = FieldDescriptor("flow_magnitude", "px", "approximate", False)
def settings(descriptor, threshold):
return DisplaySettings(
housing_visible=False,
depth_threshold=threshold,
color_scale=ColorScale(
descriptor=descriptor, lower=0.0, upper=1.0, lut_id="sequential"
),
)
widget.set_settings(settings(depth, 0.0))
widget.present(_frame(assets, values, descriptor=depth, frame_id=30))
unfiltered = _plate_mean_rgb(_render(widget, qt_app))
widget.set_settings(settings(depth, 0.1))
filtered = _plate_mean_rgb(_render(widget, qt_app))
base = lut_rgba("sequential")[0, 0, :3].astype(float)
assert np.abs(filtered - base).max() < 8.0
assert np.abs(unfiltered - filtered).max() > 10.0
widget.set_settings(settings(flow, 0.1))
widget.present(_frame(assets, values, descriptor=flow, frame_id=31))
assert np.abs(_plate_mean_rgb(_render(widget, qt_app)) - unfiltered).max() < 8.0
def test_a_press_does_not_move_the_surfaces_base_colour(gl_widget, qt_app):
"""The base colour follows the field, not the frame's current response.