Skip to main content

LiveCamera

Struct LiveCamera 

Source
pub struct LiveCamera { /* private fields */ }
Expand description

One camera on the frame pipeline: its facts, its source, and the pipeline’s stages.

Frames are shown and kept as the camera sends them. Two opt-ins restrict that: a privacy hook (with_privacy) redacts every frame before any other stage sees it, and cover_people covers every region the detector labels person or face before a frame is shown or kept.

§Example

use std::sync::Arc;
use adk_surface::camera::{CameraFacts, Ingest, LiveCamera, LiveWatch, ZoneFacts};
use adk_vision::stream::{FrameBudget, SurfaceCameraSource};
use adk_vision::{FrameSourceId, GreedyIouTracker, WatchCondition};

let (source, _feed) = SurfaceCameraSource::new(FrameSourceId("line-2".into()));
let camera = LiveCamera::stream(
    CameraFacts::new("line-2", "Line 2 camera", "inspector", "s-line")
        .with_ingest(Ingest::rtsp(640, 360, "the line 2 server")),
    Arc::new(source),
)
.tracker(|| Box::new(GreedyIouTracker::new(0.3, 4)))
.budget(FrameBudget::new(5.0).with_min_local_fps(1.0).with_local_quota(200_000))
.zone(ZoneFacts {
    id: "inspection-window".into(),
    name: "Inspection window".into(),
    corners: [200.0, 140.0, 440.0, 280.0],
})
.watch(LiveWatch::new("crack", "Crack", WatchCondition::new("crack", ["crack"])).in_zone("inspection-window"));

Implementations§

Source§

impl LiveCamera

Source

pub fn stream(facts: CameraFacts, source: Arc<dyn FrameSource>) -> Self

A camera whose frames source reads: an RTSP camera, a file, a screen. It starts on unless facts says otherwise.

Source

pub fn surface(facts: CameraFacts) -> Self

The web home’s own camera (spec 3.7 §7.13 SurfaceCameraSource): frames the voice screen or the camera page captures reach it through Cameras::ingest — the camera page sends them to POST /surface/cameras/{camera}/frames — with no realtime model. It starts off, says it comes “from the web home”, and takes nothing until a person switches it on.

Source

pub fn with_privacy(self, hook: Arc<dyn PrivacyHook>) -> Self

Passes every frame through hook before any other stage sees it, such as RedactorPrivacy::blur_faces; a frame the hook fails on is dropped.

Source

pub fn cover_people(self) -> Self

Covers every region the detector labels person or face, its whole box, before a frame is shown or kept.

Source

pub fn detector(self, runtime: Arc<VisionRuntime>, query: DetectQuery) -> Self

Detects query on every frame through runtime’s detection route.

Source

pub fn detect_options(self, options: CallOptions) -> Self

The detection call’s options: a route, a region of interest.

Source

pub fn tracker( self, make: impl Fn() -> Box<dyn Tracker> + Send + Sync + 'static, ) -> Self

Tracks detections across frames with a tracker make builds for each run of the pipeline, so identifiers start again with each source session (V-I8).

Source

pub fn budget(self, budget: FrameBudget) -> Self

Holds the camera to budget through a frame governor (spec 3.7 §7.9).

Source

pub fn sampling(self, sampling: Sampling) -> Self

Samples the source at sampling; the budget’s local rate by default.

Source

pub fn zone(self, zone: ZoneFacts) -> Self

Adds zone zone, in the camera’s pixels.

Source

pub fn watch(self, watch: LiveWatch) -> Self

Adds watch condition watch.

Source

pub fn escalation( self, backend: impl Into<String>, micros_per_frame: u64, ) -> Self

Escalates unclear tracks to backend, such as sam-3.1, each billed frame costing micros_per_frame micro-USD: PipelineCameras::escalate asks the governor first.

Trait Implementations§

Source§

impl Debug for LiveCamera

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for LiveCamera

§

impl !UnwindSafe for LiveCamera

§

impl Forget for LiveCamera

§

impl Freeze for LiveCamera

§

impl Move for LiveCamera

§

impl Send for LiveCamera
where RawVecInner: Send, NonZero<i32>: Send, Utc: Send, Arc<dyn FrameSource>: Send, Arc<SurfaceCameraSource>: Send, Arc<Shared>: Send, Arc<dyn PrivacyHook>: Send, Arc<VisionRuntime>: Send, Arc<dyn Fn() -> Box<dyn Tracker> + Sync + Send>: Send,

§

impl Sync for LiveCamera
where RawVecInner: Sync, NonZero<i32>: Sync, Utc: Sync, Arc<dyn FrameSource>: Sync, Arc<SurfaceCameraSource>: Sync, Arc<Shared>: Sync, Arc<dyn PrivacyHook>: Sync, Arc<VisionRuntime>: Sync, Arc<dyn Fn() -> Box<dyn Tracker> + Sync + Send>: Sync,

§

impl Unpin for LiveCamera

§

impl UnsafeUnpin for LiveCamera

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more