Refactor find_extrinsic_object.py: update object points parquet file name, enhance type annotations with MarkerFace TypedDict for diamond ArUco markers, and improve code organization.
This commit is contained in:
@ -1,21 +1,44 @@
|
|||||||
import cv2
|
|
||||||
from cv2 import aruco
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from loguru import logger
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, cast, Final
|
from typing import Final, Optional, TypedDict, cast
|
||||||
|
|
||||||
import awkward as ak
|
import awkward as ak
|
||||||
from cv2.typing import MatLike
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from cv2 import aruco
|
||||||
|
from cv2.typing import MatLike
|
||||||
|
from jaxtyping import Int, Num
|
||||||
|
from loguru import logger
|
||||||
|
|
||||||
NDArray = np.ndarray
|
NDArray = np.ndarray
|
||||||
CALIBRATION_PARQUET = Path("output") / "usbcam_cal.parquet"
|
CALIBRATION_PARQUET = Path("output") / "usbcam_cal.parquet"
|
||||||
OBJECT_POINTS_PARQUET = Path("output") / "object_points.parquet"
|
# OBJECT_POINTS_PARQUET = Path("output") / "object_points.parquet"
|
||||||
|
OBJECT_POINTS_PARQUET = Path("output") / "standard_box_markers.parquet"
|
||||||
DICTIONARY: Final[int] = aruco.DICT_4X4_50
|
DICTIONARY: Final[int] = aruco.DICT_4X4_50
|
||||||
# 400mm
|
# 400mm
|
||||||
MARKER_LENGTH: Final[float] = 0.4
|
MARKER_LENGTH: Final[float] = 0.4
|
||||||
|
|
||||||
|
|
||||||
|
class MarkerFace(TypedDict):
|
||||||
|
"""
|
||||||
|
for diamond ArUco markers, N is 4
|
||||||
|
"""
|
||||||
|
|
||||||
|
name: str
|
||||||
|
"""
|
||||||
|
a label for the face
|
||||||
|
"""
|
||||||
|
ids: Int[NDArray, "N"]
|
||||||
|
"""
|
||||||
|
ArUco marker ids
|
||||||
|
"""
|
||||||
|
corners: Num[NDArray, "N 4 3"]
|
||||||
|
"""
|
||||||
|
Corner coordinates in 3D of rectangle,
|
||||||
|
relative to the world origin
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def gen():
|
def gen():
|
||||||
API = cv2.CAP_AVFOUNDATION
|
API = cv2.CAP_AVFOUNDATION
|
||||||
cap = cv2.VideoCapture(0, API)
|
cap = cv2.VideoCapture(0, API)
|
||||||
|
|||||||
Reference in New Issue
Block a user