diff --git a/ar_tag_pose/ar_tag_pose.py b/ar_tag_pose/board_pose.py similarity index 97% rename from ar_tag_pose/ar_tag_pose.py rename to ar_tag_pose/board_pose.py index 54b126b..4eea6a0 100644 --- a/ar_tag_pose/ar_tag_pose.py +++ b/ar_tag_pose/board_pose.py @@ -3,11 +3,11 @@ import math import cv2 as cv import numpy as np from pathlib import Path -from utils import to_board_pose_euler +from .utils import to_board_pose_euler RESULTS_FOLDER = "results" -class ArTagPose(abc.ABC): +class BoardPose(abc.ABC): detector: cv.aruco.ArucoDetector | cv.aruco.CharucoDetector = None board: cv.aruco.GridBoard | cv.aruco.CharucoBoard = None mtx = None @@ -77,7 +77,7 @@ class ArTagPose(abc.ABC): # Open camera cap = cv.VideoCapture(0) - ArTagPose.cap_init(cap) + BoardPose.cap_init(cap) if not cap.isOpened(): print("Cannot open camera") diff --git a/ar_tag_pose/ar_tag_pose_aruco_board.py b/ar_tag_pose/board_pose_aruco.py similarity index 94% rename from ar_tag_pose/ar_tag_pose_aruco_board.py rename to ar_tag_pose/board_pose_aruco.py index 43f303f..1957577 100644 --- a/ar_tag_pose/ar_tag_pose_aruco_board.py +++ b/ar_tag_pose/board_pose_aruco.py @@ -1,7 +1,7 @@ import cv2 as cv import numpy as np -from ar_tag_pose import ArTagPose -from aruco_types import ARUCO_DICT +from .board_pose import BoardPose +from .types import ARUCO_DICT def factory(dict_type: int, board_size: cv.typing.Size, marker_length: float=100.0, marker_sep=10): aruco_dict = cv.aruco.getPredefinedDictionary(dict_type) @@ -13,9 +13,9 @@ def factory(dict_type: int, board_size: cv.typing.Size, marker_length: float=100 return detector, board, name -class ArTagPoseArucoBoard(ArTagPose): +class BoardPoseAruco(BoardPose): def __init__(self, dict_type: int, board_size: tuple[int, int]): - ArTagPose.__init__(self) + BoardPose.__init__(self) self.board_size = board_size self.detector, self.board, self.name = factory(dict_type, board_size) @@ -84,7 +84,7 @@ class ArTagPoseArucoBoard(ArTagPose): return pose, r_vec, t_vec def main(): - pose = ArTagPoseArucoBoard(10, (5,5)) + pose = BoardPoseAruco(10, (5, 5)) pose.board_image_generate(margin_length=10) pose.calibrate_load() pose.process() diff --git a/ar_tag_pose/ar_tag_pose_charuco_board.py b/ar_tag_pose/board_pose_charuco.py similarity index 94% rename from ar_tag_pose/ar_tag_pose_charuco_board.py rename to ar_tag_pose/board_pose_charuco.py index 87ac8ad..ad68509 100644 --- a/ar_tag_pose/ar_tag_pose_charuco_board.py +++ b/ar_tag_pose/board_pose_charuco.py @@ -1,7 +1,7 @@ import cv2 as cv import numpy as np -from ar_tag_pose import ArTagPose -from aruco_types import ARUCO_DICT +from .board_pose import BoardPose +from .types import ARUCO_DICT def factory(dict_type: int, board_size: cv.typing.Size, square_length: float = 5.0, marker_length: float = 3.0): aruco_dict = cv.aruco.getPredefinedDictionary(dict_type) @@ -13,9 +13,9 @@ def factory(dict_type: int, board_size: cv.typing.Size, square_length: float = 5 return detector, board, name -class ArTagPoseCharucoBoard(ArTagPose): +class BoardPoseCharuco(BoardPose): def __init__(self, dict_type: int, board_size: tuple[int, int]): - ArTagPose.__init__(self) + BoardPose.__init__(self) self.board_size = board_size self.detector, self.board, self.name = factory(dict_type, board_size) @@ -82,7 +82,7 @@ class ArTagPoseCharucoBoard(ArTagPose): return pose, r_vec, t_vec def main(): - pose = ArTagPoseCharucoBoard(10, (6,7)) + pose = BoardPoseCharuco(10, (6, 7)) pose.board_image_generate() pose.calibrate_load() pose.process() diff --git a/ar_tag_pose/aruco_types.py b/ar_tag_pose/types.py similarity index 100% rename from ar_tag_pose/aruco_types.py rename to ar_tag_pose/types.py