From 3ac5fa26a191dc27434c60a6fb48deae828b7c90 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 19 May 2018 10:49:53 +0200 Subject: options for minimum recursion value --- test-mogrify.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test-mogrify.py') diff --git a/test-mogrify.py b/test-mogrify.py index c1e0c71..68f279d 100644 --- a/test-mogrify.py +++ b/test-mogrify.py @@ -131,7 +131,6 @@ if __name__ == '__main__': print("https://asdf.us/neural/" + video_fn) - if data_opt.mov: render_video() sys.exit(1) @@ -194,6 +193,11 @@ if __name__ == '__main__': image_pil.save(tmp_path) os.rename(tmp_path, render_path) + def clamp(n,a,b): + return max(a, min(n, b)) + def lerp(n,a,b): + return (b-a)*n+a + if dataset.name() == 'RecursiveDatasetDataLoader': if data_opt.recursive and last_im is not None: tmp_im = im.copy() @@ -201,7 +205,7 @@ if __name__ == '__main__': if data_opt.sequence and A_dir is not None: A_img = Image.open(sequence_path).convert('RGB') A_im = np.asarray(A_img) - t = math.sin(i / 3000 * math.pi * 2 ) / 2 + 1 + t = lerp(math.sin(i / data_opt.transition_period * math.pi * 2 ) / 2 + 1, data_opt.transition_min, 1.0) frac_a = data_opt.recursive_frac * (1 - t) frac_b = data_opt.sequence_frac * (1 - t) frac_c = 1.0 - frac_a - frac_b -- cgit v1.2.3-70-g09d2