Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
pydensecrf
Commits
041e3bef
Commit
041e3bef
authored
Feb 11, 2017
by
lucasb-eyer
Browse files
Allow scalar `schan` in `create_pairwise_bilateral`.
parent
3381ed43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
pydensecrf/utils.py
pydensecrf/utils.py
+7
-2
No files found.
pydensecrf/utils.py
View file @
041e3bef
import
numpy
as
np
import
numpy
as
np
from
numbers
import
Number
from
logging
import
warning
from
logging
import
warning
...
@@ -142,8 +143,12 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1):
...
@@ -142,8 +143,12 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1):
im_feat
=
np
.
rollaxis
(
img
,
chdim
).
astype
(
np
.
float32
)
im_feat
=
np
.
rollaxis
(
img
,
chdim
).
astype
(
np
.
float32
)
# scale image features per channel
# scale image features per channel
for
i
,
s
in
enumerate
(
schan
):
# Allow for a single number in `schan` to broadcast across all channels:
im_feat
[
i
]
/=
s
if
isinstance
(
schan
,
Number
):
im_feat
/=
schan
else
:
for
i
,
s
in
enumerate
(
schan
):
im_feat
[
i
]
/=
s
# create a mesh
# create a mesh
cord_range
=
[
range
(
s
)
for
s
in
im_feat
.
shape
[
1
:]]
cord_range
=
[
range
(
s
)
for
s
in
im_feat
.
shape
[
1
:]]
...
...
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