Key frame extraction method and device, storage medium and electronic equipment

By calculating the temporal content expression value of GIF picture frames and selecting the frame corresponding to the maximum value as the keyframe, the problems of poor accuracy and low efficiency of keyframe extraction in the prior art are solved, and more efficient and accurate keyframe extraction is achieved.

CN119863732APending Publication Date: 2025-04-22BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311370562.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-20
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

In the prior art, the accuracy of keyframe extraction is poor and the efficiency is low, so the main content of the GIF graph cannot be effectively reflected.

Method used

By analyzing GIF picture data, traversing all frame pictures, calculating the time content expression value based on the picture content and duration of the frame picture, and selecting the frame picture corresponding to the maximum value of the time content expression value as the keyframe.

Benefits of technology

Improve the intelligence and efficiency of keyframe extraction, ensuring that keyframes more effectively express the main content of GIF image data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119863732A_ABST
    Figure CN119863732A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of Internet, in particular to a key frame extraction method, a key frame extraction device, a storage medium and electronic equipment. The key frame extraction method comprises the following steps: analyzing GIF (Graphics Interchange Format) picture data to obtain a frame picture set; traversing all frame pictures in the frame picture set, and calculating a time content expression numerical value corresponding to each frame picture based on the picture content and the duration of the frame picture; and taking the frame picture corresponding to the maximum value of the time content expression numerical value as the key frame of the GIF picture data. According to the key frame extraction method provided by the invention, the problems of poor key frame extraction accuracy and low efficiency can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, and in particular to a key frame extraction method, a key frame extraction device, a storage medium and an electronic device. Background Art

[0002] With the development of Internet technology and the continuous upgrading of user experience and marketing methods, there are more and more interface scenes that need to be displayed with animations. GIF format images, due to their high popularity and wide support, often become an important way to realize the functions of such scenes. However, due to the characteristics of GIF format such as lossless compression, transparency, frame animation, etc., it may take up a large amount of memory space in image rendering, which is easy to cause performance problems. In scenarios where performance problems may occur, downgrading GIF dynamic images to static images for display is usually a solution. The most critical step in this solution is how to extract key frames from GIF dynamic images.

[0003] In the prior art, methods for extracting key frames mainly include manually screening key frames, extracting the first frame or the last frame as the key frame, or selecting the frame with the longest duration as the key frame. However, manual screening is costly, inefficient, and the results are not unique. Extracting the first frame or the last frame cannot reflect the main content of the GIF image. Selecting the frame with the longest duration is only based on the time dimension, and the result may not be ideal. Therefore, how to effectively extract key frames has become a difficult problem.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] The purpose of the present disclosure is to provide a key frame extraction method, a key frame extraction device, a storage medium and an electronic device, aiming to solve the problem of poor key frame extraction accuracy and low efficiency.

[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0007] According to one aspect of an embodiment of the present disclosure, a key frame extraction method is provided, including: parsing graphic interchange format GIF picture data to obtain a frame picture set; traversing all frame pictures in the frame picture set to calculate a time content expression value corresponding to each frame picture based on the picture content and duration of the frame picture; and taking the frame picture corresponding to the maximum value of the time content expression as the key frame of the GIF picture data.

[0008] According to some embodiments of the present disclosure, based on the aforementioned scheme, the traversal of all frame pictures in the frame picture set to calculate the time content expression value corresponding to each frame picture based on the picture content and duration of the frame picture includes: determining the currently traversed frame picture based on the frame picture set; preprocessing the currently traversed frame picture based on the picture content of the currently traversed frame picture to obtain a non-transparent pixel point set; calculating the time content expression value of the currently traversed frame picture according to the non-transparent pixel point set and the duration of the currently traversed frame picture; repeating the above steps until all frame pictures are traversed to obtain the time content expression value corresponding to each frame picture.

[0009] According to some embodiments of the present disclosure, based on the aforementioned scheme, the pre-processing of the current traversal frame picture based on the picture content of the current traversal frame picture to obtain a set of non-transparent pixel points includes: removing the background color of the current traversal frame picture based on the picture content of the current traversal frame picture to obtain a first frame of picture data; filtering the transparent pixels in the first frame of picture data to obtain the set of non-transparent pixel points.

