Struct MotionDetection
pub struct MotionDetection(/* private fields */);
Expand description
Motion detection functionality.
Implementations§
§impl MotionDetection
impl MotionDetection
pub fn grid_height(&self) -> u32
pub fn grid_height(&self) -> u32
Retrieve the height of the motion detection grid.
For more information, see the docs under get_grid
.
pub fn grid_width(&self) -> u32
pub fn grid_width(&self) -> u32
Retrieve the width of the motion detection grid.
For more information, see the docs under get_grid
.
pub fn set_grid_size(&mut self, size: Size) -> Result<(), Error>
pub fn set_grid_size(&mut self, size: Size) -> Result<(), Error>
Set the size of the motion detection grid.
There is a default grid size which scales with the input resolution, so it is not necessary to call this function. If a custom grid size is desired, this function can be called at the start of the application, before processing any frames.
Calling this function re-initializes the motion-detection algorithm so this should only be called at the start of the application.
For more information, see the docs under get_grid
.
§Errors
Error::InvalidGridSize
pub fn get_grid(&self) -> Result<Grid, Error>
pub fn get_grid(&self) -> Result<Grid, Error>
Retrieves the amount of motion found in each grid cell of the frame.
As a by-product of object detection, motion detection is performed. For specific use-cases, it might be useful to access this raw motion detection information as well. This function provides access to it, but it won’t be available in the first few frames.
The values in each grid cell are floats between 0.0 and 1.0, and denote how much motion was detected in that grid cell. A higher value indicates more motion. The height is the outer dimension, and the width is the inner dimension.
§Errors
Error::MotionGridNotYetReady