Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.bio.vein
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.bio.vein
Commits
9a317867
Commit
9a317867
authored
Sep 01, 2017
by
André Anjos
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support view mode w/o extracted veins
parent
1060d415
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
bob/bio/vein/script/view_sample.py
bob/bio/vein/script/view_sample.py
+20
-14
No files found.
bob/bio/vein/script/view_sample.py
View file @
9a317867
...
...
@@ -93,7 +93,7 @@ def save_figures(title, image, mask, image_pp, binary):
'binarized.png'
))
def
proof_figure
(
title
,
image
,
mask
,
image_pp
,
binary
):
def
proof_figure
(
title
,
image
,
mask
,
image_pp
,
binary
=
None
):
'''Builds a proof canvas out of individual images
...
...
@@ -111,8 +111,9 @@ def proof_figure(title, image, mask, image_pp, binary):
image_pp (numpy.ndarray): A version of the original image, pre-processed by
one of the available algorithms
binary (numpy.ndarray): A binarized version of the original image in which
all pixels (should) represent vein (``True``) or not-vein (``False``)
binary (numpy.ndarray, Optional): A binarized version of the original image
in which all pixels (should) represent vein (``True``) or not-vein
(``False``)
Returns:
...
...
@@ -122,24 +123,27 @@ def proof_figure(title, image, mask, image_pp, binary):
'''
fig
=
mpl
.
figure
(
figsize
=
(
6
,
9
),
dpi
=
50
)
#900 x 300 pixels
fig
=
mpl
.
figure
(
figsize
=
(
6
,
9
),
dpi
=
100
)
images
=
3
if
binary
is
not
None
else
2
# add original image
mpl
.
subplot
(
3
,
1
,
1
)
mpl
.
subplot
(
images
,
1
,
1
)
mpl
.
title
(
'
%
s - original'
%
title
)
mpl
.
imshow
(
image
,
cmap
=
"gray"
)
# add preprocessed image
from
..preprocessor
import
utils
img
=
utils
.
draw_mask_over_image
(
image_pp
,
mask
)
mpl
.
subplot
(
3
,
1
,
2
)
mpl
.
subplot
(
images
,
1
,
2
)
mpl
.
title
(
'Preprocessed'
)
mpl
.
imshow
(
img
)
# add binary image
mpl
.
subplot
(
3
,
1
,
3
)
mpl
.
title
(
'Binarized'
)
mpl
.
imshow
(
binary
.
astype
(
'uint8'
)
*
255
,
cmap
=
"gray"
)
if
binary
is
not
None
:
# add binary image
mpl
.
subplot
(
3
,
1
,
3
)
mpl
.
title
(
'Binarized'
)
mpl
.
imshow
(
binary
.
astype
(
'uint8'
)
*
255
,
cmap
=
"gray"
)
return
fig
...
...
@@ -172,16 +176,18 @@ def main(user_input=None):
# Loads the image, the mask and save it to a PNG file
for
stem
in
args
[
'<stem>'
]:
image
=
bob
.
bio
.
base
.
load
(
os
.
path
.
join
(
args
[
'<database>'
],
stem
+
'.png'
))
image
=
numpy
.
rot90
(
image
,
k
=-
1
)
pp
=
bob
.
io
.
base
.
HDF5File
(
os
.
path
.
join
(
args
[
'<processed>'
],
'preprocessed'
,
stem
+
'.hdf5'
))
mask
=
pp
.
read
(
'mask'
)
image_pp
=
pp
.
read
(
'image'
)
binary
=
bob
.
io
.
base
.
load
(
os
.
path
.
join
(
args
[
'<processed>'
],
'extracted'
,
stem
+
'.hdf5'
))
binary_path
=
os
.
path
.
join
(
args
[
'<processed>'
],
'extracted'
,
stem
+
'.hdf5'
)
if
os
.
path
.
exists
(
binary_path
):
binary
=
bob
.
io
.
base
.
load
(
binary_path
)
else
:
binary
=
None
fig
=
proof_figure
(
stem
,
image
,
mask
,
image_pp
,
binary
)
#fig.title(stem)
if
args
[
'--save'
]:
#fig.savefig(args['--save'])
save_figures
(
args
[
'--save'
],
image
,
mask
,
image_pp
,
binary
)
else
:
mpl
.
show
()
...
...
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