Skip to main content

MotionFilter

Drop metadata if there hasn't been any significant change in the image.

This module provides a pipeline element to drop metadata if there hasn't been any significant change in the image. This element takes in a threshold parameter that specifies the minimum amount of change in the image that is required to keep the metadata. Additionally, there is a max_delay_ms parameter that specifies the maximum amount of time that can elapse between frames.

Examples:

REST API:

WIP

Configuration File:

threshold of 25 and max_delay_ms of 200:

```yaml
source:
- address: videos/sd_london_station_sd.mp4
type: file
elements:
- name: motion-filter
args:
threshold: 25
max_delay: 200
```

MotionFilter Objects

class MotionFilter(Element)

Drop metadata if there hasn't been any significant change in the image.

Attributes:

  • name str - The name of the element.
  • threshold int - The threshold for the amount of change in the image that is required to keep the metadata. 0 - 255 (0 is extremely sensitive, 255 is very insensitive)
  • max_delay int - Maximum amount of time (in ms) that can elapse between frames.

Examples:

threshold of 25 and max_delay of 200ms:

```python
ele = MotionFilter(threshold=25, max_delay=200)
```

process

def process(meta: PipelineMetadata)

Drop metadata if there hasn't been any significant change in the image.

This is the main function for this element. it will process the metadata and drop it if there hasn't been any significant change in the image.

Arguments:

  • meta PipelineMetadata - The metadata to process.

Returns:

  • meta PipelineMetadata - The processed metadata.

Examples:

```python
meta = MotionFilter(threshold=25, max_delay=200).process(meta)
```