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
72135a20
Commit
72135a20
authored
Jun 30, 2017
by
André Anjos
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More preprocessor changes
parent
4f0f8a5c
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
538 deletions
+109
-538
bob/bio/vein/preprocessor/FingerCrop.py
bob/bio/vein/preprocessor/FingerCrop.py
+0
-538
bob/bio/vein/preprocessor/filters.py
bob/bio/vein/preprocessor/filters.py
+109
-0
No files found.
bob/bio/vein/preprocessor/FingerCrop.py
deleted
100644 → 0
View file @
4f0f8a5c
This diff is collapsed.
Click to expand it.
bob/bio/vein/preprocessor/filters.py
0 → 100644
View file @
72135a20
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
'''Base utilities for post-filtering vein images'''
import
numpy
class
Filter
(
object
):
'''Objects of this class filter the input image'''
def
__init__
(
self
):
pass
def
__call__
(
self
,
image
,
mask
):
'''Inputs image and mask and outputs a filtered version of the image
Parameters:
image (numpy.ndarray): raw image to filter as 2D array of unsigned
8-bit integers
mask (numpy.ndarray): mask to normalize as 2D array of booleans
Returns:
numpy.ndarray: A 2D boolean array with the same shape and data type of
the input image representing the filtered image.
'''
raise
NotImplemented
(
'You must implement the __call__ slot'
)
class
NoFilter
(
Filter
):
'''Applies no filtering on the input image, returning it without changes'''
def
__init__
(
self
):
pass
def
__call__
(
self
,
image
,
mask
):
'''Inputs image and mask and outputs the image, without changes
Parameters:
image (numpy.ndarray): raw image to filter as 2D array of unsigned
8-bit integers
mask (numpy.ndarray): mask to normalize as 2D array of booleans
Returns:
numpy.ndarray: A 2D boolean array with the same shape and data type of
the input image representing the filtered image.
'''
return
image
class
HistogramEqualization
(
Filter
):
'''Applies histogram equalization on the input image inside the mask.
In this implementation, only the pixels that lie inside the mask will be
used to calculate the histogram equalization parameters. Because of this
particularity, we don't use Bob's implementation for histogram equalization
and have one based exclusively on scikit-image.
'''
def
__init__
(
self
):
pass
def
__call__
(
self
,
image
,
mask
):
'''Applies histogram equalization on the input image, returns filtered
Parameters:
image (numpy.ndarray): raw image to filter as 2D array of unsigned
8-bit integers
mask (numpy.ndarray): mask to normalize as 2D array of booleans
Returns:
numpy.ndarray: A 2D boolean array with the same shape and data type of
the input image representing the filtered image.
'''
from
skimage.exposure
import
equalize_hist
from
skimage.exposure
import
rescale_intensity
retval
=
rescale_intensity
(
equalize_hist
(
image
,
mask
=
mask
),
out_range
=
(
0
,
255
))
# make the parts outside the mask totally black
retval
[
~
mask
]
=
0
return
retval
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