oakutils.aruco package
Submodules
oakutils.aruco.finder module
Module for finding aruco markers in images and acquiring transformation matrices to them.
Classes
- ArucoFinder
Use to find ArUco markers in an image.
- class oakutils.aruco.finder.ArucoFinder(aruco_dict: int = 1, marker_size: float = 0.05, calibration: ColorCalibrationData | MonoCalibrationData | None = None)
Bases:
objectClass for finding aruco markers in images and acquiring transformation matrices to them.
- property calibration: ColorCalibrationData | MonoCalibrationData | None
The calibration data used by the ArucoFinder.
- Returns:
The calibration data used by the ArucoFinder
- Return type:
- draw(image: np.ndarray, markers: Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]) np.ndarray
Use to draw the detected markers onto the image.
- Parameters:
- Returns:
A copy of the image with the markers drawn on it
- Return type:
np.ndarray
- find(image: np.ndarray, *, rectified: bool | None = None) Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
Use to find the aruco markers in the image.
Note: Makes an assumption that there is a single marker for each id.
- Parameters:
image (np.ndarray) – The image to find the marker in
rectified (bool, optional) – Whether or not the image is rectified, by default None If None will use the calibration data to undistort the image
- Returns:
The sequence of aruco markers found in the image Each tuple contains the id, transformation matrix, rotation vector, translation vector, and corners
- Return type:
Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
oakutils.aruco.localizer module
Module for localizing the camera in the world using ArUco markers.
Classes
- ArucoLocalizer
Use to localize the camera in the world using ArUco markers.
- class oakutils.aruco.localizer.ArucoLocalizer(transforms: dict[int, np.ndarray], buffersize: int = 5, max_age: int = 5, alpha: float = 0.95)
Bases:
objectLocalizes the camera in the world using ArUco markers.
- add_transform(tag: int, transform: np.ndarray) None
Use to add a transform to the localizer.
- Parameters:
tag (int) – The id of the marker to use
transform (np.ndarray) – The transform from the world to the marker
oakutils.aruco.stream module
Module for filtering aruco marker detections as a continous stream.
Classes
- ArucoStream
Use to filter aruco marker detections as a continous stream.
- class oakutils.aruco.stream.ArucoStream(aruco_dict: int = 1, marker_size: float = 0.05, calibration: ColorCalibrationData | MonoCalibrationData | None = None, buffersize: int = 5, max_age: int = 5, alpha: float = 0.95)
Bases:
objectClass for filtering aruco marker detections as a continous stream.
- draw(image: np.ndarray, markers: Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]) np.ndarray
Use to draw the detected markers onto the image.
- Parameters:
- Returns:
A copy of the image with the markers drawn on it.
- Return type:
np.ndarray
- find(image: np.ndarray, *, rectified: bool | None = None) Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
Use to find the aruco markers in the image and perform filtering.
Note: Makes an assumption that there is a single marker for each id.
- Parameters:
image (np.ndarray) – The image to find the marker in
rectified (bool, optional) – Whether or not the image is rectified, by default None If None will use the calibration data to undistort the image
- Returns:
The list of aruco markers found in the image Each tuple contains the id, transformation matrix, rotation vector, translation vector, and corners
- Return type:
Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
Module contents
Module for ArUco marker detection and localization.
Classes
- ArucoFinder
Use to find ArUco markers in an image.
- ArucoLocalizer
Use to localize the camera within the world frame using ArUco markers.
- ArucoStream
Used on a video stream to find ArUco markers.
- class oakutils.aruco.ArucoFinder(aruco_dict: int = 1, marker_size: float = 0.05, calibration: ColorCalibrationData | MonoCalibrationData | None = None)
Bases:
objectClass for finding aruco markers in images and acquiring transformation matrices to them.
- property calibration: ColorCalibrationData | MonoCalibrationData | None
The calibration data used by the ArucoFinder.
- Returns:
The calibration data used by the ArucoFinder
- Return type:
- draw(image: np.ndarray, markers: Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]) np.ndarray
Use to draw the detected markers onto the image.
- Parameters:
- Returns:
A copy of the image with the markers drawn on it
- Return type:
np.ndarray
- find(image: np.ndarray, *, rectified: bool | None = None) Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
Use to find the aruco markers in the image.
Note: Makes an assumption that there is a single marker for each id.
- Parameters:
image (np.ndarray) – The image to find the marker in
rectified (bool, optional) – Whether or not the image is rectified, by default None If None will use the calibration data to undistort the image
- Returns:
The sequence of aruco markers found in the image Each tuple contains the id, transformation matrix, rotation vector, translation vector, and corners
- Return type:
Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
- class oakutils.aruco.ArucoLocalizer(transforms: dict[int, np.ndarray], buffersize: int = 5, max_age: int = 5, alpha: float = 0.95)
Bases:
objectLocalizes the camera in the world using ArUco markers.
- add_transform(tag: int, transform: np.ndarray) None
Use to add a transform to the localizer.
- Parameters:
tag (int) – The id of the marker to use
transform (np.ndarray) – The transform from the world to the marker
- class oakutils.aruco.ArucoStream(aruco_dict: int = 1, marker_size: float = 0.05, calibration: ColorCalibrationData | MonoCalibrationData | None = None, buffersize: int = 5, max_age: int = 5, alpha: float = 0.95)
Bases:
objectClass for filtering aruco marker detections as a continous stream.
- draw(image: np.ndarray, markers: Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]) np.ndarray
Use to draw the detected markers onto the image.
- Parameters:
- Returns:
A copy of the image with the markers drawn on it.
- Return type:
np.ndarray
- find(image: np.ndarray, *, rectified: bool | None = None) Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
Use to find the aruco markers in the image and perform filtering.
Note: Makes an assumption that there is a single marker for each id.
- Parameters:
image (np.ndarray) – The image to find the marker in
rectified (bool, optional) – Whether or not the image is rectified, by default None If None will use the calibration data to undistort the image
- Returns:
The list of aruco markers found in the image Each tuple contains the id, transformation matrix, rotation vector, translation vector, and corners
- Return type:
Sequence[tuple[int, np.ndarray, np.ndarray, np.ndarray, np.ndarray]]