Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.bio.vein
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.bio.vein
Commits
5c9171c3
Commit
5c9171c3
authored
Jul 25, 2016
by
André Anjos
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Implement (optional) image viewing; Fix minor test
parent
cf9c1fe8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
bob/bio/vein/tests/test.py
bob/bio/vein/tests/test.py
+22
-4
No files found.
bob/bio/vein/tests/test.py
View file @
5c9171c3
...
...
@@ -29,6 +29,21 @@ def F(parts):
return
pkg_resources
.
resource_filename
(
__name__
,
os
.
path
.
join
(
*
parts
))
def
_show_image
(
image
):
"""Shows a single image
Parameters:
image (numpy.ndarray): A 2D numpy.ndarray compose of 8-bit unsigned
integers containing the original image
"""
from
PIL
import
Image
img
=
Image
.
fromarray
(
image
)
img
.
show
()
def
_show_mask_over_image
(
image
,
mask
,
color
=
'red'
):
"""Plots the mask over the image of a finger, for debugging purposes
...
...
@@ -66,12 +81,15 @@ def test_finger_crop():
preproc
,
mask
=
preprocess
(
img
)
#_show_mask_over_image(preproc, mask)
mask_ref
=
bob
.
io
.
base
.
load
(
output_fvr_filename
)
preproc_ref
=
bob
.
io
.
base
.
load
(
output_img_filename
)
mask_ref
=
bob
.
io
.
base
.
load
(
output_fvr_filename
).
astype
(
'bool'
)
preproc_ref
=
bob
.
core
.
convert
(
bob
.
io
.
base
.
load
(
output_img_filename
),
numpy
.
uint8
,
(
0
,
255
),
(
0.0
,
1.0
))
assert
numpy
.
mean
(
numpy
.
abs
(
mask
-
mask_ref
))
<
1e-2
# Very loose comparison!
assert
numpy
.
mean
(
numpy
.
abs
(
mask
.
astype
(
'float64'
)
-
mask_ref
))
<
1e-2
assert
numpy
.
mean
(
numpy
.
abs
(
preproc
-
preproc_ref
))
<
1e2
#_show_image(numpy.abs(preproc.astype('int16') - preproc_ref.astype('int16')).astype('uint8'))
assert
numpy
.
mean
(
numpy
.
abs
(
preproc
-
preproc_ref
))
<
1
.3
e2
def
test_miuramax
():
...
...
Write
Preview
Markdown
is supported
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