diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/__main__.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/argaze/__main__.py b/src/argaze/__main__.py index b94e5ec..80f12a3 100644 --- a/src/argaze/__main__.py +++ b/src/argaze/__main__.py @@ -21,6 +21,7 @@ import argparse import logging import json import contextlib +import time import os import stat @@ -84,6 +85,9 @@ with load(args.context_file) as context: # Create a window to display context cv2.namedWindow(context.name, cv2.WINDOW_AUTOSIZE) + # Assess processing time + start_time = time.time() + # Waiting for 'ctrl+C' interruption with contextlib.suppress(KeyboardInterrupt), os.fdopen(pipe_file) if args.pipe_path is not None else contextlib.nullcontext() as pipe: @@ -121,7 +125,7 @@ with load(args.context_file) as context: display(scene_frame.name, scene_frame.image(), 0.5) # Key interaction - key_pressed = cv2.waitKey(10) + key_pressed = cv2.waitKey(40) # Esc: close window if key_pressed == 27: @@ -151,7 +155,24 @@ with load(args.context_file) as context: if issubclass(type(context), PostProcessingContext): - print_progress_bar(context.progression, 1., prefix = 'Progression', suffix = '', length = 100) + prefix = f'Progression' + suffix = f'| {int(context.progression*context.duration * 1e-3)}s in {int(time.time()-start_time)}s' + + look_time, look_freq = context.process_gaze_position_performance() + suffix += f' | Look {look_time:.2f}ms at {look_freq}Hz' + + if issubclass(type(context.pipeline), ArCamera): + + watch_time, watch_freq = context.process_camera_image_performance() + suffix += f' | Watch {int(watch_time)}ms at {watch_freq}Hz' + + # Clear old longer print + suffix += ' ' + + print_progress_bar(context.progression, 1., prefix = prefix, suffix = suffix, length = 50) + + # Wait one second + time.sleep(1) # Stop frame display cv2.destroyAllWindows() |