mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #27013 from asmorkalov:as/imencode_animation
Test for in-memory animation encoding and decoding #27013 Tests for https://github.com/opencv/opencv/pull/26964 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
committed by
GitHub
parent
bbcdbca872
commit
7481cb50b5
@@ -388,6 +388,19 @@ The function imreadanimation loads frames from an animated image file (e.g., GIF
|
||||
*/
|
||||
CV_EXPORTS_W bool imreadanimation(const String& filename, CV_OUT Animation& animation, int start = 0, int count = INT16_MAX);
|
||||
|
||||
/** @brief Loads frames from an animated image buffer into an Animation structure.
|
||||
|
||||
The function imdecodeanimation loads frames from an animated image buffer (e.g., GIF, AVIF, APNG, WEBP) into the provided Animation struct.
|
||||
|
||||
@param buf A reference to an InputArray containing the image buffer.
|
||||
@param animation A reference to an Animation structure where the loaded frames will be stored. It should be initialized before the function is called.
|
||||
@param start The index of the first frame to load. This is optional and defaults to 0.
|
||||
@param count The number of frames to load. This is optional and defaults to 32767.
|
||||
|
||||
@return Returns true if the buffer was successfully loaded and frames were extracted; returns false otherwise.
|
||||
*/
|
||||
CV_EXPORTS_W bool imdecodeanimation(InputArray buf, CV_OUT Animation& animation, int start = 0, int count = INT16_MAX);
|
||||
|
||||
/** @brief Saves an Animation to a specified file.
|
||||
|
||||
The function imwriteanimation saves the provided Animation data to the specified file in an animated format.
|
||||
@@ -402,6 +415,26 @@ These parameters are used to specify additional options for the encoding process
|
||||
*/
|
||||
CV_EXPORTS_W bool imwriteanimation(const String& filename, const Animation& animation, const std::vector<int>& params = std::vector<int>());
|
||||
|
||||
/** @brief Encodes an Animation to a memory buffer.
|
||||
|
||||
The function imencodeanimation encodes the provided Animation data into a memory
|
||||
buffer in an animated format. Supported formats depend on the implementation and
|
||||
may include formats like GIF, AVIF, APNG, or WEBP.
|
||||
|
||||
@param ext The file extension that determines the format of the encoded data.
|
||||
@param animation A constant reference to an Animation struct containing the
|
||||
frames and metadata to be encoded.
|
||||
@param buf A reference to a vector of unsigned chars where the encoded data will
|
||||
be stored.
|
||||
@param params Optional format-specific parameters encoded as pairs (paramId_1,
|
||||
paramValue_1, paramId_2, paramValue_2, ...). These parameters are used to
|
||||
specify additional options for the encoding process. Refer to `cv::ImwriteFlags`
|
||||
for details on possible parameters.
|
||||
|
||||
@return Returns true if the animation was successfully encoded; returns false otherwise.
|
||||
*/
|
||||
CV_EXPORTS_W bool imencodeanimation(const String& ext, const Animation& animation, CV_OUT std::vector<uchar>& buf, const std::vector<int>& params = std::vector<int>());
|
||||
|
||||
/** @brief Returns the number of images inside the given file
|
||||
|
||||
The function imcount returns the number of pages in a multi-page image (e.g. TIFF), the number of frames in an animation (e.g. AVIF), and 1 otherwise.
|
||||
|
||||
Reference in New Issue
Block a user