aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/utils/environment_edit.py37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/argaze/utils/environment_edit.py b/src/argaze/utils/environment_edit.py
index ce6691c..2b3d597 100644
--- a/src/argaze/utils/environment_edit.py
+++ b/src/argaze/utils/environment_edit.py
@@ -47,8 +47,9 @@ def main():
right_button = False
edit_trans = False # translate
edit_z = False
- cover = False
draw_help = False
+ draw_grid = False
+ draw_cover = False
pose_mode = 0
# Update pointer position
@@ -100,7 +101,7 @@ def main():
current_frame_index = -1
_, current_frame = video_capture.read()
next_frame_index = int(args.start * video_fps)
- refresh_detection = False
+ refresh = False
# Init marker selection
selected_marker_id = -1
@@ -117,7 +118,7 @@ def main():
info_frame = numpy.full((500, 1000, 3), 0, dtype=numpy.uint8)
# Select a new frame and detect markers once
- if next_frame_index != current_frame_index or refresh_detection or cover:
+ if next_frame_index != current_frame_index or refresh or draw_cover:
video_capture.set(cv2.CAP_PROP_POS_FRAMES, next_frame_index)
@@ -125,11 +126,19 @@ def main():
if success:
+ # Refresh once
+ refresh = False
+
current_frame_index = video_capture.get(cv2.CAP_PROP_POS_FRAMES) - 1
current_frame_time = video_capture.get(cv2.CAP_PROP_POS_MSEC)
+ # Draw camera calibration
+ if draw_grid:
+
+ ar_environment.aruco_detector.camera.draw(video_frame, frame_width/10, frame_height/10, 100., color=(127, 127, 127))
+
# Hide zone
- if cover:
+ if draw_cover:
# Draw black circle under pointer
cv2.circle(video_frame, pointer, 50, (0, 0, 0), -1)
@@ -334,7 +343,7 @@ def main():
# Project AOI scene into frame according estimated pose
aoi_scene_projection = ar_scene.project(tvec, rmat, visual_hfov=TobiiSpecifications.VISUAL_HFOV)
- aoi_scene_projection.draw(video_frame, color=(255, 0, 0))
+ aoi_scene_projection.draw(video_frame, color=(255, 255, 255))
break
@@ -436,9 +445,14 @@ def main():
if key_pressed == 104:
draw_help = not draw_help
- # Switch cover mode with c key
+ # Switch grid mode with g key
+ if key_pressed == 103:
+ draw_grid = not draw_grid
+ refresh = True
+
+ # Switch draw_cover mode with c key
if key_pressed == 99:
- cover = not cover
+ draw_cover = not draw_cover
# Switch pose estimation mode with m key
if key_pressed == 109:
@@ -455,10 +469,11 @@ def main():
if key_pressed == 27:
break
- # Reload detector configuration on 'c' key
- if key_pressed == 99:
- print(f'TODO: Reload ArUcoDetector parameters')
- refresh_detection = True
+ # Reload environment on 'Backspace' key
+ if key_pressed == 127:
+ ar_environment = ArFeatures.ArEnvironment.from_json(args.environment)
+ print(f'Environment reloaded from {args.environment}')
+ refresh = True
# Display video
cv2.imshow(ar_environment.name, video_frame)