diff --git a/camera_settings.py b/camera_settings.py index 06c2641..2ea3448 100644 --- a/camera_settings.py +++ b/camera_settings.py @@ -31,3 +31,20 @@ def check_settings(): print(f'{attrib} = {VIDEO_CHECK.get(index)}') VIDEO_CHECK.release() + +def reset_settings(): + if not os.path.exists('camera_settings.log'): + print('"camera_settings.log" does not exist!') + print('Verify your camera settings!') + return False + else: + VIDEO_CHECK = cv2.VideoCapture(0) + f = open('camera_settings.log', 'r') + lines = f.read().split('\n') + for line in lines: + attrib = line.split(' = ') + if attrib[0] in attrib_list.keys(): + VIDEO_CHECK.set(attrib_list[attrib[0]], eval(attrib[1])) + f.close() + VIDEO_CHECK.release() + return True