Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bob.ip.stereo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.ip.stereo
Commits
ecfe4a99
Commit
ecfe4a99
authored
4 years ago
by
Vincent POLLET
Browse files
Options
Downloads
Patches
Plain Diff
Set epsilon to meaningfull value, clean up
parent
22898b8b
No related branches found
No related tags found
1 merge request
!6
Resolve "In painting has different output based on computer OS"
Pipeline
#41686
passed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/ip/stereo/test/test.py
+9
-19
9 additions, 19 deletions
bob/ip/stereo/test/test.py
with
9 additions
and
19 deletions
bob/ip/stereo/test/test.py
+
9
−
19
View file @
ecfe4a99
...
...
@@ -62,8 +62,9 @@ def canberra_distance(array1, array2):
def
is_close_enough
(
image1
,
image2
):
"""
Checks if the 2 inputs are close enough to pass the test, using different metrics.
The test is considered passed if the difference between the inputs is not more than the a small value for each pixel.
Eg: the first test is considered passed if
"
distance(image1, image2) < distance(image1, image1 + 2)
"
The test is considered passed if the difference between the inputs is not more than the a small value for each
pixel on average.
Eg: the first test is considered passed if
"
distance(image1, image2) < distance(image1, image1 + epsilon)
"
The images are expected to be in unsigned int format (so positive).
...
...
@@ -73,11 +74,13 @@ def is_close_enough(image1, image2):
nb_elements
=
np
.
prod
(
image1
.
shape
)
epsilon
=
0.5
# allowed average difference between image
return
(
sum_of_squared_absolute_difference
(
image1
,
image2
)
<
2
*
nb_elements
and
euclidian_distance
(
image1
,
image2
)
<
4
*
nb_elements
and
manhattan_distance
(
image1
,
image2
)
<
2
*
nb_elements
and
canberra_distance
(
image1
,
image2
)
<
2
*
nb_elements
/
(
np
.
mean
(
image1
)
+
np
.
mean
(
image2
))
sum_of_squared_absolute_difference
(
image1
,
image2
)
<
epsilon
*
nb_elements
and
euclidian_distance
(
image1
,
image2
)
<
(
epsilon
**
2
)
*
nb_elements
and
manhattan_distance
(
image1
,
image2
)
<
epsilon
*
nb_elements
and
canberra_distance
(
image1
,
image2
)
<
epsilon
*
nb_elements
/
(
np
.
mean
(
image1
)
+
np
.
mean
(
image2
))
)
...
...
@@ -116,18 +119,5 @@ def test_stereo_mapping_and_project():
assert
groundtruth_color_image
.
shape
==
projected_image
.
shape
assert
groundtruth_map_3d
.
shape
==
map_3d
.
shape
# assert np.allclose(groundtruth_color_image, projected_image)
# assert np.allclose(groundtruth_map_3d, map_3d)
print
(
"
ssad
"
,
sum_of_squared_absolute_difference
(
groundtruth_color_image
,
projected_image
))
print
(
"
n2
"
,
euclidian_distance
(
groundtruth_color_image
,
projected_image
))
print
(
"
manhattan
"
,
manhattan_distance
(
groundtruth_color_image
,
projected_image
))
print
(
"
canberra
"
,
canberra_distance
(
groundtruth_color_image
,
projected_image
))
print
(
"
ssad
"
,
sum_of_squared_absolute_difference
(
groundtruth_map_3d
,
map_3d
))
print
(
"
n2
"
,
euclidian_distance
(
groundtruth_map_3d
,
map_3d
))
print
(
"
manhattan
"
,
manhattan_distance
(
groundtruth_map_3d
,
map_3d
))
print
(
"
canberra
"
,
canberra_distance
(
groundtruth_map_3d
,
map_3d
))
assert
is_close_enough
(
groundtruth_color_image
,
projected_image
)
assert
is_close_enough
(
groundtruth_map_3d
,
map_3d
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment