Skip to content

Commit

Permalink
add evenly intermediate points hyperparameter
Browse files Browse the repository at this point in the history
  • Loading branch information
arch committed Jun 27, 2022
1 parent 35364e8 commit 78ae446
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion funscript_editor/algorithms/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions funscript_editor/config/hyperparameter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 78ae446

Please sign in to comment.