API Reference
This page provides detailed information about the Locus Python API.
Core Interface
The primary entry point for using Locus is the Detector class.
locus.Detector
Source code in crates/locus-py/locus/__init__.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
Functions
__init__
__init__(decimation: int = 1, threads: int = 0, families: list[TagFamily] | None = None, threshold_tile_size: int = 8, threshold_min_range: int = 10, adaptive_threshold_constant: int = 0, quad_min_area: int = 16, quad_min_fill_ratio: float = 0.1, quad_min_edge_score: float = 4.0, decoder_min_contrast: float = 20.0, max_hamming_error: int = 2, **kwargs: Any)
Source code in crates/locus-py/locus/__init__.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
detect
detect(img: ndarray, intrinsics: CameraIntrinsics | None = None, tag_size: float | None = None, pose_estimation_mode: PoseEstimationMode = PoseEstimationMode.Fast, debug_telemetry: bool = False, **kwargs) -> DetectionBatch
Detect tags in the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img
|
ndarray
|
Input grayscale image (np.uint8). |
required |
intrinsics
|
CameraIntrinsics | None
|
Optional CameraIntrinsics for 3D pose estimation. |
None
|
tag_size
|
float | None
|
Optional physical tag size (meters). |
None
|
pose_estimation_mode
|
PoseEstimationMode
|
Fast or Accurate. |
Fast
|
Returns:
| Type | Description |
|---|---|
DetectionBatch
|
A vectorized DetectionBatch object. |
Source code in crates/locus-py/locus/__init__.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
Configuration
Locus uses Pydantic for robust configuration validation.
locus.DetectorConfig
Bases: BaseModel
Pipeline-level configuration for the Locus detector. These settings are typically set once during detector instantiation.
Source code in crates/locus-py/locus/_config.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
locus.DetectOptions
Bases: BaseModel
Per-call options for tag detection. Controls which tag families to decode for a specific frame.
Source code in crates/locus-py/locus/_config.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
Data Models
These classes represent the output and internal state of the detection pipeline.
locus.DetectionBatch
dataclass
Vectorized detection results.
This dataclass contains parallel NumPy arrays representing a batch of detections.
Source code in crates/locus-py/locus/__init__.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
Attributes
centers
property
centers: ndarray
Compute centers from corners: (N, 2)
locus.Pose
Geometry
locus.CameraIntrinsics
Enumerations
locus.TagFamily
Bases: IntEnum
locus.DecodeMode
Bases: IntEnum
locus.PoseEstimationMode
Bases: IntEnum
locus.CornerRefinementMode
Bases: IntEnum
locus.SegmentationConnectivity
Bases: IntEnum