aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-02-21 17:03:08 +0100
committerThéo de la Hogue2023-02-21 17:03:08 +0100
commitb6c9eb85ab587766f4658e0ef75039f9094a9620 (patch)
tree7791239c8f5b8f10c50d63192e6c9c2b6dd0904f
parent7d88537c78dc5acfcf6f7234dcbeb12f5b7dbbcc (diff)
downloadargaze-b6c9eb85ab587766f4658e0ef75039f9094a9620.zip
argaze-b6c9eb85ab587766f4658e0ef75039f9094a9620.tar.gz
argaze-b6c9eb85ab587766f4658e0ef75039f9094a9620.tar.bz2
argaze-b6c9eb85ab587766f4658e0ef75039f9094a9620.tar.xz
Trying to fix camera calibration script.
-rw-r--r--src/argaze/utils/tobii_camera_calibrate.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/argaze/utils/tobii_camera_calibrate.py b/src/argaze/utils/tobii_camera_calibrate.py
index 65b177e..f19cb8b 100644
--- a/src/argaze/utils/tobii_camera_calibrate.py
+++ b/src/argaze/utils/tobii_camera_calibrate.py
@@ -49,6 +49,10 @@ def main():
# Setup camera at 25 fps to work on Full HD video stream
tobii_controller.set_scene_camera_freq_25()
+ # Get video stream dimension
+ video_width = tobii_controller.get_configuration()['sys_sc_width']
+ video_height = tobii_controller.get_configuration()['sys_sc_height']
+
# Print current confirugration
print(f'Tobii Glasses Pro 2 configuration:')
for key, value in tobii_controller.get_configuration().items():
@@ -64,7 +68,8 @@ def main():
aruco_board = ArUcoBoard.ArUcoBoard(args.dictionary, args.columns, args.rows, args.square_size, args.marker_size)
# Create aruco detecter
- aruco_detector = ArUcoDetector.ArUcoDetector(args.dictionary, args.marker_size, aruco_camera)
+ config = {'dictionary':'DICT_APRILTAG_16h5', 'marker_size': 5, 'camera':{}, 'parameters':{}}
+ aruco_detector = ArUcoDetector.ArUcoDetector(**config)
# Start tobii glasses streaming
tobii_controller.start_streaming()
@@ -119,15 +124,15 @@ def main():
tobii_controller.stop_streaming()
print('\nCalibrating camera...')
- aruco_camera.calibrate(aruco_board, video_frame.width, video_frame.height)
+ aruco_camera.calibrate(aruco_board, video_width, video_height)
print('\nCalibration succeeded!')
print(f'\nRMS:\n{aruco_camera.rms}')
- print(f'\nDimensions:\n{video_frame.width}x{video_frame.height}')
+ print(f'\nDimensions:\n{video_width}x{video_height}')
print(f'\nCamera matrix:\n{aruco_camera.K}')
print(f'\nDistortion coefficients:\n{aruco_camera.D}')
- aruco_camera.save_calibration_file(args.output)
+ aruco_camera.to_json(args.output)
print(f'\nCalibration data exported into {args.output} file')