[0010] According to some embodiments of the present disclosure, based on the aforementioned scheme, the temporal content expression value of the currently traversed frame picture is calculated according to the non-transparent pixel point set and the duration of the currently traversed frame picture, including: traversing all non-transparent pixel points in the non-transparent pixel point set to obtain the content expression value of each of the non-transparent pixel points; accumulating the content expression value of each of the non-transparent pixel points to obtain the content expression value of the currently traversed frame picture; and calculating the duration coefficient based on the single playback duration of the GIF image data and the duration of the currently traversed frame picture; calculating the temporal content expression value of the currently traversed frame picture according to the content expression value and the duration coefficient.

[0011] According to some embodiments of the present disclosure, based on the aforementioned scheme, traversing all the non-transparent pixels in the non-transparent pixel set to obtain the content expression value of each of the non-transparent pixel points includes: determining the currently traversed non-transparent pixel based on the non-transparent pixel set; obtaining a color difference value according to the color value of the currently traversed non-transparent pixel and the background color value of the currently traversed frame image; substituting the color difference value into a preset exponential function to obtain the content expression value of the currently traversed non-transparent pixel; repeating the above steps until all the non-transparent pixels are traversed to obtain the content expression value of each of the non-transparent pixel points.

[0012] According to some embodiments of the present disclosure, based on the aforementioned scheme, the color difference is obtained according to the color value of the currently traversed non-transparent pixel and the background color value of the currently traversed frame image, including: performing a decolorization operation on the color value of the currently traversed non-transparent pixel to obtain a decolorized color value; taking the absolute value of the difference between the decolorized color value and the background color value as the color difference.

[0013] According to some embodiments of the present disclosure, based on the aforementioned scheme, the color difference value is R1, the content expression value of the non-transparent pixel is R2, and the exponential function is: R2=1-e^(-R1 / 10).

[0014] According to a second aspect of an embodiment of the present disclosure, a key frame extraction device is provided, comprising: a parsing module for parsing GIF picture data to obtain a frame picture set; a traversal module for traversing all frame pictures in the frame picture set to calculate a time content expression value corresponding to each frame picture based on the picture content and duration of the frame picture; and a selection module for taking the frame picture corresponding to the maximum value of the time content expression as the key frame of the GIF picture data.

[0015] According to a third aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the key frame extraction method in the above embodiment is implemented.

[0016] According to a fourth aspect of an embodiment of the present disclosure, an electronic device is provided, characterized in that it includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the key frame extraction method as in the above-mentioned embodiment.

[0017] The exemplary embodiments of the present disclosure may have some or all of the following beneficial effects:

[0018] In the technical solutions provided in some embodiments of the present disclosure, by traversing all the frame images in the GIF image data, the time content expression value corresponding to each frame image is calculated through the dual dimensions of the frame image's image content and duration, and then the frame image corresponding to the maximum value of the time content expression value is extracted as the key frame of the GIF image data. On the one hand, the time content expression value can be automatically calculated according to the frame image's image content and duration, and then the key frame can be determined using the time content expression value, which can avoid the high cost and low efficiency problems brought about by manual screening operations, and can improve the intelligence of key frame extraction and the extraction efficiency; on the other hand, the extraction of key frames based on the two dimensions of image content and duration can effectively improve the search quality of extracted key frames, so that the key frames can more effectively express the main content of the GIF image data.

[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0021] Figure 1 A schematic diagram schematically illustrates a flow chart of a key frame extraction method in an exemplary embodiment of the present disclosure;

[0022] Figure 2 A schematic diagram schematically illustrates an exponential function in an exemplary embodiment of the present disclosure;

[0023] Figure 3 A schematic diagram of a process of traversing non-transparent pixels in an exemplary embodiment of the present disclosure is schematically shown;

[0024] Figure 4 A schematic diagram schematically illustrates a flow chart of a method for traversing frame pictures in an exemplary embodiment of the present disclosure;

[0025] Figure 5 A schematic diagram schematically shows a main process of a key frame extraction method in an exemplary embodiment of the present disclosure;

[0026] Figure 6 A schematic diagram schematically shows the composition of a key frame extraction device in an exemplary embodiment of the present disclosure;

[0027] Figure 7A schematic diagram schematically illustrates a computer-readable storage medium in an exemplary embodiment of the present disclosure;

[0028] Figure 8 The structure diagram of a computer system of an electronic device in an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0029] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete and will fully convey the concept of the example embodiments to those skilled in the art.

