aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2022-03-29 17:32:53 +0200
committerThéo de la Hogue2022-03-29 17:32:53 +0200
commit9343cf9917983b9617d948b96b1a6ced24a6dab8 (patch)
tree0095ba319319c44b142e6d1d62483af9e9e1a7e2 /src
parent1e66bbb24de8808678c73bbae1966cfbe1f45ab0 (diff)
downloadargaze-9343cf9917983b9617d948b96b1a6ced24a6dab8.zip
argaze-9343cf9917983b9617d948b96b1a6ced24a6dab8.tar.gz
argaze-9343cf9917983b9617d948b96b1a6ced24a6dab8.tar.bz2
argaze-9343cf9917983b9617d948b96b1a6ced24a6dab8.tar.xz
Fixing camera calibration bugs introduced by new ArUco markers dictionary managment
Diffstat (limited to 'src')
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoBoard.py2
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoTracker.py4
-rw-r--r--src/argaze/utils/README.md2
-rw-r--r--src/argaze/utils/calibrate_tobii_camera.py4
4 files changed, 6 insertions, 6 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoBoard.py b/src/argaze/ArUcoMarkers/ArUcoBoard.py
index de50363..d2eea50 100644
--- a/src/argaze/ArUcoMarkers/ArUcoBoard.py
+++ b/src/argaze/ArUcoMarkers/ArUcoBoard.py
@@ -45,7 +45,7 @@ class ArUcoBoard():
def get_corners_number(self):
"""Get number of corners."""
- return (self.__board.getChessboardSize()[0] - 1 ) * (self.__board.getChessboardSize()()[1] - 1)
+ return (self.__board.getChessboardSize()[0] - 1 ) * (self.__board.getChessboardSize()[1] - 1)
def export(self, destination_folder: str, dpi: int):
"""Save a picture of the calibration board."""
diff --git a/src/argaze/ArUcoMarkers/ArUcoTracker.py b/src/argaze/ArUcoMarkers/ArUcoTracker.py
index 29e862f..1d67221 100644
--- a/src/argaze/ArUcoMarkers/ArUcoTracker.py
+++ b/src/argaze/ArUcoMarkers/ArUcoTracker.py
@@ -48,7 +48,7 @@ class ArUcoTracker():
# detect markers from gray picture
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
- self.__markers_corners, self.__markers_ids, rejectedPoints = aruco.detectMarkers(gray, self.__aruco_dict, parameters = self.__aruco_param)
+ self.__markers_corners, self.__markers_ids, rejectedPoints = aruco.detectMarkers(gray, self.__aruco_dict.get_markers(), parameters = self.__aruco_param)
if len(self.__markers_corners) > 0 and estimate_pose:
@@ -68,7 +68,7 @@ class ArUcoTracker():
# detect markers from gray picture
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
- self.__markers_corners, self.__markers_ids, rejectedPoints = aruco.detectMarkers(gray, self.__aruco_dict, parameters = self.__aruco_param)
+ self.__markers_corners, self.__markers_ids, rejectedPoints = aruco.detectMarkers(gray, self.__aruco_dict.get_markers(), parameters = self.__aruco_param)
# if all board markers are detected
if self.get_markers_number() == expected_markers_number:
diff --git a/src/argaze/utils/README.md b/src/argaze/utils/README.md
index 0bc3216..461d82d 100644
--- a/src/argaze/utils/README.md
+++ b/src/argaze/utils/README.md
@@ -27,7 +27,7 @@ python ./src/argaze/utils/export_calibration_board.py 7 5 5 3 -o export
- Calibrate Tobii Glasses Pro 2 camera (replace IP_ADDRESS) using a 7 columns and 5 rows calibration board with 5cm squares and 3cm markers inside. Then, export its optical parameters into an tobii_camera.json file:
```
-python ./src/argaze/utils/tobii_camera_calibration.py 7 5 5 3 -t IP_ADDRESS -o export/tobii_camera.json
+python ./src/argaze/utils/calibrate_tobii_camera.py 7 5 5 3 -t IP_ADDRESS -o export/tobii_camera.json
```
- Display Tobii Glasses Pro 2 gaze and camera video stream (replace IP_ADDRESS)
diff --git a/src/argaze/utils/calibrate_tobii_camera.py b/src/argaze/utils/calibrate_tobii_camera.py
index 553632f..93751ba 100644
--- a/src/argaze/utils/calibrate_tobii_camera.py
+++ b/src/argaze/utils/calibrate_tobii_camera.py
@@ -58,8 +58,8 @@ def main():
frame_width = 0
frame_height = 0
- expected_markers_number = len(aruco_board.get_ids())
- expected_corners_number = (aruco_board.get_size()[0] - 1 ) * (aruco_board.get_size()[1] - 1)
+ expected_markers_number = aruco_board.get_markers_number()
+ expected_corners_number = aruco_board.get_corners_number()
# capture loop
try: