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
4f0f8a5c
Commit
4f0f8a5c
authored
Jun 30, 2017
by
André Anjos
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use scipy directly where possible
parent
b9af7a82
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
0 additions
and
44 deletions
+0
44
bob/bio/vein/utils.py
bob/bio/vein/utils.py
+0
44
No files found.
bob/bio/vein/utils.py
deleted
100644 → 0
View file @
b9af7a82
#!/usr/bin/env python
# vim: set fileencoding=utf8 :
import
numpy
import
scipy.signal
import
bob.sp
import
bob.core
def
imfilter
(
a
,
b
):
"""Applies a 2D filtering between images
This implementation was created to work similarly like the Matlab one when
``boundary = replicate``. It filters the image ``a`` with the filter ``b`` by
applying it over an extended version of ``a``, expanded of ``b.shape`` on the
right and bottom, by repeating the values on ``a``'s borders.
The filter is then applied to the image considering only the ``valid`` range
with :py:func:`scipy.signal.convolve2d`.
Parameters:
a (numpy.ndarray): A 2dimensional :py:class:`numpy.ndarray` which
represents the image to be filtered. The dtype of the array is supposed
to be 64bit floats. You can also pass an 8bit unsigned integer array,
loaded from a file (for example). In this case it will be scaled as with
:py:func:`bob.core.convert` and the range reset to ``[0.0, 1.0]``.
b (numpy.ndarray): A 64bit float 2dimensional :py:class:`numpy.ndarray`
which represents the filter to be applied to the image. The input filter
has to be rotated by 180 degrees as we use
:py:func:`scipy.signal.convolve2d` to apply it.
"""
if
a
.
dtype
==
numpy
.
uint8
:
a
=
bob
.
core
.
convert
(
a
,
numpy
.
float64
,
(
0
,
1
))
shape
=
(
a
.
shape
[
0
]
+
b
.
shape
[
0
]

1
,
a
.
shape
[
1
]
+
b
.
shape
[
1
]

1
)
a_ext
=
numpy
.
ndarray
(
shape
=
shape
,
dtype
=
numpy
.
float64
)
bob
.
sp
.
extrapolate_nearest
(
a
,
a_ext
)
return
scipy
.
signal
.
convolve2d
(
a_ext
,
b
,
'valid'
)
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