mflowm

MotionFlowMulti - A multi-resolution colorful motion detection video filter.

Submodules

Package Contents

Classes

VideoReader

MotionFlowMulti

A class to handle multi-pass motion flow computation

CompositeMode

Create a collection of name/value pairs.

LayerMode

Create a collection of name/value pairs.

Functions

layer_images(top, bottom, mode)

class mflowm.VideoReader(filename: str, scale: float = 1, scale_method=cv2.INTER_NEAREST)
open() None
close() None
read_frame() None
class mflowm.MotionFlowMulti(video_file: mflowm.files.VideoReader, mode: CompositeMode = CompositeMode.NONE, trails: bool = False, num_windows: int = 7, windows_min: int = 7, windows_max: int = 35, windows_balance: bool = False, layers: int = 1, iterations: int = 3, poly_n: int = 7, poly_sigma: int = 1.5, blur_amount: int = 1.5, fade_speed: float | None = 2)

A class to handle multi-pass motion flow computation

get_next_frame()
convert_to_file(filename_suffix='_flow', output_scale=1, display_scale=1, output_scale_method=cv2.INTER_NEAREST, display_scale_method=cv2.INTER_NEAREST, window_title='Python MotionFlowMulti (mflowm)', quit_key='q', fade_to_black=True)
class mflowm.CompositeMode(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

NONE = 0
SIMPLE = 1
GLITCH = 2
BROKEN_A = 3
BROKEN_B = 4
class mflowm.LayerMode(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

CLIP = 0
INVERT_CLIP = 1
LIGHTEN = 2
DIFFERENCE = 3
mflowm.layer_images(top, bottom, mode)