Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions musicalgestures/_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def history_ffmpeg(self, filename: str | None = None, history_length: int = 10,
weights_map += weights
str_weights = ' '.join([str(weight) for weight in weights_map])
elif type(weights) == str:
weights_as_list = weights.split()
weights_as_text = weights.split()
try:
weights_as_list = [float(item) for item in weights_as_list]
weights_as_list = [float(item) for item in weights_as_text]
except ValueError:
raise MgInputError(
'Found wrong type(s) in the list of weights. Use ints and floats.')
Expand Down Expand Up @@ -150,10 +150,11 @@ def history_cv2(self, filename: str | None = None, history_length: int = 10, wei
out = cv2.VideoWriter(target_name, fourcc, fps, (width, height))

ii = 0
history = []
history: list = []
weights_map = [1 for weight in range(history_length+1)]

if type(weights) in [int, float]:
assert isinstance(weights, (int, float))
offset = weights - 1
weights_map[0] = weights
elif type(weights) == list:
Expand Down
4 changes: 2 additions & 2 deletions musicalgestures/_subtract.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def mg_subtract(
cmd_filter += 'format=gray,smartblur=1,smartblur=3,'

cmd_filter += f'format=gray [mask];[matte][video][mask] maskedmerge, format={pixformat}'
cmd_filter = ['-filter_complex', cmd_filter]
cmd = cmd + cmd_filter + cmd_end
filter_flags = ['-filter_complex', cmd_filter]
cmd = cmd + filter_flags + cmd_end

ffmpeg_cmd(cmd, get_length(self.filename), pb_prefix='Subtracting background:', stream=True)

Expand Down
Loading