[0030] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.

[0031] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0032] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0033] Before the introduction, the technical terms involved in this disclosure are explained:

[0034] GIF: The full name is Graphics Interchange Format, which can be translated as Graphics Interchange Format. It is used to display indexed color images in the form of Hypertext Markup Language. It is widely used on the Internet and other online service systems. Compared with other formats of pictures, its biggest feature is that it supports animation function.

[0035] Frame: The corresponding English word is Frame, which refers to a static image in an animation. GIF animation is composed of a series of frames, which are played in a specific order to form an animation effect.

[0036] Key frame: In this scenario, it specifically refers to a static image that best represents the content of the GIF dynamic image.

[0037] With the development of Internet technology and the continuous upgrading of user experience and marketing methods, there are more and more interface scenes that need to be displayed with animation. GIF format images, due to their high popularity and wide support, often become an important way to realize such scene functions.

[0038] Due to the lossless compression, transparency, frame animation and other characteristics of the GIF format, it may take up a large amount of memory space during image rendering, which can easily cause performance issues. In scenarios where performance issues may occur, downgrading GIF dynamic images to static images for display is usually a solution. The most critical step in this solution is how to extract key frames from GIF dynamic images.

[0039] There are mainly three solutions for extracting key frames from GIF dynamic images in the prior art, but each has some disadvantages.

[0040] Solution 1: Use image processing software to open the GIF dynamic image, display all frames, and manually select the most suitable frame. On the one hand, this method has high manual operation costs and low efficiency; on the other hand, it relies on the operator's own subjective consciousness to select, and the consistency of any operation results cannot be guaranteed.

[0041] Solution 2: Directly extract the first or last frame of the GIF dynamic image as the key frame. However, GIF dynamic images usually consist of many frames, and the core content of the image may appear in any frame. The first or last frame may not reflect the main content of the GIF image.

[0042] Solution 3: Analyze the duration of each frame of the GIF dynamic image and select the frame with the longest duration as the key frame. The disadvantage of this method is that if the duration of each frame is the same, it will not return a unique result. In addition, it only considers the time dimension and ignores the changes in the frame image content itself, which may cause important content to be missed, resulting in the selected frame not being a key frame.

[0043] Therefore, how to effectively extract key frames has become a difficult problem. In view of one or more problems in the prior art, the present application provides a key frame extraction method, which aims to solve the problem of inefficient and low accuracy in extracting key frames from GIF dynamic images.

[0044] The implementation details of the technical solution of the embodiment of the present disclosure are elaborated in detail below.

[0045] Figure 1 The flowchart of a key frame extraction method in an exemplary embodiment of the present disclosure is schematically shown. Figure 1 As shown, the key frame extraction method includes steps S101 to S103:

[0046] Step S101, parsing the GIF picture data to obtain a frame picture set;

[0047] Step S102, traversing all the frame pictures in the frame picture set to calculate the time content expression value corresponding to each of the frame pictures based on the picture content and duration of the frame pictures;

[0048] Step S103, taking the frame image corresponding to the maximum value of the temporal content expression value as the key frame of the GIF image data.

[0049] In the technical solutions provided in some embodiments of the present disclosure, by traversing all the frame images in the GIF image data, the time content expression value corresponding to each frame image is calculated through the dual dimensions of the frame image's image content and duration, and then the frame image corresponding to the maximum value of the time content expression value is extracted as the key frame of the GIF image data. On the one hand, the time content expression value can be automatically calculated according to the frame image's image content and duration, and then the key frame can be determined using the time content expression value, which can avoid the high cost and low efficiency problems brought about by manual screening operations, and can improve the intelligence of key frame extraction and the extraction efficiency; on the other hand, the extraction of key frames based on the two dimensions of image content and duration can effectively improve the search quality of extracted key frames, so that the key frames can more effectively express the main content of the GIF image data.

[0050] The following will describe in more detail the various steps of the key frame extraction method in this example implementation in conjunction with the accompanying drawings and embodiments.

[0051] In step S101, the GIF picture data is parsed to obtain a frame picture set.

[0052] Specifically, firstly, GIF (Graphics Interchange Format) image data is loaded, and the system can use network request APIs such as XHR or Fetch to load GIF image data. Then, the loaded data stream is parsed, for example, an open source GIF parsing library can be used to parse the GIF image data, and then a frame image set of GIF format images is extracted, and the frame image set can be called set A.

