"next_docs/vscode:/vscode.git/clone" did not exist on "b04867f90a0c6bc35380ecd488261cf1da95e79f"
Commit 041e3bef authored by lucasb-eyer's avatar lucasb-eyer
Browse files

Allow scalar `schan` in `create_pairwise_bilateral`.

parent 3381ed43
import numpy as np import numpy as np
from numbers import Number
from logging import warning from logging import warning
...@@ -142,6 +143,10 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1): ...@@ -142,6 +143,10 @@ 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
# Allow for a single number in `schan` to broadcast across all channels:
if isinstance(schan, Number):
im_feat /= schan
else:
for i, s in enumerate(schan): for i, s in enumerate(schan):
im_feat[i] /= s im_feat[i] /= s
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment