From 43288b22aba1987cea3e24b6576a8395afffeea3 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 11 Feb 2017 01:31:55 +0200 Subject: [PATCH] fixed editable mask for rotated cameras --- motioneye/config.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/motioneye/config.py b/motioneye/config.py index a3f357f..e08f4a2 100644 --- a/motioneye/config.py +++ b/motioneye/config.py @@ -946,7 +946,11 @@ def motion_camera_ui_to_dict(ui, old_config=None): data['smart_mask_speed'] = 10 - int(ui['smart_mask_sluggishness']) elif ui['mask_type'] == 'editable': - data['mask_file'] = utils.build_editable_mask_file(old_config['@id'], ui['mask_lines'], data.get('width'), data.get('height')) + capture_width, capture_height = data.get('width'), data.get('height') + if data.get('rotate') in [90, 270]: + capture_width, capture_height = capture_height, capture_width + + data['mask_file'] = utils.build_editable_mask_file(old_config['@id'], ui['mask_lines'], capture_width, capture_height) # working schedule if ui['working_schedule']: @@ -1327,7 +1331,12 @@ def motion_camera_dict_to_ui(data): if data['mask_file']: ui['mask'] = True ui['mask_type'] = 'editable' - ui['mask_lines'] = utils.parse_editable_mask_file(data['@id'], data.get('width'), data.get('height')) + + capture_width, capture_height = data.get('width'), data.get('height') + if int(data.get('rotate')) in [90, 270]: + capture_width, capture_height = capture_height, capture_width + + ui['mask_lines'] = utils.parse_editable_mask_file(data['@id'], capture_width, capture_height) elif data['smart_mask_speed']: ui['mask'] = True -- 2.39.5