[0053] XHR stands for XMLHttpRequest, which is a JavaScript API for sending HTTP requests and receiving responses between browsers and servers. Fetch is a modern JavaScript API for making network requests in browsers. It provides a simpler and more powerful way to handle HTTP requests. Compared with traditional XMLHttpRequest, fetch provides more friendly syntax and functions.

[0054] In step S102, all the frame pictures in the frame picture set are traversed to calculate the time content expression value corresponding to each of the frame pictures based on the picture content and duration of the frame pictures.

[0055] Specifically, for the traversal operation on set A, another array data may be created, called set D, for storing the time content expression values ​​corresponding to the frame images returned in each traversal.

[0056] In one embodiment of the present disclosure, step S102 specifically includes the following steps:

[0057] Step 1 , determining a currently traversed frame picture based on the frame picture set;

[0058] The currently traversed frame picture may be determined according to the order of the frame pictures in the frame picture set.

[0059] Step 2 , preprocessing the current traversal frame picture based on the picture content of the current traversal frame picture to obtain a non-transparent pixel point set;

[0060] The image content of the currently traversed frame image includes multiple pixel points. Specifically, in one embodiment of the present disclosure, the step of obtaining a set of non-transparent pixel points includes: based on the image content of the currently traversed frame image, removing the background color of the currently traversed frame image to obtain the first frame image data; filtering the transparent pixel points in the first frame image data to obtain the non-transparent pixel point set.

[0061] Specifically, an open source image processing library can be used to remove the background color of the current traversal frame image. At the same time, the recognized background color value can be recorded, referred to as color C1, for subsequent use.

[0062] In the present disclosure, the background color specifically refers to the background part that occupies the main area and presents a uniform color in a static image. Decolorization refers to converting a color image into a grayscale image (i.e., expressing the original image in black, white, and gray) through calculation.

[0063] Common decolorization algorithms include:

[0064] Floating point algorithm: Gray = R*0.3+G*0.59+B*0.11

[0065] Integer method: Gray = (R*30+G*59+B*11) / 100

[0066] Shift method: Gray = (R*76+G*151+B*28)>>8

[0067] Average value method: Gray = (R + G + B) / 3

[0068] Only green: Gray = G

[0069] The above decolorization algorithm is only an example and does not limit the present disclosure.

[0070] After the background color is removed, the first frame of image data is obtained, and then a pixel traversal operation is performed on the first frame of image data to filter out transparent pixels. The remaining pixels after filtering are non-transparent pixels, which constitute a non-transparent pixel set, referred to as set B.

[0071] Step 3 , calculating a time content expression value of the current traversal frame image according to the non-transparent pixel point set and the duration of the current traversal frame image;

[0072] In one embodiment of the present disclosure, step three specifically includes:

[0073] (1) traversing all non-transparent pixel points in the non-transparent pixel point set to obtain a content expression value of each of the non-transparent pixel points;

[0074] Specifically, the above steps specifically include the following contents: determining the currently traversed non-transparent pixel based on the non-transparent pixel set; obtaining a color difference according to the color value of the currently traversed non-transparent pixel and the background color value of the currently traversed frame image; substituting the color difference into a preset exponential function to obtain the content expression value of the currently traversed non-transparent pixel; repeating the above steps until all non-transparent pixels are traversed to obtain the content expression value of each of the non-transparent pixels.

[0075] It should be noted that, before the traversal begins, a digital variable, called variable T1, may be created to accumulate the content expression values ​​of the non-transparent pixels returned by each traversal.

[0076] Among them, a non-transparent pixel point is selected from the non-transparent pixel point set, and a common decolorization algorithm is used to perform a decolorization operation on the color value of the pixel point. The color value returned after the operation is called C2.

[0077] In step 2, the background color value C1 has been recorded. C1 is subtracted from C2, and then the absolute value of the result is taken to obtain the color difference, which is called R1.

[0078] Then use an exponential function, the pseudo code is: Y = 1-e^(-X / 10). R1 ​​is used as the input parameter, that is, X in the exponential function, and the return value is called R2, that is, Y in the exponential function, which is the content expression value of the current traversed non-transparent pixel.

