Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.stream
Commits
f6956c39
Commit
f6956c39
authored
Aug 19, 2020
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/io/stream/test/data/swir_940_dark_subtract.png
0 → 100644
View file @
f6956c39
429 KB
bob/io/stream/test/test.py
View file @
f6956c39
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment