Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

652 allow setting of legacy pattern for charuco #655

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion caliscope/calibration/charuco.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(
aruco_scale=0.75,
square_size_overide_cm=None,
inverted=False,
legacy_pattern=False
): # after printing, measure actual and return to overide
"""
Create board based on shape and dimensions
Expand All @@ -54,6 +55,7 @@ def __init__(
# to maximize size of squares
self.square_size_overide_cm = square_size_overide_cm
self.inverted = inverted
self.legacy_pattern = legacy_pattern

@property
def board_height_cm(self):
Expand Down Expand Up @@ -105,12 +107,15 @@ def board(self):

aruco_length = square_length * self.aruco_scale
# create the board
return cv2.aruco.CharucoBoard(size=(self.columns, self.rows),
board = cv2.aruco.CharucoBoard(size=(self.columns, self.rows),
squareLength= square_length,
markerLength= aruco_length,
dictionary= self.dictionary_object,
)

logger.info(f"Setting legacy pattern of board to {self.legacy_pattern}")
board.setLegacyPattern(self.legacy_pattern)
return board

def board_img(self, pixmap_scale=1000):
"""
Expand Down
7 changes: 7 additions & 0 deletions caliscope/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ def get_charuco(self) -> Charuco:
logger.info("Loading charuco from config")
params = self.dict["charuco"]

# the below is intended to catch people using older configs without this info
# if you come across this in mid 2025 or later, these may be safe to delete
logger.info(f"charuco param are: {params}:")
if "legacy_pattern" not in params.keys():
params["legacy_pattern"]=False

charuco = Charuco(
columns=params["columns"],
rows=params["rows"],
Expand All @@ -210,6 +216,7 @@ def get_charuco(self) -> Charuco:
aruco_scale=params["aruco_scale"],
square_size_overide_cm=params["square_size_overide_cm"],
inverted=params["inverted"],
legacy_pattern=params["legacy_pattern"]
)

return charuco
Expand Down
2 changes: 2 additions & 0 deletions caliscope/gui/charuco_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def build_charuco(self):
# a
inverted = self.charuco_config.invert_checkbox.isChecked()
dictionary_str = self.params["dictionary"]
legacy_pattern = self.params["legacy_pattern"]

self.charuco = Charuco(
columns,
Expand All @@ -153,6 +154,7 @@ def build_charuco(self):
aruco_scale=aruco_scale,
square_size_overide_cm=square_edge_length,
inverted=inverted,
legacy_pattern=legacy_pattern
)

if not self.charuco_added:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "caliscope"
version = "0.5.2"
version = "0.5.3"
description = "GUI based multicamera calibration that integrates with 2D landmark tracking to triangulate 3D landmark positions"
authors = ["Mac Prible <[email protected]>"]
license = "BSD-2-Clause"
Expand Down