From 78ae446532d435bc91892c07f25920fa0f4a1992 Mon Sep 17 00:00:00 2001 From: arch Date: Mon, 27 Jun 2022 19:10:23 +0200 Subject: [PATCH] add evenly intermediate points hyperparameter --- funscript_editor/algorithms/signal.py | 6 +++++- funscript_editor/config/hyperparameter.yaml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/funscript_editor/algorithms/signal.py b/funscript_editor/algorithms/signal.py index 4349360..7ef390f 100644 --- a/funscript_editor/algorithms/signal.py +++ b/funscript_editor/algorithms/signal.py @@ -21,6 +21,7 @@ class SignalParameter: high_second_derivative_points_threshold: float = float(HYPERPARAMETER['signal']['high_second_derivative_points_threshold']) direction_change_filter_len: int = int(HYPERPARAMETER['signal']['direction_change_filter_len']) additional_points_repetitions: int = int(HYPERPARAMETER['signal']['additional_points_repetitions']) + min_evenly_intermediate_interframes: int = int(HYPERPARAMETER['signal']['min_evenly_intermediate_interframes']) class Signal: @@ -344,7 +345,10 @@ def get_evenly_intermediate_points(self, signal: list, base_points: list) -> lis additional_points = [] for i in range(len(base_points) - 1): diff = base_points[i+1] - base_points[i] - if diff < 3: + if diff < 2: + continue + + if diff < 2*self.params.min_evenly_intermediate_interframes: continue additional_points.append(base_points[i] + round(diff/2)) diff --git a/funscript_editor/config/hyperparameter.yaml b/funscript_editor/config/hyperparameter.yaml index 5f9be62..c385e8f 100644 --- a/funscript_editor/config/hyperparameter.yaml +++ b/funscript_editor/config/hyperparameter.yaml @@ -37,6 +37,9 @@ signal: # threshold value to merge additional points additional_points_merge_distance_threshold: 8.0 + # min interframes without an additional datapoint for the evenly intermediate algorithm + min_evenly_intermediate_interframes: 2 + # number of runs for the additional points algorithm (max number of points that will be insert between 2 base points) additional_points_repetitions: 2