[0079] Among them, the exponential function is a mathematical function, and its basic form is f(x) = a^x, where a is a constant, called the base, and x is a variable, representing the exponent. The exponential function uses the value of the variable x as the exponent to calculate the power of the base. It can be used to describe the functional relationship of the exponential growth model and the exponential decay model.

[0080] Figure 2 A schematic diagram schematically illustrates an exponential function in an exemplary embodiment of the present disclosure, such as Figure 2 As shown, when the difference between C1 and C2 values ​​is smaller, R2 is closer to 0, and vice versa, R2 is closer to 1.

[0081] The above steps are performed for each non-transparent pixel to obtain R2 corresponding to each non-transparent pixel.

[0082] Figure 3 The following is a schematic diagram of a flow chart of a method for traversing non-transparent pixels in an exemplary embodiment of the present disclosure. Figure 3 As shown, it shows a complete method for traversing non-transparent pixels, which specifically includes the following steps:

[0083] Step S301, obtaining the currently traversed non-transparent pixel;

[0084] Step S302, decolorizing the color values ​​of non-transparent pixels;

[0085] Step S303, calculating the color difference R1 with the color value of the current traversal frame image after background color processing;

[0086] Step S304, using an exponential function to convert the difference into a content expression value R2 of the currently traversed non-transparent pixel point;

[0087] Repeat the above steps S301 to S304 until all non-transparent pixels are traversed.

[0088] (2) Accumulating the content expression value of each of the non-transparent pixels to obtain the content expression value of the current traversal frame image;

[0089] Specifically, the variable T1 accumulates the content expression value of the non-transparent pixel point returned in each traversal, that is, all R2 are accumulated to obtain the updated variable T1, which is the content expression value of the current traversal frame image.

[0090] (3) calculating a duration coefficient based on a single playback duration of the GIF picture data and a duration of the current traversal frame picture;

[0091] The units of the single play time and the duration time must be the same, for example, both are milliseconds. The duration time coefficient of the current traversal frame image is obtained by dividing the duration time by the single play time, which is called variable T2.

[0092] (4) Calculate the temporal content expression value of the current traversal frame image according to the content expression value and the duration coefficient.

[0093] Specifically, the content expression value T1 of the current traversal frame picture is multiplied by the duration coefficient T2 to obtain the time content expression value of the current traversal frame picture.

[0094] Step 4: Repeat the above steps until all the frame images are traversed to obtain the time content expression value corresponding to each frame image.

[0095] By traversing each currently traversed frame image and repeating the above steps, the time content expression values ​​corresponding to all frame images can be obtained and stored in the set D.

[0096] Figure 4 The following is a schematic diagram of a process flow of a method for traversing frame pictures in an exemplary embodiment of the present disclosure. Figure 4 As shown, it shows a complete method for traversing frame images, which specifically includes the following steps:

[0097] Step S401, obtaining the current traversal frame image;

[0098] Step S402, performing background color removal processing on the current traversal frame image;

[0099] Step S403, traverse each pixel in the current traversal frame image and filter out transparent pixels;

[0100] Step S404, traverse the non-transparent pixels, accumulate the returned values ​​to obtain the content expression value T1 of the current traversed frame image, refer to the process Figure 3 As shown;

[0101] Step S405, T1 is multiplied by the duration coefficient T2 of the current traversal frame picture;

[0102] Step S406, generating a time content expression value of the current traversal frame image.

[0103] Repeat the above steps S401 to S406 until all frame images are traversed.

[0104] In step S103, the frame image corresponding to the maximum value of the temporal content expression value is used as the key frame of the GIF image data.

[0105] Specifically, traverse set D and return the item with the maximum value of the temporal content expression in set D. The serial number of this item represents the serial number of the key frame in set A. Through this serial number, find the frame from set A, draw the frame data into Canvas, and then export it to generate a static image.

[0106] Among them, Canvas is a programmable bitmap canvas element in HTML5, which provides an area for drawing graphics, images, text and animations. The Canvas element uses JavaScript API (usually 2D Context or WebGL Context) to draw and manipulate graphics, allowing developers to implement various drawing functions programmatically.

[0107] Figure 5 The main flow chart of a key frame extraction method in an exemplary embodiment of the present disclosure is schematically shown. Figure 5 As shown, the key frame extraction method specifically includes the following steps:

