create results folder if not exists
This commit is contained in:
@@ -2,8 +2,11 @@ import abc
|
|||||||
import math
|
import math
|
||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
import numpy as np
|
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 ArTagPose(abc.ABC):
|
||||||
detector: cv.aruco.ArucoDetector | cv.aruco.CharucoDetector = None
|
detector: cv.aruco.ArucoDetector | cv.aruco.CharucoDetector = None
|
||||||
board: cv.aruco.GridBoard | cv.aruco.CharucoBoard = None
|
board: cv.aruco.GridBoard | cv.aruco.CharucoBoard = None
|
||||||
@@ -15,6 +18,9 @@ class ArTagPose(abc.ABC):
|
|||||||
obj_points_list = []
|
obj_points_list = []
|
||||||
img_points_list = []
|
img_points_list = []
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Path.mkdir(Path(RESULTS_FOLDER), exist_ok=True)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def cap_init(cap: cv.VideoCapture):
|
def cap_init(cap: cv.VideoCapture):
|
||||||
cap.set(cv.CAP_PROP_SETTINGS, 1)
|
cap.set(cv.CAP_PROP_SETTINGS, 1)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ def factory(dict_type: int, board_size: cv.typing.Size, marker_length: float=100
|
|||||||
|
|
||||||
class ArTagPoseArucoBoard(ArTagPose):
|
class ArTagPoseArucoBoard(ArTagPose):
|
||||||
def __init__(self, dict_type: int, board_size: tuple[int, int]):
|
def __init__(self, dict_type: int, board_size: tuple[int, int]):
|
||||||
|
ArTagPose.__init__(self)
|
||||||
self.board_size = board_size
|
self.board_size = board_size
|
||||||
self.detector, self.board, self.name = factory(dict_type, board_size)
|
self.detector, self.board, self.name = factory(dict_type, board_size)
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ def factory(dict_type: int, board_size: cv.typing.Size, square_length: float = 5
|
|||||||
|
|
||||||
class ArTagPoseCharucoBoard(ArTagPose):
|
class ArTagPoseCharucoBoard(ArTagPose):
|
||||||
def __init__(self, dict_type: int, board_size: tuple[int, int]):
|
def __init__(self, dict_type: int, board_size: tuple[int, int]):
|
||||||
|
ArTagPose.__init__(self)
|
||||||
self.board_size = board_size
|
self.board_size = board_size
|
||||||
self.detector, self.board, self.name = factory(dict_type, board_size)
|
self.detector, self.board, self.name = factory(dict_type, board_size)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user