Table of Contents

Class Animation

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Represents an animation with multiple frames. Stores and manages data for animated sequences such as those from animated formats (e.g., GIF, AVIF, APNG, WebP). It provides support for looping, background color settings, frame timing, and frame storage.

public class Animation : CvObject, IDisposable
Inheritance
Animation
Implements
Inherited Members

Constructors

Animation(int, Scalar?)

Constructs an Animation object with optional loop count and background color.

public Animation(int loopCount = 0, Scalar? bgColor = null)

Parameters

loopCount int

The number of times the animation should loop. 0 (default) indicates infinite looping. Negative values or values beyond 0xffff (65535) are reset to 0.

bgColor Scalar?

Background color of the animation in BGR(A) format. Defaults to an empty color.

Properties

BgColor

Background color of the animation in BGRA format.

public Scalar BgColor { get; set; }

Property Value

Scalar

Durations

Duration for each frame in milliseconds.

public int[] Durations { get; set; }

Property Value

int[]

Frames

Frames of the animation. The getter returns freshly-copied Mat headers that the caller owns and is responsible for disposing.

public Mat[] Frames { get; set; }

Property Value

Mat[]

LoopCount

Number of times the animation should loop. 0 means infinite looping.

public int LoopCount { get; set; }

Property Value

int

StillImage

Image that can be used for the format in addition to the animation, or if animation is not supported in the reader (like in PNG). The getter returns a freshly-copied Mat header that the caller owns and is responsible for disposing.

public Mat StillImage { get; set; }

Property Value

Mat