ZividTarget
SUMMARY
ZividTarget is a Zivid-style board: a checkerboard plus a single ArUco fiducial near one corner, usually printed straight onto a black plate with no white quiet zone. Examples are the Zivid ZVDA-CB01 (7 x 8 squares of 30 mm) and ZVDA-CB02 (5 x 6 squares of 20 mm). The fiducial fixes the board frame, so the pose you get back is tied to the physical board however it is rotated in the image. See All Supported Targets for the other target types.
The Skill
from telekinesis.axon.targets import ZividTarget
zivid = ZividTarget(
squares=(7, 8), # checker squares, not inner corners
square_size=0.030, # meters
aruco_dict_id="DICT_4X4_50",
marker_id=-1, # -1 accepts any single marker of the dictionary
)Initialization
| Parameter | Type | Default | Description |
|---|---|---|---|
squares | tuple[int, int] | (7, 8) | (cols, rows) of checker squares. The inner-corner grid is one fewer in each direction. At least (3, 3). |
square_size | float | 0.030 | Square edge length, in meters. |
aruco_dict_id | int | str | DICT_4X4_50 | Dictionary of the fiducial, by OpenCV enum value or name (e.g. "DICT_4X4_50"). |
marker_id | int | -1 | Fiducial id to accept. -1 accepts any single marker of the dictionary. |
When you pass aruco_dict_id by name, also pass squares and square_size. The integer form keeps all defaults, so ZividTarget() describes a ZVDA-CB01.
import cv2
cb01 = ZividTarget() # ZVDA-CB01: 7 x 8 squares of 30 mm
cb02 = ZividTarget(squares=(5, 6), square_size=0.020, aruco_dict_id=cv2.aruco.DICT_4X4_50)CHECK YOUR BOARD'S FIDUCIAL
Zivid does not publish the fiducial's id or exact position. Leave marker_id=-1 (any single marker of the dictionary), or read the id off your physical board, e.g. from the marker_id returned by detect(), and set it. If detection fails on every image, check that aruco_dict_id matches the printed fiducial.
Properties
| Property | Type | Description |
|---|---|---|
squares | tuple[int, int] | (cols, rows) of checker squares. |
inner_corners | tuple[int, int] | (cols, rows) of inner corners, read-only. (6, 7) for the default board. |
square_size | float | Square edge length, in meters. |
aruco_dict_id | int | Fiducial dictionary, as an OpenCV enum value. |
marker_id | int | Accepted fiducial id, or -1. |
Board Frame
The origin is the inner corner nearest the fiducial. x runs along the board edge with squares[0] - 1 inner corners, y along the other edge, and z = x × y is normal to the board. Because the fiducial sets the frame, the origin stays on the same physical corner even when the board is rotated 180 degrees in the image, and a square board cannot swap its axes.
object_points() and the corners from detect() both follow this frame. Corners come row by row from the origin, inner_corners[0] per row.
Skills
| Method | Returns | Description |
|---|---|---|
object_points() | (N, 3) ndarray | Board-frame 3D coordinates of every inner corner, row-major from the origin. |
detect(image) | dict | None | Detect the full board and the fiducial, see detect(). |
detect_and_annotate(image) | (ndarray, int) | Detect the board and draw the corners, the fiducial and the board axes on a copy. The count is either all inner corners or 0. |
detect()
detection = zivid.detect(image)
if detection is not None:
detection["corners"] # (N, 1, 2) float32, board-frame order, aligned with object_points()
detection["marker_corners"] # (4, 1, 2) float32, the fiducial's corners
detection["marker_id"] # int, id of the fiducial that was used
detection["inverted"] # True if the checkerboard was only found in the inverted imagedetect() returns None unless it finds every inner corner and exactly one matching fiducial that clearly sits nearest one corner of the grid. Partial views are rejected, so keep the whole board and its fiducial in frame.
Images can be BGR, BGRA or grayscale. Detection is built for black plates:
- Inverted image. On a black plate the outer black squares merge with the plate, so the detector also tries the inverted image, where the plate becomes the white border the checkerboard finder expects.
- Either fiducial polarity. Black-on-white and white-on-black markers are both decoded.
- Small fiducials. If the marker is too small to decode at full resolution, detection retries on a 2x upsampled image.
- Grids at the image border. A padded retry helps when the grid runs up to the image edge. Corners that land on or outside the border are still rejected, because their position cannot be measured accurately.
The Code
import cv2
from telekinesis.axon import IntrinsicCalibrator
from telekinesis.axon.targets import ZividTarget
zivid = ZividTarget(squares=(7, 8), square_size=0.030, aruco_dict_id="DICT_4X4_50")
image = cv2.imread("frame.png")
annotated_image, num_corners = zivid.detect_and_annotate(image)
print(f"Detected {num_corners} of {zivid.object_points().shape[0]} inner corners")
calibrator = IntrinsicCalibrator(zivid)
result = calibrator.calibrate(images)ZividTarget works anywhere a target is accepted: IntrinsicCalibrator, EyeInHandCalibrator, MultiCameraCalibrator, CalibrationBenchmark and DataCollector. With DataCollector, set min_corners no higher than the number of inner corners (42 for a ZVDA-CB01), since a frame reports either all of them or none.
Best Practices
| Do this | Why |
|---|---|
| Keep the whole board and the fiducial in every frame | A view without the fiducial cannot fix the board frame and is dropped |
Check marker_id on your own board, or leave it at -1 | Zivid does not publish the fiducial id or position |
Pass squares as checker squares, not inner corners | A ZVDA-CB01 is (7, 8) squares, which gives (6, 7) inner corners |
| Leave a margin between the board and the image edge | Corners on the image border are rejected, so the whole view is dropped |
Measure square_size on the physical board | A wrong board size scales every translation, and no reprojection error will reveal it |