OpenCV 4.11.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::Animation Struct Reference

Represents an animation with multiple frames. The Animation struct is designed to store and manage 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. More...

#include <opencv2/imgcodecs.hpp>

Collaboration diagram for cv::Animation:

Public Member Functions

 Animation (int loopCount=0, Scalar bgColor=Scalar())
 Constructs an Animation object with optional loop count and background color.
 

Public Attributes

CV_PROP_RW Scalar bgcolor
 Background color of the animation in BGRA format.
 
CV_PROP_RW std::vector< int > durations
 Duration for each frame in milliseconds.
 
CV_PROP_RW std::vector< Matframes
 Vector of frames, where each Mat represents a single frame.
 
CV_PROP_RW int loop_count
 Number of times the animation should loop. 0 means infinite looping.
 

Detailed Description

Represents an animation with multiple frames. The Animation struct is designed to store and manage 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.

Examples
samples/cpp/tutorial_code/imgcodecs/animations.cpp.

Constructor & Destructor Documentation

◆ Animation()

cv::Animation::Animation ( int loopCount = 0,
Scalar bgColor = Scalar() )

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

Parameters
loopCountAn integer representing the number of times the animation should loop:
  • 0 (default) indicates infinite looping, meaning the animation will replay continuously.
  • Positive values denote finite repeat counts, allowing the animation to play a limited number of times.
  • If a negative value or a value beyond the maximum of 0xffff (65535) is provided, it is reset to 0 (infinite looping) to maintain valid bounds.
bgColorA Scalar object representing the background color in BGRA format:
  • Defaults to Scalar(), indicating an empty color (usually transparent if supported).
  • This background color provides a solid fill behind frames that have transparency, ensuring a consistent display appearance.

Member Data Documentation

◆ bgcolor

CV_PROP_RW Scalar cv::Animation::bgcolor

Background color of the animation in BGRA format.

◆ durations

CV_PROP_RW std::vector<int> cv::Animation::durations

Duration for each frame in milliseconds.

Examples
samples/cpp/tutorial_code/imgcodecs/animations.cpp.

◆ frames

CV_PROP_RW std::vector<Mat> cv::Animation::frames

Vector of frames, where each Mat represents a single frame.

Examples
samples/cpp/tutorial_code/imgcodecs/animations.cpp.

◆ loop_count

CV_PROP_RW int cv::Animation::loop_count

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


The documentation for this struct was generated from the following file: