aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-03-29 10:43:36 +0200
committerThéo de la Hogue2023-03-29 10:43:36 +0200
commit83f99facd584b5ba4047847752dc7695c2331fa3 (patch)
tree0bb45fac96870b7c47c18ce872c2675c1009f931
parent3d660456e137beccd5d5f478204c0e972d8121df (diff)
downloadargaze-83f99facd584b5ba4047847752dc7695c2331fa3.zip
argaze-83f99facd584b5ba4047847752dc7695c2331fa3.tar.gz
argaze-83f99facd584b5ba4047847752dc7695c2331fa3.tar.bz2
argaze-83f99facd584b5ba4047847752dc7695c2331fa3.tar.xz
Removing filename creation inside board save method.
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoBoard.py8
-rw-r--r--src/argaze/utils/aruco_calibration_board_export.py5
2 files changed, 6 insertions, 7 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoBoard.py b/src/argaze/ArUcoMarkers/ArUcoBoard.py
index 6c91fc6..7685494 100644
--- a/src/argaze/ArUcoMarkers/ArUcoBoard.py
+++ b/src/argaze/ArUcoMarkers/ArUcoBoard.py
@@ -55,12 +55,10 @@ class ArUcoBoard():
return (self.model.getChessboardSize()[0] - 1 ) * (self.model.getChessboardSize()[1] - 1)
- def save(self, destination_folder: str, dpi: int):
- """Save a picture of the calibration board into a destination folder."""
-
- output_filename = f'{self.dictionary.name}_{self.marker_size}cm_{self.columns*self.square_size}cmx{self.rows*self.square_size}cm.png'
+ def save(self, filepath: str, dpi: int):
+ """Save calibration board picture at a given resolution."""
dimension = [round(d * self.model.getSquareLength() * 100 * dpi / 2.54) for d in self.model.getChessboardSize()] # 1 cm = 2.54 inches
- cv.imwrite(f'{destination_folder}/{output_filename}', self.model.generateImage(dimension))
+ cv.imwrite(filepath, self.model.generateImage(dimension))
diff --git a/src/argaze/utils/aruco_calibration_board_export.py b/src/argaze/utils/aruco_calibration_board_export.py
index cca5bde..c1d1645 100644
--- a/src/argaze/utils/aruco_calibration_board_export.py
+++ b/src/argaze/utils/aruco_calibration_board_export.py
@@ -27,8 +27,9 @@ def main():
# Create aruco board
aruco_board = ArUcoBoard.ArUcoBoard(args.columns, args.rows, args.square_size, args.marker_size, args.dictionary)
- # Export aruco board
- aruco_board.save(args.output, args.resolution)
+ # Export aruco board as png
+ filepath = f'{args.output}/{aruco_board.dictionary.name}_{aruco_board.marker_size}cm_{aruco_board.columns*aruco_board.square_size}cmx{aruco_board.rows*aruco_board.square_size}cm.png'
+ aruco_board.save(filepath, args.resolution)
print(f'{args.columns} x {args.rows} calibration board with {args.marker_size} cm markers from {args.dictionary.name} dictionary exported into {args.output} folder.')