aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2024-04-25 12:10:20 +0200
committerThéo de la Hogue2024-04-25 12:10:20 +0200
commitf36b1d53ee1ac03f942a3655ac6f0bb75865d7f0 (patch)
treecbfd3ac8d37c5e0d4c8d88c185d4004d38ec060a
parentb454b007b801e98f13b2011197702abb3475a1c9 (diff)
downloadargaze-f36b1d53ee1ac03f942a3655ac6f0bb75865d7f0.zip
argaze-f36b1d53ee1ac03f942a3655ac6f0bb75865d7f0.tar.gz
argaze-f36b1d53ee1ac03f942a3655ac6f0bb75865d7f0.tar.bz2
argaze-f36b1d53ee1ac03f942a3655ac6f0bb75865d7f0.tar.xz
Improving no window mode.
-rw-r--r--src/argaze/__main__.py25
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()