pub struct LocusEngine { /* private fields */ }Expand description
A shared, thread-safe detection engine.
Separates the immutable pipeline configuration from mutable per-frame state,
enabling one engine to be shared across many threads. Each concurrent caller
either supplies its own FrameContext (explicit API) or leases one from the
engine’s internal lock-free pool (implicit API via LocusEngine::detect_concurrent).
§Construction
let engine = locus_core::DetectorBuilder::new()
.with_family(TagFamily::AprilTag36h11)
.build_engine();Implementations§
Source§impl LocusEngine
impl LocusEngine
Sourcepub fn new(
config: DetectorConfig,
decoders: Vec<Box<dyn TagDecoder + Send + Sync>>,
pool_size: usize,
) -> Self
pub fn new( config: DetectorConfig, decoders: Vec<Box<dyn TagDecoder + Send + Sync>>, pool_size: usize, ) -> Self
Create a new engine with a pre-populated context pool.
pool_size must be ≥ 1. Callers should use DetectorBuilder::build_engine
rather than calling this directly.
Sourcepub fn detect_with_context<'ctx>(
&self,
img: &ImageView<'_>,
ctx: &'ctx mut FrameContext,
intrinsics: Option<&CameraIntrinsics>,
tag_size: Option<f64>,
pose_mode: PoseEstimationMode,
debug_telemetry: bool,
) -> Result<DetectionBatchView<'ctx>, DetectorError>
pub fn detect_with_context<'ctx>( &self, img: &ImageView<'_>, ctx: &'ctx mut FrameContext, intrinsics: Option<&CameraIntrinsics>, tag_size: Option<f64>, pose_mode: PoseEstimationMode, debug_telemetry: bool, ) -> Result<DetectionBatchView<'ctx>, DetectorError>
Run the detection pipeline using an explicitly supplied context.
The returned [DetectionBatchView] borrows from ctx; drop the view before
calling this method again on the same context or returning it to the pool.
§Errors
Returns DetectorError if the input image is invalid.
Sourcepub fn detect_concurrent(
&self,
frames: &[ImageView<'_>],
intrinsics: Option<&CameraIntrinsics>,
tag_size: Option<f64>,
pose_mode: PoseEstimationMode,
) -> Vec<Result<Vec<Detection>, DetectorError>>
pub fn detect_concurrent( &self, frames: &[ImageView<'_>], intrinsics: Option<&CameraIntrinsics>, tag_size: Option<f64>, pose_mode: PoseEstimationMode, ) -> Vec<Result<Vec<Detection>, DetectorError>>
Detect tags in multiple frames concurrently using Rayon.
Pool contexts are leased to Rayon threads; each result is assembled into an
owned Vec<Detection> before the context is returned. Telemetry is
unavailable in this mode (debug overhead would outlive the arena).
If the pool is exhausted (more concurrent callers than pool size), a temporary overflow context is allocated and discarded after use.
Sourcepub fn set_families(&mut self, families: &[TagFamily])
pub fn set_families(&mut self, families: &[TagFamily])
Clear all decoders and replace them with the given tag families.
Sourcepub fn config(&self) -> DetectorConfig
pub fn config(&self) -> DetectorConfig
Get the current detector configuration.
Auto Trait Implementations§
impl !Freeze for LocusEngine
impl !RefUnwindSafe for LocusEngine
impl Send for LocusEngine
impl Sync for LocusEngine
impl Unpin for LocusEngine
impl UnsafeUnpin for LocusEngine
impl !UnwindSafe for LocusEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.