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#
Gaussian blur effect. |
|
Glow effect. |
Color correction effects#
Fill the image with the specified color while preserving the alpha channel. |
|
Shift hue, saturation, and luminance of the image. |
Layer style effects#
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 anumpy.ndarray
of shape(H, W, 4)
with RGBA order and dtype asnumpy.uint8
given a time.- Args:
- prev_time:
A
numpy.ndarray
of shape(H, W, 4)
with RGBA order and dtype asnumpy.uint8
.- time:
A scalar variable representing time.
- Returns:
numpy.ndarray
of shape(H, W, 4)
with RGBA order and dtype asnumpy.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.