Struct VideoIntelligence
pub struct VideoIntelligence { /* private fields */ }Expand description
Contains all Plumerai Video Intelligence functionality.
Implementations§
§impl VideoIntelligence
impl VideoIntelligence
pub fn detection_zones(&self) -> DetectionZones
pub fn detection_zones(&self) -> DetectionZones
Returns the detection zone functionality.
§impl VideoIntelligence
impl VideoIntelligence
pub fn face_enrollment_automatic(
&self,
) -> Result<FaceEnrollmentAutomatic, Error>
pub fn face_enrollment_automatic( &self, ) -> Result<FaceEnrollmentAutomatic, Error>
§impl VideoIntelligence
impl VideoIntelligence
pub fn face_enrollment_manual(&self) -> Result<FaceEnrollmentManual, Error>
pub fn face_enrollment_manual(&self) -> Result<FaceEnrollmentManual, Error>
§impl VideoIntelligence
impl VideoIntelligence
pub fn face_identification(&self) -> Result<FaceIdentification, Error>
pub fn face_identification(&self) -> Result<FaceIdentification, Error>
§impl VideoIntelligence
impl VideoIntelligence
pub fn motion_detection(&self) -> MotionDetection
pub fn motion_detection(&self) -> MotionDetection
Returns the motion detection functionality.
§impl VideoIntelligence
impl VideoIntelligence
pub fn object_detection(&self) -> ObjectDetection
pub fn object_detection(&self) -> ObjectDetection
Returns the object detection functionality.
§impl VideoIntelligence
impl VideoIntelligence
pub fn re_identification(&self) -> Result<ReIdentification, Error>
pub fn re_identification(&self) -> Result<ReIdentification, Error>
§impl VideoIntelligence
impl VideoIntelligence
pub fn vlm_video_collection(&self) -> VLMVideoCollection
pub fn vlm_video_collection(&self) -> VLMVideoCollection
Returns the VLM Video Collection functionality.
§impl VideoIntelligence
impl VideoIntelligence
pub fn new(input_resolution: Size) -> Self
pub fn process_frame(
&mut self,
image_pointer: &ImagePointer<'_>,
delta_t: Option<f32>,
) -> Result<(), Error>
pub fn process_frame( &mut self, image_pointer: &ImagePointer<'_>, delta_t: Option<f32>, ) -> Result<(), Error>
Process a single frame from a video sequence.
Make sure the image is right side up. When it is upside down it can still work but accuracy is significantly degraded.
If delta_t is None, the system clock will be used. Otherwise it should be positive.
§Errors
Error::InvalidDeltaTError::NoFaceInViewError::MultipleFacesInViewError::FaceCloseToEdge
pub fn single_image(
&mut self,
image_pointer: &ImagePointer<'_>,
size: ImageSize,
) -> Result<(), Error>
pub fn single_image( &mut self, image_pointer: &ImagePointer<'_>, size: ImageSize, ) -> Result<(), Error>
Process a single image not part of a video sequence.
This should not be used for video data. It can be used for face
enrollments from a set of images. The object detection box id values
obtained after calling single_image are not related to those generated
through process_frame or through other calls to single_image.
Optionally a different size image can be specified.
§Errors
Error::NoFaceInViewError::MultipleFacesInViewError::FaceCloseToEdge
pub fn set_night_mode(&mut self, night_mode: bool)
pub fn set_night_mode(&mut self, night_mode: bool)
Configure the video intelligence algorithm for either day mode color videos (default) or night mode IR videos.
This configures the video intelligence algorithm for optimal performance on day mode color data (default) or on night mode IR data.
After switching from day to night mode or back, the motion detection algorithm will need a couple of video frames to stabilize, so the motion-grid will not be immediately available.
This function does not have to be called before every frame, only when switching from RGB to IR video data or back.
pub fn camera_is_unstable(&mut self)
pub fn camera_is_unstable(&mut self)
Signal that the camera/ISP is unstable.
In some situations, the camera or ISP may be adjusting its settings,
resulting in unstable video frames. This can happen, for example, during
auto-exposure or switching to and from IR mode. After calling this
function, the algorithm will not run motion detection when frames are
processed. When camera_is_no_longer_unstable is called, the algorithm
will reset its internal motion state and continue processing frames as
usual.
Note that this function can also be used when the camera moves, but in
case the movement can be described by a pan and/or tilt speed, it is
recommended to use set_pan_speed and set_tilt_speed instead.
pub fn camera_is_no_longer_unstable(&mut self)
pub fn camera_is_no_longer_unstable(&mut self)
Signal that the camera/ISP is stable again.
Needs to be called some time after camera_is_unstable to re-enable the
Plumerai motion detection. See camera_is_unstable for more information.
pub fn set_pan_speed(
&mut self,
degrees_per_second: f32,
horizontal_fov: f32,
) -> Result<(), Error>
pub fn set_pan_speed( &mut self, degrees_per_second: f32, horizontal_fov: f32, ) -> Result<(), Error>
Set the pan speed of the camera in degrees per second.
This is an optional function for cameras that can pan, e.g. a PTZ camera. Setting the pan speed allows the Plumerai software to compensate for the camera motion. Note that despite the compensation, accuracy will be reduced when the camera is panning, and certain features such as motion detection will be unavailable during this time.
Calling this function means that any subsequent calls to process_frame
assume a pan delta equals to the given pan speed multiplied by the
delta_t parameter of process_frame. Once the pan speed is set, it will
remain set during all subsequent calls to process_frame until this
function is called again. When the camera stops moving, call this function
once with zero as argument.
§Arguments
degrees_per_second: The pan speed in degrees per second. Negative values indicate panning to the left, positive values indicate panning to the right.horizontal_fov: The horizontal field of view in degrees of the camera feed that was passed in to the Plumerai software (note: in case a crop was passed in this can be different from the physical camera’s FOV).
§Errors
Error::InvalidFOVif the given field of view is very small or large, or changed from the last call.
pub fn set_tilt_speed(
&mut self,
degrees_per_second: f32,
vertical_fov: f32,
) -> Result<(), Error>
pub fn set_tilt_speed( &mut self, degrees_per_second: f32, vertical_fov: f32, ) -> Result<(), Error>
Set the tilt speed of the camera in degrees per second.
This is an optional function for cameras that can tilt, e.g. a PTZ camera. Setting the tilt speed allows the Plumerai software to compensate for the camera motion. Note that despite the compensation, accuracy will be reduced when the camera is tilting, and certain features such as motion detection will be unavailable during this time.
Calling this function means that any subsequent calls to process_frame
assume a tilt delta equals to the given tilt speed multiplied by the
delta_t parameter of process_frame. Once the tilt speed is set, it
will remain set during all subsequent calls to process_frame until this
function is called again. When the camera stops moving, call this function
once with zero as argument.
§Arguments
degrees_per_second: The tilt speed in degrees per second. Negative values indicate tilting downwards, positive values indicate tilting upwards.vertical_fov: The vertical field of view in degrees of the camera feed that was passed in to the Plumerai software (note: in case a crop was passed in this can be different from the physical camera’s FOV).
§Errors
Error::InvalidFOVif the given field of view is very small or large, or changed from the last call.
pub fn set_clock_time(&mut self, unix_time_seconds: i64)
pub fn set_clock_time(&mut self, unix_time_seconds: i64)
Set the clock time in seconds since the Unix epoch.
This function can be called once to set the correct time. It does not have to be called on every video frame.
Setting the time is required when using ReIdentification functionality.
At this moment it is not required for other functionality.
When processing a live video stream (e.g. on an edge device), set this to the current time. When processing a pre-recorded video offline, set this to the time at which the video was originally recorded, not the current time.
In Rust, the time can be obtained through std::time::SystemTime.
On edge devices, make sure that the clock is set correctly and not only relying on the default time at boot-up.
§Arguments
unix_time_seconds: The unix timestamp in seconds: the number of seconds since the Unix epoch, i.e. January 1st 1970 at UTC.
pub fn set_camera_name(
&mut self,
unique_name: &str,
user_friendly_name: Option<&str>,
) -> Result<(), Error>
pub fn set_camera_name( &mut self, unique_name: &str, user_friendly_name: Option<&str>, ) -> Result<(), Error>
Set the camera name.
This function can be used to set a unique name for the camera, as well as a user-friendly name.
The unique name is used for multi-camera ReIdentification functionality. This name must be unique among all cameras in the multi-camera setup.
§Arguments
unique_name: A unique name for the camera. The maximum length is 63 bytes.user_friendly_name: A user-friendly name for the camera, orNone. This name does not have to be unique. The maximum length is 63 bytes.
§Errors
Error::InvalidArgumentwhen one of the names is too long.
pub fn get_telemetry(&self) -> Vec<(String, i64)>
pub fn get_telemetry(&self) -> Vec<(String, i64)>
Get telemetry data collected by the Video Intelligence algorithm.
Returns cumulative statistics since the Video Intelligence instance was created or since the last call to this function. All telemetry state is reset to zero after this call. The statistics are returned as key-value pairs.
pub fn store_state(&self) -> Result<State, Error>
pub fn store_state(&self) -> Result<State, Error>
Store the current state of the algorithm.
This function can be used when processing a video in chunks, doing
different chunks at different times or on different machines.
The state can be restored by calling restore_state with the data
returned by store_state. When the library is built with support for
familiar face identification, the state includes the face library.
Constraints:
- The
delta_tparameter ofprocess_framecan not be None after restoring a previous state. - If familiar face identification is enabled, the state can only be stored and restored when not enrolling.
§Errors
Error::StateWhileEnrolling
pub fn restore_state(&mut self, state: State) -> Result<(), Error>
pub fn restore_state(&mut self, state: State) -> Result<(), Error>
Restore the state of the algorithm.
See store_state for more information.
The user must ensure that the height and width of the current object match
the height and width of the state that is being restored.
§Errors
Error::StateWhileEnrollingError::StateSettingsMismatchError::StateCorrupt
pub fn debug_mode_start(
&mut self,
image_options: DebugImageOptions,
) -> Result<(), Error>
pub fn debug_mode_start( &mut self, image_options: DebugImageOptions, ) -> Result<(), Error>
Enable debug mode.
When process_frame is called while debug mode is active, this will store
debug information. This data is meant to be stored to a file to be shared
with Plumerai support for further analysis. These files contain
uncompressed input image data and can become large (several megabytes per
frame). If image_options is set to Exclude, no image data will be
included.
The resulting debug data can be retrieved using debug_mode_end.
§Errors
Error::NotAvailable
pub fn debug_mode_end(&mut self) -> Result<DebugBytes, Error>
pub fn debug_mode_end(&mut self) -> Result<DebugBytes, Error>
pub fn code_version() -> String
pub fn code_version() -> String
Returns the version of the video intelligence code as a date and time.
For other version numbers, see also ObjectDetection::detector_version
for the object detector, and FaceIdentification::embedding_version
for the face embedder.
@return The version of the code as YYYY.MM.DD.HH.MM date and time string.