diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-14 13:06:54 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-14 13:06:54 +0200 |
| commit | 3f56f87c01b5bb10e68ca16342c462c9f1df1976 (patch) | |
| tree | ab3c645715fc3f9ef2dee4e5f45b017934f0948a | |
| parent | bd3db3205e675614bed8000e70530eb9749301bc (diff) | |
sequence without recursiong
| -rw-r--r-- | live-mogrify.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/live-mogrify.py b/live-mogrify.py index 155ee1d..bad6d78 100644 --- a/live-mogrify.py +++ b/live-mogrify.py @@ -408,6 +408,19 @@ def process_live_input(opt, data_opt, rpc_client, model): else: last_im = next_im.copy().astype('uint8') + elif data_opt.sequence and len(sequence): + A_img = Image.open(sequence_path).convert('RGB') + A_im = np.asarray(A_img) + frac_b = data_opt.sequence_frac + if data_opt.transition: + t = lerp(math.sin(i / data_opt.transition_period * math.pi * 2.0 ) / 2.0 + 0.5, data_opt.transition_min, data_opt.transition_max) + frac_b *= 1.0 - t + frac_c = 1.0 - frac_b + array_b = np.multiply(A_im.astype('float64'), frac_b) + array_c = np.multiply(im.astype('float64'), frac_c) + array_bc = np.add(array_b, array_c) + next_im = array_bc.astype('uint8') + else: last_im = im.copy().astype('uint8') next_im = im |
