Filters

class pyforkurento.filters.Filter(sess_id, filter_id, pipeline_class)

Bases: pyforkurento.media_element.MediaElement

All filters base class

class pyforkurento.filters.FaceOverlayFilter(session_id, elem_id, pipeline_class)

Bases: pyforkurento.filters.Filter

Detects faces in a video stream and overlays them with a configurable image.

add_event_listener(event, callback)

Adds an event listener function for a specific FaceOverlayFilter event or a general MediaElement event

connect(sink_elem=None)

Connect FaceOverlayFilter to another element

Params:

sink_elem (obj): Media Element to connect to. If left blank, the element connects to itself

set_face_overlay_image(image_uri, offset_x=0.0, offset_y=0.0, width=1.0, height=1.0)

Sets the image to overlay on a detected face

Params:
  • image_uri (str): Location of image to use. Accepted URI schemas are:
    • file:///path/to/file (File on local file system)

    • http(s)://<server-ip>/path/to/file (File on HTTP server)

  • offset_x (float): How much left or right (a ratio of face width) to move the image in reference to detected face’s upper right corner coordinates

  • offset_y (float): How much up or down (a ratio of face height) to move the image in reference to detected face’s upper right corner coordinates

  • width (float) >=0.0 : How much of the face’s width the image should cover e.g. 1.0 means cover the entire width

  • height (float) >=0.0: How much of the face’s height the image should cover e.g. 1.0 means cover the entire height

unset_face_overlay_image()

Removes the image overlayed on faces

class pyforkurento.filters.ImageOverlayFilter(session_id, elem_id, pipeline_class)

Bases: pyforkurento.filters.Filter

Overlays a configurable image on the video stream

add_event_listener(event, callback)

Adds an event listener function for a specific ImageOverlayFilter event or a general MediaElement event

connect(sink_elem=None)

Connect ImageOverlayFilter to another element

Params:

sink_elem (obj): Media Element to connect to. If left blank, the element connects to itself

overlay_image(image_uri, image_id, offset_x=0.0, offset_y=0.0, relative_width=1.0, relative_height=1.0, keep_aspect_ratio=True, to_centre=True)

Draws an image on the video feed at the specified location

Params:
  • image_id (str): A unique identifier for the image. Recommendation: str(uuid.uuid4())

  • image_uri (str): Location of image to use. Accepted URI schemas are:
    • file:///path/to/file (File on local file system)

    • http(s)://<server-ip>/path/to/file (File on HTTP server)

  • offset_x (float) [0 - 1]: Percentage of image width to set overlay image left upper conner X coords

  • offset_y (float) [0 - 1]: Percentage of image height to set overlay image left upper conner Y coords

  • relative_width (float) [0 - 1]: Width of the overlay image in relation to the video stream e.g. 1.0 means full width

  • relative_height (float) [0 - 1]: Height of the overlay image in relation to the video stream e.g. 1.0 means full height

  • keep_aspect_ratio (bool): Whether to keep the image’s aspect ratio

  • to_centre (bool): Whether to centre the image in the region defined

remove_image()

Remove the overlayed image from the stream

class pyforkurento.filters.ZBarFilter(session_id, elem_id, pipeline_class)

Bases: pyforkurento.filters.Filter

Detects QR and bar codes in a video stream. When a code is found, the filter raises a CodeFoundEvent

add_event_listener(event, callback)

Adds an event listener function for a specific ZBarFilter event or a general MediaElement event

Params:
  • event (str): The event to listen for. Accepted:
    • CodeFoundEvent - Triggered when a BarCode or QR code is found in the video stream

  • callback (func): Function to be called when event is registered

connect(sink_elem=None)

Connect ZBarFilter to another element

Params:

sink_elem (obj): Media Element to connect to. If left blank, the element connects to itself

class pyforkurento.filters.GStreamerFilter(session_id, elem_id, pipeline_class)

Bases: pyforkurento.filters.Filter

A generic filter interface that allows usage of GStreamer filters in Kurento Media Pipelines.

add_event_listener(event, callback)

Adds an event listener function for a specific GStreamerFilter event or a general MediaElement event

connect(sink_elem=None)

Connect GStreamerFilter to another element

Params:

sink_elem (obj): Media Element to connect to. If left blank, the element connects to itself