[0108] Step S501, loading GIF picture data;

[0109] Step S502: extract all the frame images in the GIF image data and perform frame image traversal. The process is as follows: Figure 4 As shown;

[0110] Step S503, extracting the frame image corresponding to the maximum value of the temporal content expression from all traversal results;

[0111] Step S504: export the frame to generate a static image.

[0112] Based on the above method, the key frame search strategy based on the dual dimensions of frame content and time can improve the screening quality of effective content after the background color removal operation of the frame image. The expression weights of different pixels can be distinguished by comparing the content pixels with the background pixels after the color removal operation. At the same time, the frame dwell time is combined as a secondary consideration. The dual-dimensional screening mechanism can effectively improve the quality of key frame search.

[0113] Figure 6 A schematic diagram schematically shows the composition of a key frame extraction device in an exemplary embodiment of the present disclosure, such as Figure 6As shown, the key frame extraction device 600 may include a parsing module 601, a traversal module 602 and a selection module 603. Among them:

[0114] A parsing module 601 is used to parse the GIF picture data to obtain a frame picture set;

[0115] A traversal module 602 is used to traverse all the frame pictures in the frame picture set to calculate the time content expression value corresponding to each of the frame pictures based on the picture content and duration of the frame pictures;

[0116] The selection module 603 is used to use the frame image corresponding to the maximum value of the temporal content expression value as the key frame of the GIF image data.

[0117] According to an exemplary embodiment of the present disclosure, the traversal module 602 includes a determination unit, a preprocessing unit, a calculation unit and a repetition unit, the determination unit is used to determine the current traversal frame picture based on the frame picture set; the preprocessing unit is used to preprocess the current traversal frame picture based on the picture content of the current traversal frame picture to obtain a non-transparent pixel point set; the calculation unit is used to calculate the time content expression value of the current traversal frame picture according to the non-transparent pixel point set and the duration of the current traversal frame picture; the repetition unit is used to repeat the above steps until all frame pictures are traversed to obtain the time content expression value corresponding to each frame picture.

[0118] According to an exemplary embodiment of the present disclosure, the preprocessing unit is also used to remove the background color of the current traversal frame picture based on the picture content of the current traversal frame picture to obtain the first frame picture data; and filter the transparent pixels in the first frame picture data to obtain the non-transparent pixel set.

[0119] According to an exemplary embodiment of the present disclosure, the calculation unit is also used to traverse all non-transparent pixel points in the non-transparent pixel point set to obtain the content expression value of each of the non-transparent pixel points; accumulate the content expression value of each of the non-transparent pixel points to obtain the content expression value of the currently traversed frame image; and calculate the duration coefficient based on the single playback time of the GIF image data and the duration of the currently traversed frame image; calculate the time content expression value of the currently traversed frame image according to the content expression value and the duration coefficient.

[0120] According to an exemplary embodiment of the present disclosure, the calculation unit is also used to determine the currently traversed non-transparent pixel point based on the non-transparent pixel point set; obtain a color difference value according to the color value of the currently traversed non-transparent pixel point and the background color value of the currently traversed frame image; substitute the color difference value into a preset exponential function to obtain the content expression value of the currently traversed non-transparent pixel point; repeat the above steps until all non-transparent pixel points are traversed to obtain the content expression value of each of the non-transparent pixel points.

[0121] According to an exemplary embodiment of the present disclosure, the calculation unit is also used to perform a decolorization operation on the color value of the currently traversed non-transparent pixel to obtain a decolorized color value; and take the absolute value of the difference between the decolorized color value and the background color value as the color difference.

[0122] According to an exemplary embodiment of the present disclosure, the color difference value is R1, the content expression value of the non-transparent pixel is R2, and the exponential function is: R2=1-e^(-R1 / 10).

[0123] The specific details of each module in the key frame extraction device 600 have been described in detail in the corresponding key frame extraction method, so they will not be repeated here.

[0124] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0125] In an exemplary embodiment of the present disclosure, a storage medium capable of implementing the above method is also provided. Figure 7 A schematic diagram schematically illustrates a computer-readable storage medium in an exemplary embodiment of the present disclosure, such as Figure 7 As shown, a program product 700 for implementing the above method according to an embodiment of the present disclosure is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a mobile phone. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0126] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided. Figure 8The structure diagram of a computer system of an electronic device in an exemplary embodiment of the present disclosure is schematically shown.

