Blink action generation method, system and device
By calculating the time progress and arc image of the blinking action, a blinking animation is generated, which solves the resource consumption problem of blinking animation effects in microcontrollers, realizes a smooth blinking animation effect and supports multiple styles, and saves hardware resources.
Patent Information
- Application Number
- CN202511682780.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies struggle to achieve blinking animation effects in microcontrollers with limited computing resources, resulting in high hardware resource consumption and excessive RAM/Flash resource usage due to frequent dynamic memory allocation.
By acquiring the time progress of the blinking action, calculating the eyelid pixel value with a preset threshold, constructing an arc image and forming an arc curve, displaying the blink arc and eyelid position based on the time series, and generating a complete blinking action, the animation effect can be achieved with only one image.
Achieve smooth blinking animation effects on devices with limited hardware computing resources, save hardware computing resources, support multiple blinking styles, and are suitable for scenarios with limited computing resources.
Smart Images

Figure CN121639874A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of animation generation, in particular to a blinking action generation method, system and device. BACKGROUND
[0002] Blinking action is an important effect in the field of animation. At present, the animation effect of doll eyes is usually realized by the following two mainstream schemes: one is frame-by-frame animation, which saves the pre-designed eye state (such as open eyes, closed eyes, blinking, etc.) as a plurality of static pictures, and displays them by switching according to the set frame rate to form a coherent blinking animation through the visual persistence effect; the other is to use GIF dynamic picture decoding, and in the device supporting the file system, the GIF file is parsed and played through a third-party library (such as LVGL).
[0003] The existing method has high requirements for computing resources. In a single-chip microcomputer with limited computing resources, it is difficult to realize the blinking animation effect through the above-mentioned way because the realization of complex blinking animation effect has high requirements for hardware resources, and a large amount of RAM / Flash resources will be occupied in the process of frequent dynamic memory allocation for real-time decoding. SUMMARY
[0004] The present application provides a blinking action generation method, system and device to solve the problems in the prior art.
[0005] To solve the above technical problems, the present application solves them through the following technical solutions: A blinking action generation method, comprising the following steps: Obtaining the blinking start time, blinking duration and current time of the blinking action to obtain the blinking time progress of the current frame; Pre-setting a blinking target threshold, obtaining the eyelid pixel value of the current frame through the blinking target threshold and the blinking time progress of the current frame; Constructing a plurality of radian curves and forming a radian image, obtaining the pixel value of the radian image to obtain a radian pixel set, obtaining the corresponding radian curve in the radian image according to the radian pixel set and the eyelid pixel value of the current frame, and obtaining the blinking radian and eyelid position of the current frame based on the radian curve; According to the time sequence, the blinking radian and eyelid position of each frame are continuously displayed to form a complete blinking action within the blinking duration.
[0006] As an implementable manner, the blinking time progress of the current frame is specifically: According to the current time, the blinking start time and the blinking duration, the blinking time progress of the current frame is obtained and is expressed as follows:
[0007] in, This indicates the blink time progress of the current frame. Indicates the current moment. Indicates the moment when a blink begins. Indicates the duration of blinking.
[0008] As one possible implementation, the eyelid pixel value of the current frame includes the following steps: A preset blink target threshold is used to obtain the eyelid pixel value of the current frame based on the blink time progress and the blink target threshold, as shown below:
[0009] in, This represents the eyelid pixel value in the current frame. This indicates the current target threshold for blinking. This indicates the blink time progress of the current frame.
[0010] As one possible implementation, the process of constructing multiple arc curves and forming an arc image, obtaining the pixel values of the arc image, and obtaining an arc pixel set includes the following steps: Construct a blank image, and based on the changes in the eyelids during blinking, set different arc curves in the blank image, with each arc having a different pixel value, to obtain an arc image; Obtain the pixel values of the pixels in the radian image to obtain the radian pixel set.
[0011] As one possible implementation, the step of obtaining the corresponding arc curve in the arc image based on the arc pixel set and the eyelid pixel value of the current frame, and obtaining the blink arc and eyelid position of the current frame based on the arc curve, includes the following steps: Traverse the radian pixel set, obtain the pixels in the radian pixel set that satisfy the eyelid pixel value of the current frame, and obtain the eyelid pixel set; The arc curve in the arc image is obtained by using the eyelid pixel set. The blink arc is obtained based on the arc of the arc curve. The corresponding position of the arc pixels in the arc pixel set that are smaller than the eyelid pixel value of the current frame is obtained to obtain the eyelid position.
[0012] As one possible implementation, it also includes optimizing the eyelid position based on a curve optimization algorithm, wherein the curve optimization algorithm includes a Bézier curve algorithm.
[0013] A blinking motion generation system includes a progress calculation module, a pixel calculation module, a position calculation module, and a motion generation module; The progress calculation module obtains the blink start time, blink duration and current time of the blinking action to obtain the blink time progress of the current frame; The pixel calculation module, preset a blink target threshold, through the blink target threshold and the blink time progress of the current frame, get the eyelid pixel value of the current frame; The position calculation module, construct a plurality of radian curves and form a radian image, acquire the pixel value of the radian image, get a radian pixel set, according to the radian pixel set and the eyelid pixel value of the current frame, get the corresponding radian curve in the radian image, based on the radian curve get the blink radian and the eyelid position of the current frame; The action generation module, according to the time sequence, continuously display the blink radian and the eyelid position of each frame, form the complete blink action in the blink duration.
[0014] A computer readable storage medium, the computer readable storage medium stores a computer program, the computer program is executed by a processor to implement the method as follows: Get the blink start time, the blink duration and the current time of the blink action, get the blink time progress of the current frame; Preset a blink target threshold, through the blink target threshold and the blink time progress of the current frame, get the eyelid pixel value of the current frame; Construct a plurality of radian curves and form a radian image, acquire the pixel value of the radian image, get a radian pixel set, according to the radian pixel set and the eyelid pixel value of the current frame, get the corresponding radian curve in the radian image, based on the radian curve get the blink radian and the eyelid position of the current frame; According to the time sequence, continuously display the blink radian and the eyelid position of each frame, form the complete blink action in the blink duration.
[0015] A blink action generation device, comprising a memory, a processor and a computer program stored in the memory and running on the processor, the processor executes the computer program to implement the method as follows: Get the blink start time, the blink duration and the current time of the blink action, get the blink time progress of the current frame; Preset a blink target threshold, through the blink target threshold and the blink time progress of the current frame, get the eyelid pixel value of the current frame; Construct a plurality of radian curves and form a radian image, acquire the pixel value of the radian image, get a radian pixel set, according to the radian pixel set and the eyelid pixel value of the current frame, get the corresponding radian curve in the radian image, based on the radian curve get the blink radian and the eyelid position of the current frame; According to the time sequence, continuously display the blink radian and the eyelid position of each frame, form the complete blink action in the blink duration.
[0016] The present application has remarkable technical effects due to the above technical solutions. The present application obtains the blink time progress of the current frame by calculating the related time of the blink action, obtains the eyelid pixel value of the current frame by calculating the eyelid time progress of the current frame in combination with the preset blink target threshold, constructs the radian image, obtains the blink radian and the eyelid position of the current frame through the radian pixel set in the radian image and the eyelid pixel value of the current frame, forms the blink action, and further realizes the complete blink action in the blink duration. The method of the present application only needs one image to realize the blink animation of the doll, greatly saves the hardware computing resources, and has good application prospect in the scene where the hardware computing resources are limited. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0018] Figure 1 is a flowchart of the method of the present application; Figure 2 is a whole schematic diagram of the system of the present application; Figure 3 is a schematic diagram of the lower eyelid radian image of the present application; Figure 4 is a schematic diagram of the radian pixel of the present application. DETAILED DESCRIPTION
[0019] The present application will be further described in detail below in combination with the embodiments. The following embodiments are only an explanation of the present application and the present application is not limited to the following embodiments.
[0020] Embodiment 1: A blink action generation method, as shown in Figure 1 includes the following steps: S100, obtaining the blink start time, the blink duration and the current time of the blink action, and obtaining the blink time progress of the current frame; S200, presetting the blink target threshold, obtaining the eyelid pixel value of the current frame through the blink target threshold and the blink time progress of the current frame; S300, constructing a plurality of radian curves and forming a radian image, obtaining the pixel value of the radian image, obtaining the radian pixel set, obtaining the corresponding radian curve in the radian image according to the radian pixel set and the eyelid pixel value of the current frame, and obtaining the blink radian and the eyelid position of the current frame based on the radian curve; S400: Display the blink arc and eyelid position of each frame continuously according to the time sequence to form a complete blinking action within the blink duration.
[0021] This invention enables real-time calculation of the curvature and position of the eyelids on devices with limited hardware computing resources, achieving a smooth blinking animation effect and solving the problem of blinking animations not being generated in scenarios with limited computing resources such as microcontrollers.
[0022] Obtain relevant data for the blinking action to be displayed, including the blink start time, blink duration, and current time. Calculate the blink time progress of the current frame using the blink start time, blink duration, and current time, as shown below:
[0023] in, This indicates the blink time progress of the current frame. Indicates the current moment. Indicates the moment when a blink begins. Indicates the duration of a blink.
[0024] In this embodiment, taking the eyelid during the blinking process as an example, a blinking target threshold is set, whereby the blinking target threshold is used to represent any blinking state during the blinking process, for example: This indicates that the eyes are fully open during blinking. This indicates that the eyes are completely closed during the blinking process, i.e., the closed eye phase: the eyelid pixel value in the current frame changes from... Increase to (Eyelids gradually closing from open), Eye-opening phase: The eyelid pixel value in the current frame changes from... Reduce to (Eyelids gradually opening from closed), the blinking target threshold can also be used to represent effects such as half-open eyes and droopy eyelids. In this embodiment, it is set to... , The eyelid pixel value of the current frame is obtained by using the blink time progress and blink target threshold of the current frame, as shown below:
[0025] in, This represents the eyelid pixel value in the current frame. This indicates the current target threshold for blinking. This indicates the blinking time progress of the current frame. The pixel value ranges from 0x00 to 0xFF, represented in decimal as 0-255. In this embodiment, 0 represents a fully open eye, and 255 represents a closed eye. For example, if the blink is halfway through, the eyelid pixel value is 50%. 255=127.5, after rounding to 127, the eyelid pixel value of the current frame is 127.
[0026] A blank image is constructed, and different radian images are set in the blank image according to the change of the eyelid during the blinking process, as shown in the following formula: Figure 3 The radian image of the lower eyelid is shown in the figure, which records the gradual change of the lower eyelid during the blinking process, such as the intermediate state during the closing process, which is used for drawing each frame of eyelid animation. The method of the embodiment only needs one radian image, that is, the blinking animation effect of multiple frames can be generated dynamically, without the need to store multiple static pictures for generation. When running, only the pixel data of the radian image needs to be parsed, avoiding the occupation of RAM by multiple image preloading in the traditional scheme.
[0027] The radian image is converted into a structured RGB565 pixel array and stored in the device to obtain a radian pixel set, as shown in the following formula: Figure 4 As shown, by comparing the eyelid pixel value of the current frame with the radian pixel set, the pixel points in the radian pixel set that meet the eyelid pixel value of the current frame are obtained, the eyelid pixel point set is obtained, and the corresponding radian curve in the radian image is obtained, that is, the radian curve to be displayed in the radian image is obtained. The radian pixels in the radian pixel set that are less than the eyelid pixel value of the current frame are obtained, and the corresponding pixel position, that is, the eyelid position, is obtained, and the blinking radian is obtained based on the radian of the radian curve.
[0028] In order to make the blinking action more complete and natural, in the embodiment, in order to obtain the position of the eyelid, and when drawing, it is necessary to fill in each pixel value in the eyelid range, obtain the initial eyelid position, and judge the eyelid position of the current frame through the eyelid position of the current frame, that is, the blinking radian, and fill it with the RGB565 color value of the eyelid color to obtain the current frame blinking image. The eyelid color filled can be customized by the user, and the specific process is as follows: uint8_t currentUpperValue = upper[screenY SCREEN_WIDTH + lidX]; if (currentUpperValue<= (uT - 5) || currentLowerValue<= (lT - 18)) { return (21<<11) | (40<<5) | 30; } Wherein, screenY represents the coordinate value of the current screen refresh, , SCREEN_WIDTH represents the width of the plane, and lidX represents the coordinate value of the current plane refresh. Coordinate values.
[0029] The eyelid position and blink radian in each frame are continuously displayed in time sequence, and a blink action in continuous time is formed based on a lightweight difference algorithm (such as linear / quadratic interpolation). Meanwhile, in the embodiment, the opening and closing position of the eyelid in each frame can be controlled by a linear algorithm or a Bezier curve algorithm, so that the opening and closing of the eyelid is more smooth and natural.
[0030] In addition, the embodiment supports modification and customization of the radian image, meets blink actions of different expression styles (such as drowsiness, vigilance, etc.), and supports various scene styles under the premise of not occupying too many resources.
[0031] Embodiment 2: A blink action generation system includes a progress calculation module 100, a pixel calculation module 200, a position calculation module 300, and an action generation module 400. The progress calculation module 100 obtains a blink start time, a blink duration, and a current time of a blink action, and obtains a blink time progress of a current frame. The pixel calculation module 200 presets a blink target threshold, obtains an eyelid pixel value of the current frame through the blink target threshold and the blink time progress of the current frame. The position calculation module 300 constructs a plurality of radian curves and forms a radian image, obtains pixel values of the radian image, obtains a radian pixel set, obtains a corresponding radian curve in the radian image according to the radian pixel set and the eyelid pixel value of the current frame, and obtains a blink radian and an eyelid position of the current frame based on the radian curve. The action generation module 400 continuously displays the blink radian and the eyelid position of each frame in time sequence, and forms a complete blink action in the blink duration.
[0032] Various changes and modifications made without departing from the spirit and scope of the present application, all equivalent technical solutions also belong to the scope of the present application.
[0033] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts between the embodiments can be referred to each other.
[0034] Those skilled in the art will appreciate that embodiments of the present application can be devised for a variety of applications. It is intended that the present application be limited only by the scope of the appended claims, and it is intended that various modifications and alterations made by persons skilled in the art to the illustrative embodiments discussed herein are within the scope, spirit, and scope of the present application. In particular, it is intended that only such limitations in scope and / or application of the present application be present as can be imposed by the patent laws of various jurisdictions in the world.
[0035] The present application is described in reference to the drawings using flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to the present application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal devices to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal devices, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 Figure 1
[0036] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing terminal devices to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 Figure 1
[0037] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal devices to cause a series of operational steps to be performed on the computer or other programmable terminal devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal devices provide steps for implementing the functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 Figure 1
[0038] It is to be understood that: The phrase "one embodiment" or "an embodiment" as used herein does not necessarily refer to the same embodiment, though it can. The phrase "one embodiment" or "an embodiment" can refer to a specific feature, structure, or characteristic in one or more embodiments.
[0039] Moreover, it should be noted that the specific embodiments described in the specification are illustrative only and not restrictive of the patent concept. Equivalent or similar changes or modifications made to the configuration, features and principles described in the patent concept are included in the scope of the patent. Those skilled in the art can make various modifications or supplements to the specific embodiments described or use similar ways to replace them, as long as they do not deviate from the structure of the patent or exceed the scope defined by the claims.
Claims
1. A blink action generation method characterized by comprising: The method comprises the following steps: acquiring a blink start time, a blink duration and a current time of a blink action, and obtaining a blink time progress of a current frame; presetting a blink target threshold, and obtaining an eyelid pixel value of the current frame by the blink target threshold and the blink time progress of the current frame; constructing a plurality of radian curves and forming a radian image, obtaining pixel values of the radian image, obtaining a radian pixel set, obtaining a corresponding radian curve in the radian image according to the radian pixel set and the eyelid pixel value of the current frame, and obtaining a blink radian and an eyelid position of the current frame based on the radian curve; displaying the blink radian and the eyelid position of each frame in sequence to form a complete blink action within the blink duration.
2. The blink action generation method according to claim 1, characterized by, The blink time progress of the current frame is specifically: obtaining the blink time progress of the current frame according to the current time, the blink start time and the blink duration, and representing as follows: wherein, represents the blink time progress of the current frame, represents the current time, represents the blink start time, represents the blink duration.
3. The blink action generation method of claim 1, wherein, The eyelid pixel value of the current frame is specifically: presetting the blink target threshold, and obtaining the eyelid pixel value of the current frame by the blink target threshold and the blink time progress of the current frame, and representing as follows: wherein, represents a current frame eyelid pixel value, represents a current blink target threshold value, represents a current frame blink time progress.
4. The blink action generation method of claim 1, wherein, The constructing a plurality of radian curves and forming a radian image, obtaining pixel values of the radian image, and obtaining a radian pixel set comprise the following steps: constructing a blank image, setting different radian curves in the blank image according to changes of the eyelid in the blink process, and obtaining the radian image with different radian pixel values; obtaining pixel values of pixel points in the radian image to obtain the radian pixel set.
5. The blink action generation method of claim 1, wherein, The obtaining a corresponding radian curve in the radian image according to the radian pixel set and the eyelid pixel value of the current frame, and obtaining a blink radian and an eyelid position of the current frame based on the radian curve comprise the following steps: traversing the radian pixel set, obtaining pixel points in the radian pixel set that satisfy the eyelid pixel value of the current frame to obtain an eyelid pixel point set; obtaining a corresponding radian curve in the radian image through the eyelid pixel point set, obtaining a blink radian based on a radian of the radian curve, obtaining a corresponding position of a radian pixel in the radian pixel set that is less than the eyelid pixel value of the current frame to obtain the eyelid position.
6. The blink action generation method of claim 1, wherein, Further comprising optimizing the eyelid position based on a curve optimization algorithm, wherein the curve optimization algorithm comprises a Bezier curve algorithm.
7. A blink action generation system characterized by comprising: The method comprises a progress calculation module, a pixel calculation module, a position calculation module and an action generation module. The progress calculation module acquires a blink start time, a blink duration and a current time of a blink action, and obtains a blink time progress of a current frame. The pixel calculation module presets a blink target threshold, and obtains an eyelid pixel value of the current frame by the blink target threshold and the blink time progress of the current frame. The position calculation module constructs a plurality of radian curves and forms a radian image, obtains pixel values of the radian image, obtains a radian pixel set, obtains a corresponding radian curve in the radian image according to the radian pixel set and the eyelid pixel value of the current frame, and obtains a blink radian and an eyelid position of the current frame based on the radian curve. The action generation module displays the blink radian and the eyelid position of each frame in sequence to form a complete blink action within the blink duration.
8. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 7. The computer program is executed by a processor to implement the method of any one of claims 1 to 6.
9. A blink action generation apparatus comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, The processor implements the method as claimed in any one of claims 1 to 6 when executing the computer program.