From 0126df19f0d3a57f940eb08e4481d9feed52ef51 Mon Sep 17 00:00:00 2001 From: Takahiro Date: Sat, 27 Apr 2024 23:45:13 +0200 Subject: [PATCH] Added scales param to max_layer_filter. --- .../script/elevation_mapping_cupy/plugins/max_layer_filter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/elevation_mapping_cupy/script/elevation_mapping_cupy/plugins/max_layer_filter.py b/elevation_mapping_cupy/script/elevation_mapping_cupy/plugins/max_layer_filter.py index 1c4e7853..34783ebd 100644 --- a/elevation_mapping_cupy/script/elevation_mapping_cupy/plugins/max_layer_filter.py +++ b/elevation_mapping_cupy/script/elevation_mapping_cupy/plugins/max_layer_filter.py @@ -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, ): @@ -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__( @@ -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)