[0127] It should be noted that Figure 8 The computer system 800 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0128] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 to the random access memory (RAM) 803. In the RAM 803, various programs and data required for system operation are also stored. The CPU 801, the ROM 802 and the RAM 803 are connected to each other through a bus 804. The input / output (I / O) interface 805 is also connected to the bus 804.

[0129] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read therefrom is installed into the storage section 808 as needed.

[0130] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit (CPU) 801, various functions defined in the system of the present disclosure are executed.

[0131] It should be noted that the computer-readable medium shown in the embodiment of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0132] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0133] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0134] As another aspect, the present disclosure further provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

[0135] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0136] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0137] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.

[0138] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A key frame extraction method, characterized in that: include: Parse the GIF picture data to obtain a frame picture set; Traversing all the frame pictures in the frame picture set to calculate the time content expression value corresponding to each of the frame pictures based on the picture content and duration of the frame pictures; The frame image corresponding to the maximum value of the temporal content expression value is used as the key frame of the GIF image data.

2. The key frame extraction method according to claim 1, characterized in that: The traversing all the frame pictures in the frame picture set to calculate the time content expression value corresponding to each of the frame pictures based on the picture content and the duration of the frame pictures includes: Determine a currently traversed frame picture based on the frame picture set; Preprocessing the current traversal frame image based on the image content of the current traversal frame image to obtain a non-transparent pixel point set; Calculating a time content expression value of the current traversal frame image according to the non-transparent pixel point set and the duration of the current traversal frame image; Repeat the above steps until all frame images are traversed to obtain the time content expression value corresponding to each frame image.

3. The key frame extraction method according to claim 2, characterized in that: The preprocessing of the current traversal frame picture based on the picture content of the current traversal frame picture to obtain a non-transparent pixel point set includes: Based on the picture content of the current traversal frame picture, the current traversal frame picture is subjected to background color removal processing to obtain the first frame picture data; The transparent pixels in the first frame of image data are filtered to obtain the non-transparent pixel set.

4. The key frame extraction method according to claim 2, characterized in that: The calculating the time content expression value of the current traversal frame picture according to the non-transparent pixel point set and the duration of the current traversal frame picture includes: Traversing all non-transparent pixel points in the non-transparent pixel point set to obtain a content expression value of each of the non-transparent pixel points; Accumulating the content expression value of each of the non-transparent pixels to obtain the content expression value of the current traversal frame image; and Calculate the duration coefficient based on the single playback duration of the GIF picture data and the duration of the current traversal frame picture; The temporal content expression value of the current traversal frame picture is calculated according to the content expression value and the duration coefficient.

5. The key frame extraction method according to claim 4, characterized in that: The traversing all the non-transparent pixel points in the non-transparent pixel point set to obtain the content expression value of each of the non-transparent pixel points includes: Determine the currently traversed non-transparent pixel based on the non-transparent pixel set; Obtain a color difference value according to the color value of the currently traversed non-transparent pixel and the background color value of the currently traversed frame image; Substituting the color difference into a preset exponential function to obtain a content expression value of the currently traversed non-transparent pixel point; The above steps are repeated until all non-transparent pixels are traversed to obtain the content expression value of each non-transparent pixel.

6. The key frame extraction method according to claim 5, characterized in that: The obtaining of the color difference value according to the color value of the currently traversed non-transparent pixel and the background color value of the currently traversed frame image includes: Performing a decolorization operation on the color value of the currently traversed non-transparent pixel to obtain a decolorized color value; The absolute value of the difference between the decolorized color value and the background color value is taken as the color difference.

7. The key frame extraction method according to claim 5, characterized in that: The color difference is R1, the content expression value of the non-transparent pixel is R2, and the exponential function is: R2=1-e^(-R1 / 10).

8. A key frame extraction device, characterized in that: include: A parsing module, used for parsing the GIF picture data to obtain a frame picture set; A traversal module, used for traversing all the frame pictures in the frame picture set, so as to calculate the time content expression value corresponding to each of the frame pictures based on the picture content and duration of the frame pictures; The selection module is used to use the frame image corresponding to the maximum value of the temporal content expression as the key frame of the GIF image data.

9. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the key frame extraction method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the key frame extraction method as described in any one of claims 1 to 7.