aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoBoard.py10
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoCamera.py4
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoMarker.py2
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoTracker.py6
-rw-r--r--src/argaze/utils/aruco_calibration_board_export.py4
-rw-r--r--src/argaze/utils/aruco_markers_export.py4
-rw-r--r--src/argaze/utils/tobii_camera_calibrate.py2
7 files changed, 16 insertions, 16 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoBoard.py b/src/argaze/ArUcoMarkers/ArUcoBoard.py
index baf373f..f51a238 100644
--- a/src/argaze/ArUcoMarkers/ArUcoBoard.py
+++ b/src/argaze/ArUcoMarkers/ArUcoBoard.py
@@ -34,8 +34,8 @@ class ArUcoBoard():
return self.__board
@property
- def ids(self) -> list[int]:
- """Get board markers ids."""
+ def identifiers(self) -> list[int]:
+ """Get board markers identifiers."""
return self.__board.ids
@@ -57,12 +57,12 @@ class ArUcoBoard():
return (self.__board.getChessboardSize()[0] - 1 ) * (self.__board.getChessboardSize()[1] - 1)
- def export(self, destination_folder: str, dpi: int):
+ def save(self, destination_folder: str, dpi: int):
"""Save a picture of the calibration board."""
- output_filename = f'board_{self.__columns*self.__square_size}cmx{self.__rows*self.__square_size}cm_markers_{self.__aruco_dict.format}_{self.__marker_size}cm.png'
+ output_filename = f'{self.__aruco_dict.name}_{self.__marker_size}cm_{self.__columns*self.__square_size}cmx{self.__rows*self.__square_size}cm.png'
- dimension = [int(e * self.__board.getSquareLength() * 254 * dpi) for e in self.__board.getChessboardSize()] # 1 meter = 254 inches
+ dimension = [round(d * self.__board.getSquareLength() * 100 * dpi / 2.54) for d in self.__board.getChessboardSize()] # 1 cm = 2.54 inches
cv.imwrite(f'{destination_folder}/{output_filename}', self.__board.draw(dimension))
diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarkers/ArUcoCamera.py
index b63743d..40090cb 100644
--- a/src/argaze/ArUcoMarkers/ArUcoCamera.py
+++ b/src/argaze/ArUcoMarkers/ArUcoCamera.py
@@ -81,12 +81,12 @@ class ArUcoCamera():
self.__corners_set = []
self.__corners_set_ids = []
- def store_calibration_data(self, corners, corners_ids):
+ def store_calibration_data(self, corners, corners_identifiers):
"""Store calibration data."""
self.__corners_set_number += 1
self.__corners_set.append(corners)
- self.__corners_set_ids.append(corners_ids)
+ self.__corners_set_ids.append(corners_identifiers)
@property
def calibration_data_count(self) -> int:
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarker.py b/src/argaze/ArUcoMarkers/ArUcoMarker.py
index 5879a7b..2daaa04 100644
--- a/src/argaze/ArUcoMarkers/ArUcoMarker.py
+++ b/src/argaze/ArUcoMarkers/ArUcoMarker.py
@@ -42,7 +42,7 @@ class ArUcoMarker():
def image(self, dpi) -> numpy.array:
"""Create marker matrix image at a given resolution."""
- dimension = round(dpi * self.size / 2.54)
+ dimension = round(self.size * dpi / 2.54) # 1 cm = 2.54 inches
matrix = numpy.zeros((dimension, dimension, 1), dtype="uint8")
aruco.drawMarker(self.dictionary.markers, self.identifier, dimension, matrix, 1)
diff --git a/src/argaze/ArUcoMarkers/ArUcoTracker.py b/src/argaze/ArUcoMarkers/ArUcoTracker.py
index a1aba70..59b3bbe 100644
--- a/src/argaze/ArUcoMarkers/ArUcoTracker.py
+++ b/src/argaze/ArUcoMarkers/ArUcoTracker.py
@@ -203,7 +203,7 @@ class ArUcoTracker():
"""Get marker tracking metrics.
* **Returns:**
- number of track function call
- - dict with number of tracking detection for each marker ids"""
+ - dict with number of tracking detection for each marker identifier"""
return self.__track_count, Counter(self.__tracked_ids)
@@ -214,8 +214,8 @@ class ArUcoTracker():
return self.__board_corners_number
@property
- def board_corners_ids(self) -> list[int]:
- """Get tracked board corners identifiers."""
+ def board_corners_identifier(self) -> list[int]:
+ """Get tracked board corners identifier."""
return self.__board_corners_ids
diff --git a/src/argaze/utils/aruco_calibration_board_export.py b/src/argaze/utils/aruco_calibration_board_export.py
index 43653b1..dde2b47 100644
--- a/src/argaze/utils/aruco_calibration_board_export.py
+++ b/src/argaze/utils/aruco_calibration_board_export.py
@@ -16,7 +16,7 @@ def main():
parser.add_argument('marker_size', metavar='MARKER_SIZE', type=int, default=3, help='marker size (cm)')
parser.add_argument('-o', '--output', metavar='OUT', type=str, default='.', help='destination path')
parser.add_argument('-d', '--dictionary', metavar='DICT', type=ArUcoMarkersDictionary.ArUcoMarkersDictionary, default='DICT_ARUCO_ORIGINAL', help='aruco marker dictionnary (DICT_4X4_50, DICT_4X4_100, DICT_4X4_250, DICT_4X4_1000, DICT_5X5_50, DICT_5X5_100, DICT_5X5_250, DICT_5X5_1000, DICT_6X6_50, DICT_6X6_100, DICT_6X6_250, DICT_6X6_1000, DICT_7X7_50, DICT_7X7_100, DICT_7X7_250, DICT_7X7_1000, DICT_ARUCO_ORIGINAL, DICT_APRILTAG_16h5, DICT_APRILTAG_25h9, DICT_APRILTAG_36h10, DICT_APRILTAG_36h11)')
- parser.add_argument('-r', '--resolution', metavar='RES', type=int, default=50, help='picture resolution in dpi')
+ parser.add_argument('-r', '--resolution', metavar='RES', type=int, default=300, help='picture resolution in dpi')
args = parser.parse_args()
# Manage destination folder
@@ -28,7 +28,7 @@ def main():
aruco_board = ArUcoBoard.ArUcoBoard(args.dictionary, args.columns, args.rows, args.square_size, args.marker_size)
# Export aruco board
- aruco_board.export(args.output, args.resolution)
+ aruco_board.save(args.output, args.resolution)
if __name__ == '__main__':
diff --git a/src/argaze/utils/aruco_markers_export.py b/src/argaze/utils/aruco_markers_export.py
index 40d3e20..2115b2f 100644
--- a/src/argaze/utils/aruco_markers_export.py
+++ b/src/argaze/utils/aruco_markers_export.py
@@ -13,7 +13,7 @@ def main():
parser.add_argument('-o', '--output', metavar='OUT', type=str, default='.', help='destination path')
parser.add_argument('-d', '--dictionary', metavar='DICT', type=ArUcoMarkersDictionary.ArUcoMarkersDictionary, default='DICT_ARUCO_ORIGINAL', help='aruco marker dictionnary (DICT_4X4_50, DICT_4X4_100, DICT_4X4_250, DICT_4X4_1000, DICT_5X5_50, DICT_5X5_100, DICT_5X5_250, DICT_5X5_1000, DICT_6X6_50, DICT_6X6_100, DICT_6X6_250, DICT_6X6_1000, DICT_7X7_50, DICT_7X7_100, DICT_7X7_250, DICT_7X7_1000, DICT_ARUCO_ORIGINAL, DICT_APRILTAG_16h5, DICT_APRILTAG_25h9, DICT_APRILTAG_36h10, DICT_APRILTAG_36h11)')
parser.add_argument('-s', '--size', metavar='SIZE', type=float, default=3., help='marker size in cm')
- parser.add_argument('-r', '--resolution', metavar='RES', type=int, default=50, help='picture resolution in dpi')
+ parser.add_argument('-r', '--resolution', metavar='RES', type=int, default=300, help='picture resolution in dpi')
args = parser.parse_args()
# manage destination folder
@@ -22,7 +22,7 @@ def main():
print(f'{args.output} folder created')
# export markers
- args.dictionary.export_all(args.output, args.size, args.resolution)
+ args.dictionary.save(args.output, args.size, args.resolution)
if __name__ == '__main__':
diff --git a/src/argaze/utils/tobii_camera_calibrate.py b/src/argaze/utils/tobii_camera_calibrate.py
index cd546bb..6cfcd80 100644
--- a/src/argaze/utils/tobii_camera_calibrate.py
+++ b/src/argaze/utils/tobii_camera_calibrate.py
@@ -100,7 +100,7 @@ def main():
aruco_tracker.draw_board(video_frame.matrix)
# append data
- aruco_camera.store_calibration_data(aruco_tracker.board_corners, aruco_tracker.board_corners_ids)
+ aruco_camera.store_calibration_data(aruco_tracker.board_corners, aruco_tracker.board_corners_identifier)
cv.imshow('Tobii Camera Calibration', video_frame.matrix)