movis.effect#

The effect module defines base protocols for representing video effects in Effect and BasicEffect. The remaining classes in this module represent its implementations.

Blur effects#

movis.effect.blur.GaussianBlur

Gaussian blur effect.

movis.effect.blur.Glow

Glow effect.

Color correction effects#

movis.effect.color.FillColor

Fill the image with the specified color while preserving the alpha channel.

movis.effect.color.HSLShift

Shift hue, saturation, and luminance of the image.

Layer style effects#

movis.effect.style.DropShadow

Applies drop shadow to the input image.

Protocol#

class movis.effect.protocol.Effect(*args, **kwargs)[source]#

The protocol that defimes the minimal interface for an effect.

__call__(prev_image: ndarray, time: float) ndarray[source]#

The minimum required method to implement an effect. All effects must implement it.

Specifically, given a previous image described as prev_image and a time, it returns a numpy.ndarray of shape (H, W, 4) with RGBA order and dtype as numpy.uint8 given a time.

Args:
prev_time:

A numpy.ndarray of shape (H, W, 4) with RGBA order and dtype as numpy.uint8.

time:

A scalar variable representing time.

Returns:

numpy.ndarray of shape (H, W, 4) with RGBA order and dtype as numpy.uint8.

class movis.effect.protocol.BasicEffect(*args, **kwargs)[source]#

The protocol that defines the basic interface for an effect with some methods.

get_key(time: float) Hashable[source]#

An optional but desirable method for any layer implementation.

This method returns a hashable value representing the ‘state’ of the effect at a given time. If the keys are the same and given images are identical, the array returned by this layer must also be identical. It is used for caching compositions, and in the case of videos where static frames persist, Movis will use the cache to accelerate video rendering.

If not implemented, Movis assumes that the layer is independent at each time frame, i.e., it will not use cache-based rendering.

Returns:

A hashable key that represents the state of the layer at the given time.