Commit f6956c39 authored by Vincent POLLET's avatar Vincent POLLET
Browse files

Merge branch 'subtract_unit_test' into 'master'

Implements unit test for the subtract stream filter

See merge request !6
parents e6b8a269 b6ff6fd6
Pipeline #42134 passed with stages
in 6 minutes and 53 seconds
......@@ -39,6 +39,7 @@ def test_stream():
gt_depth = load(resource_path("test/data/reprojection_depth.png"))
gt_warp_thermal = load(resource_path("test/data/warp_thermal.png"))
gt_warp_swir = load(resource_path("test/data/warp_swir_norm.png"))
gt_swir_940_dark_subtract = load(resource_path("test/data/swir_940_dark_subtract.png"))
landmarks = np.load(resource_path("test/data/landmarks.npy"))
bounding_box = np.load(resource_path("test/data/bounding_box.npy"))
......@@ -51,9 +52,14 @@ def test_stream():
resource_path("config/idiap_face_calibration.json", "bob.ip.stereo"),
)
# stream for stereo and projection tests
color = f.stream("color")
nir_left = Stream("nir_left_stereo").adjust(color)
nir_right = f.stream("nir_right_stereo").adjust(color)
# streams for subtract tests
swir_dark = f.stream("swir")
swir_940 = f.stream("swir_940nm")
# streams for stack, normalize and warp tests
swir_1050 = f.stream("swir_1050nm")
swir_1300 = f.stream("swir_1300nm")
swir_1550 = f.stream("swir_1550nm")
......@@ -65,6 +71,10 @@ def test_stream():
rep_color = color.reproject(nir_left, nir_right, map_3d)
nir_left.set_source(f)
# subtract operations
swir_dark = swir_dark.adjust(color)
swir_940 = swir_940.adjust(color).subtract(swir_dark)
# warp operations
swir_norm = swir_1550.normalize().stack(swir_1300.normalize()).stack(swir_1550.normalize())
warp_swir_norm = swir_norm.warp(color)
......@@ -85,6 +95,9 @@ def test_stream():
assert is_close_enough(gt_depth, depth[0])
assert is_close_enough(gt_color, rep_color[0])
# compare subtract results
assert np.array_equal(swir_940[0][0], gt_swir_940_dark_subtract)
# Compare warp results
assert is_close_enough(warp_swir_norm[0][0], gt_warp_swir)
assert is_close_enough(warp_thermal[0][0], gt_warp_thermal)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment