Skip to content

Commit

Permalink
Added scales param to max_layer_filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
mktk1117 committed Apr 27, 2024
1 parent 9617d84 commit 0126df1
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
reverse: list = [True],
min_or_max: str = "max",
thresholds: list = [False],
scales: list = [1.0],
default_value: float = 0.0,
**kwargs,
):
Expand All @@ -37,6 +38,7 @@ def __init__(
self.reverse = reverse
self.min_or_max = min_or_max
self.thresholds = thresholds
self.scales = scales
self.default_value = default_value

def __call__(
Expand Down Expand Up @@ -84,6 +86,8 @@ def __call__(
layer = cp.where(layer == 0, default_layer, layer)
if self.reverse[it]:
layer = 1.0 - layer
if len(self.scales) > it and isinstance(self.scales[it], float):
layer = layer * float(self.scales[it])
if isinstance(self.thresholds[it], float):
layer = cp.where(layer > float(self.thresholds[it]), 1, 0)
layers.append(layer)
Expand Down

0 comments on commit 0126df1

Please sign in to comment.