From 5367c1db7b63276363f00ba0f345a844fbc56ead Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 18 Jun 2018 15:13:26 +0200 Subject: clean --- rpc/img_ops.py | 19 ++++++++++--------- rpc/listener.py | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'rpc') diff --git a/rpc/img_ops.py b/rpc/img_ops.py index 6a96e61..e86d91e 100644 --- a/rpc/img_ops.py +++ b/rpc/img_ops.py @@ -133,18 +133,19 @@ def mix_next_image(opt, data_opt, rpc_client, im, i, sequence, sequence_i): next_img = process_image(opt, data_opt, next_im) - if data_opt.send_image == 'sequence': - rpc_client.send_pil_image("frame_{:05d}.png".format(i+1), meta, A_img, data_opt.output_format) - if data_opt.send_image == 'recursive': - pil_im = Image.fromarray(next_im) - rpc_client.send_pil_image("frame_{:05d}.png".format(i+1), meta, pil_im, data_opt.output_format) + img_to_send = None if data_opt.send_image == 'a': rgb_im = cv2.cvtColor(next_img, cv2.COLOR_BGR2RGB) - pil_im = Image.fromarray(rgb_im) - rpc_client.send_pil_image("frame_{:05d}.png".format(i+1), meta, pil_im, data_opt.output_format) + img_to_send = Image.fromarray(rgb_im) if data_opt.send_image == 'b': - image_pil = Image.fromarray(im, mode='RGB') - rpc_client.send_pil_image("frame_{:05d}.png".format(i+1), meta, image_pil, data_opt.output_format) + img_to_send = Image.fromarray(im, mode='RGB') + if data_opt.send_image == 'sequence': + img_to_send = A_img + if data_opt.send_image == 'recursive': + img_to_send = Image.fromarray(next_im) + + if img_to_send is not None: + rpc_client.send_pil_image("frame_{:05d}.png".format(i+1), meta, img_to_send, data_opt.output_format) cv2.imwrite(tmp_path, next_img) os.rename(tmp_path, next_path) diff --git a/rpc/listener.py b/rpc/listener.py index 6c8c10b..c54dc89 100644 --- a/rpc/listener.py +++ b/rpc/listener.py @@ -106,6 +106,6 @@ class Listener(): def connect(self): self.rpc_client = CortexRPC(self._get_fn, self._set_fn, self._ready_fn, self._cmd_fn) -def read_sequence(path, module_name): +def read_sequence(path, module_name=''): print("> read sequence {}".format(path)) return sorted([f for f in glob.glob(os.path.join('./sequences/', module_name, path, '*.png'))]) -- cgit v1.2.3-70-g09d2