split example visualizaiton pipeline
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from orisys.unroll.geometry import (
|
||||
resolve_uv_runtime_sizes,
|
||||
scale_camera_geometry,
|
||||
scaled_map_cache_path,
|
||||
)
|
||||
|
||||
|
||||
def test_scale_camera_geometry_halves_intrinsics_and_size():
|
||||
k = np.array([[1000.0, 0.0, 640.0], [0.0, 1000.0, 360.0], [0.0, 0.0, 1.0]])
|
||||
k_scaled, w, h = scale_camera_geometry(k, 1280, 720, 0.5)
|
||||
assert w == 640
|
||||
assert h == 360
|
||||
assert k_scaled[0, 0] == pytest.approx(500.0)
|
||||
assert k_scaled[1, 1] == pytest.approx(500.0)
|
||||
assert k_scaled[0, 2] == pytest.approx(320.0)
|
||||
assert k_scaled[1, 2] == pytest.approx(180.0)
|
||||
|
||||
|
||||
def test_resolve_uv_runtime_sizes_from_work4():
|
||||
out_w, out_h, scale = resolve_uv_runtime_sizes(
|
||||
{
|
||||
"resolution_stitch": [280, 300],
|
||||
"work4": [280, 300, 4, 0.4],
|
||||
}
|
||||
)
|
||||
assert (out_w, out_h, scale) == (280, 300, 0.4)
|
||||
|
||||
|
||||
def test_scaled_map_cache_path_suffix():
|
||||
assert scaled_map_cache_path("unroll_map_uv.npz", 0.4) == "unroll_map_uv_s0.4.npz"
|
||||
assert scaled_map_cache_path("unroll_map_uv.npz", 1.0) == "unroll_map_uv.npz"
|
||||
Reference in New Issue
Block a user