An image generation method, system and electronic device of a flag fluttering animation
Patent Information
- Application Number
- CN202611143462.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-10-16
AI Technical Summary
当旗面发生大幅褶皱、自由边翻转、自遮挡或重新显露时,部分图案会暂时退出可见区域,普通像素匹配或光流方法难以持续确定其材料来源;而直接采用标准纹理映射,又依赖准确、连续的三维网格及材料坐标
[0054] (1) The present invention generates multiple material coding fields based on the material coordinates in the national flag material domain, and obtains paired animation responses under the condition that the basic motion data remains consistent. The material transmission relationship is determined and corrected by the response difference, so that the generation source of the national flag pattern is separated from the flag movement process. This can maintain the naturalness of the national flag waving shape, occlusion and flipping process, and maintain the consistency of the material source of the standard national flag pattern at different animation moments, avoiding the drift, proliferation or redrawing of the pattern as the semantic completion of the generation model occurs.
Smart Images

Figure CN122929033A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer image processing and generation technology, and in particular to an image generation method, system and electronic device for an animation of a national flag waving. Background Technology
[0002] With the development of image generation, video generation, and neural rendering technologies, generating waving animations with wind-driven movement, wrinkle changes, occlusion, and flipping effects from single national flag images has been gradually applied in digital media, virtual scenes, and visual display fields. Existing technologies typically extract the national flag region from the input image and then predict subsequent image frames through physical simulation, deformation mapping, optical flow propagation, or generative models. While these methods can create continuous motion, the flag's motion state, pattern appearance, and occlusion completion are often determined by the same generation process, and the model can easily regenerate occluded areas based on local color or pattern semantics.
[0003] The national flag pattern has defined color areas, number of graphics, positional relationships, boundary order, and front-back correspondence. When the flag undergoes significant wrinkling, free edge flipping, self-occlusion, or re-revealing, parts of the pattern temporarily disappear from the visible area. Ordinary pixel matching or optical flow methods struggle to continuously determine their material origin; while directly using standard texture mapping relies on accurate and continuous 3D meshes and material coordinates. For implicit generation or dynamic reconstruction processes, hidden areas may be resampled, causing pattern elements to drift in position, change in quantity, misaligned boundaries, or front-back confusion in subsequent frames.
[0004] Furthermore, while enhancing the recognizability of material regions through location encoding can improve the generative model's judgment of flag deformation, occlusion, and motion rhythm, leading to different motion results under different encoding conditions, the added encoding information may also affect the model's judgment of flag deformation, occlusion, and motion rhythm. Therefore, how to identify the actual transmission relationship between the flag material and the animated image without changing the basic motion state, and how to use this transmission relationship to constrain the cross-time generation of the standard flag pattern, are problems that the existing technology still needs to solve. Summary of the Invention
[0005] This invention overcomes the shortcomings of the prior art and provides a method, system, and electronic device for generating images of a national flag waving.
[0006] To achieve the above objectives, the technical solution adopted by this invention is as follows: A method for generating images of a national flag waving animation, comprising:
[0007] S1. Obtain the image of the national flag to be processed, the standard national flag template, and the animation control data; determine the national flag material domain, the standard national flag pattern, and the basic motion data.
[0008] S2. Generate multiple material coding fields that correspond to the material coordinates in the national flag material domain;
[0009] S3. Under the condition that the basic motion data remains consistent, generate paired animation responses based on the forward material code and reverse material code corresponding to each material code field;
[0010] S4. Determine the candidate material transmission relationship based on the response difference between the multiple material coding fields and the corresponding paired animation responses;
[0011] S5. Based on the consistency between the candidate material transmission relationships corresponding to different material coding fields and the material continuity constraint corresponding to the national flag material domain, the candidate material transmission relationship is corrected to obtain the target material transmission relationship;
[0012] S6. Based on the target material transmission relationship, the standard national flag pattern is transmitted to each animation moment to generate multiple animation image frames, and the multiple animation image frames are spliced together in chronological order to obtain the national flag waving animation.
[0013] In a preferred embodiment of the present invention, S1 includes:
[0014] Identify the national flag region and the flagpole connecting edge in the national flag image to be processed;
[0015] Based on the standard national flag template, the national flag area is mapped to a preset material coordinate range to obtain the national flag material domain;
[0016] Extract the standard national flag pattern corresponding to the national flag material field from the standard national flag template;
[0017] Based on the flag image to be processed and the animation control data, the flag movement states corresponding to multiple animation moments are generated to obtain the basic motion data.
[0018] In a preferred embodiment of the present invention, the animation control data includes at least one of wind direction data, wind speed data, flutter amplitude data, animation duration data, and animation frame rate data;
[0019] The basic motion data includes at least one of the following: flag deformation data, flag orientation data, flag occlusion data, camera data, and randomly generated states.
[0020] In a preferred embodiment of the present invention, S2 includes:
[0021] The national flag material domain is divided into multiple material units according to a preset division rule;
[0022] The multiple material coding fields are obtained by generating corresponding coding values based on the material coordinates of each material unit.
[0023] Among them, different material coding fields meet preset distinction conditions, and the material coding fields include at least one of binary coding fields, grayscale coding fields, phase coding fields, multi-scale spatial coding fields, and local pulse coding fields.
[0024] In a preferred embodiment of the present invention, step S3 includes:
[0025] The flag motion state, camera state, and randomly generated state are fixed when generating each pair of animation responses;
[0026] Generate positive and negative material codes with opposite coding amplitudes for the same material coding field;
[0027] The forward material encoding and reverse material encoding are applied to the national flag material domain respectively to obtain forward encoded data and reverse encoded data;
[0028] Based on the same basic motion data, positive animation response and negative animation response are generated according to the forward encoded data and the reverse encoded data respectively, and the positive animation response and negative animation response are used as the paired animation response.
[0029] In a preferred embodiment of the present invention, step S4 includes:
[0030] Determine the response difference between the positive and negative animation responses corresponding to the same material coding field;
[0031] A material coding matrix is established based on the multiple material coding fields, and an animation response matrix is established based on the response difference corresponding to each material coding field;
[0032] The transmission matrix is determined based on the material encoding matrix and the animation response matrix;
[0033] Based on the transmission matrix, the correspondence between the material units in the national flag material domain and the image sampling positions at each animation moment is determined, thereby obtaining the candidate material transmission relationship.
[0034] In a preferred embodiment of the present invention, step S5 includes:
[0035] Based on the transmission relationship of candidate materials corresponding to different material coding fields, the transmission deviation corresponding to the same material unit is determined;
[0036] The transport relationship of the candidate materials is adjusted based on the transport deviation and the material continuity constraint.
[0037] The material continuity constraints include at least one of the following: material position constraints corresponding to the flagpole connecting edge, material adjacency constraints between adjacent material units, material address continuity constraints of the same material unit at different animation times, pattern correspondence constraints between the front and back of the national flag, and correspondence constraints between the occlusion state and visibility weight of the material unit.
[0038] The material transport relationship that satisfies the material continuity constraint and whose difference from the candidate material transport relationship meets the preset correction condition is determined as the target material transport relationship.
[0039] In a preferred embodiment of the present invention, it further includes:
[0040] Based on the aforementioned basic motion data, determine the target animation time periods where occlusion, re-revealing, free edge flipping, or front-back switching occurs;
[0041] Determine the target material sub-region corresponding to the target animation time period;
[0042] An additional material coding field is generated based on the material coordinates in the target material sub-region, and additional paired animation responses are generated while maintaining consistency with the basic motion data;
[0043] Update the candidate material transport relationship corresponding to the target animation period based on the response difference between the additional material coding field and the additional paired animation response.
[0044] The target material transport relationship is re-determined based on the updated candidate material transport relationship, and the animation image frame corresponding to the target animation period is generated based on the re-determined target material transport relationship.
[0045] A system for generating images of a national flag waving, comprising:
[0046] The data determination module is used to acquire the image of the national flag to be processed, the standard national flag template, and the animation control data, and to determine the national flag material domain, the standard national flag pattern, and the basic motion data.
[0047] The encoding generation module is used to generate multiple material encoding fields that correspond to the material coordinates in the national flag material field.
[0048] The response generation module is used to generate paired animation responses based on the forward and reverse material codes corresponding to each material coding field, provided that the basic motion data remains consistent.
[0049] The transmission relationship determination module is used to determine the transmission relationship of candidate materials based on the response difference between the multiple material coding fields and the corresponding pairs of animation responses;
[0050] The transmission relationship correction module is used to correct the candidate material transmission relationship based on the consistency between the candidate material transmission relationships corresponding to different material coding fields and the material continuity constraint corresponding to the national flag material domain, so as to obtain the target material transmission relationship.
[0051] An animation generation module is used to transmit the standard national flag pattern to each animation moment according to the target material transmission relationship, generate multiple animation image frames, and splice the multiple animation image frames in chronological order to obtain the national flag waving animation.
[0052] An electronic device includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the image generation method for the animation of a waving national flag as described in any one of claims 1 to 8.
[0053] This invention addresses the shortcomings of the prior art and has the following beneficial effects:
[0054] (1) The present invention generates multiple material coding fields based on the material coordinates in the national flag material domain, and obtains paired animation responses under the condition that the basic motion data remains consistent. The material transmission relationship is determined and corrected by the response difference, so that the generation source of the national flag pattern is separated from the flag movement process. This can maintain the naturalness of the national flag waving shape, occlusion and flipping process, and maintain the consistency of the material source of the standard national flag pattern at different animation moments, avoiding the drift, proliferation or redrawing of the pattern as the semantic completion of the generation model occurs.
[0055] (2) The present invention sets forward material coding and reverse material coding for the same material coding field, and generates paired animation responses under the same flag movement state, camera state and generation state. By reducing the interference of common motion, lighting and background information on material position recognition through the difference between the two responses, the discernibility of the correspondence between material unit and image sampling position is directly improved. Compared with the existing technology that relies on ordinary optical flow, single position coding or frame-by-frame feature matching, it can reduce the erroneous association caused by occlusion, repeated patterns and similar color areas.
[0056] (3) Based on the consistency between the candidate material transmission relationships obtained from different material coding fields, and combined with continuous constraints such as flagpole connecting edge, material adjacency, cross-time material address, front and back patterns and occlusion visibility weight, the present invention corrects the candidate material transmission relationship so that the re-revealed pattern still corresponds to the same material area before occlusion. Compared with the existing method of directly supplementing the occlusion area by the generation model, it can reduce the misalignment, repetition, missing and front and back confusion of stars, stripes or color boundaries during the flipping and re-revealing process.
[0057] (4) The present invention uses basic motion data to maintain the flag deformation and occlusion process, and uses the corrected target material transmission relationship to transmit the standard national flag pattern, so that motion generation and standard pattern generation are respectively constrained by basic motion state and material address relationship. This combination solves the contradiction between enhancing the recognizability of pattern position easily interfering with the flag movement and maintaining the naturalness of movement easily causing pattern redrawing. Without adding artificial marks to the real national flag and without saving the complete three-dimensional mesh point by point, the pattern standardization and temporal stability of long-term national flag animation are improved. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a flowchart of the method of the present invention;
[0060] Figure 2 This is a block diagram of the module connection of the image generation system of the present invention;
[0061] Figure 3 This is a hardware structure block diagram of the electronic device of the present invention. Detailed Implementation
[0062] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein. Therefore, the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0064] The specific implementation method is further described below in conjunction with the technical solution of the present invention. The implementation method takes the generation of continuous waving animation from single or a small number of national flag images as the main application object. It is applicable to digital media display, virtual scene construction, cultural propaganda image production, sports broadcast packaging, digital twin environment, and other image or video generation scenarios that need to maintain the standardization of national flag patterns. The national flag images to be processed used in the implementation process can be obtained by camera shooting, video frame extraction, image database reading, or graphic rendering. The standard national flag template can be a vector template, raster template, or texture template obtained by discretizing a vector template according to the publicly available specifications of the corresponding country or region.
[0065] The material referred to in this invention does not refer only to the textile material used to make a physical national flag, but rather to the surface unit on the flag that moves with the deformation of the flag cloth and has a relatively fixed address in the material coordinate system. The material coordinates are used to identify the physical source of the pattern attached to the flag cloth, and the image coordinates are used to identify the sampling position of the material unit projected onto the output screen at a certain animation moment. By establishing the transmission relationship between the material coordinates and the image coordinates, it is possible to determine where each visible pattern pixel originates from the standard national flag template even when the flag cloth wrinkles, self-occludes, flips, and re-reveals.
[0066] Where there is no conflict, the following embodiments and the technical features thereof can be combined with each other. Except for parameters explicitly marked as fixed values, the numerical ranges listed herein are used to provide candidate calibration intervals for parameters, and do not imply that any parameter within the interval can be used unconditionally without regard to input resolution, flag projection scale, occlusion degree, and response noise. First, endpoints and several intermediate values are selected within the candidate interval to generate a test response. Then, at least three of the following are used as acceptance conditions: encoded response signal-to-noise ratio, saturation clipping ratio, encoded signature distinguishability, flagpole connection edge drift, material address temporal residual, and local topology legality. Only values that simultaneously satisfy the corresponding acceptance conditions are considered as valid parameters for the current task.
[0067] To verify the correspondence between parameter ranges and technical effects, parameter calibration can be performed at low, medium, and high flutter amplitudes, as well as at three time periods: unobstructed, partially obstructed, and re-revealed. When the value is at the low end of the candidate range, the main verification is whether the response is higher than the noise. When the value is at the high end, the main verification is whether it causes saturation, coding aliasing, excessive smoothing, or motion branching changes. The intermediate values are used to confirm that there are no abrupt changes in positioning error and continuity residual that would cause the technical solution to fail.
[0068] The valid values determined by the above repeatable detection rules are used to achieve the expected technical effects of material address identification, recovery after occlusion, and no drift of standard pattern boundaries.
[0069] Example 1:
[0070] like Figure 1 As shown in the figure, this embodiment provides a method for generating an image of a national flag waving animation, the method including the following steps:
[0071] S1. Obtain the image of the national flag to be processed, the standard national flag template, and the animation control data; determine the national flag material domain, the standard national flag pattern, and the basic motion data.
[0072] S2. Generate multiple material coding fields that correspond to the material coordinates in the national flag material domain.
[0073] S3. Under the condition that the basic motion data remains consistent, generate paired animation responses based on the forward material code and reverse material code corresponding to each material code field.
[0074] S4. Determine the candidate material transmission relationship based on the response difference between multiple material coding fields and corresponding pairs of animation responses.
[0075] S5. Based on the consistency between the candidate material transmission relationships corresponding to different material coding fields and the material continuity constraint corresponding to the national flag material domain, the candidate material transmission relationships are corrected to obtain the target material transmission relationship.
[0076] S6. Based on the target material transmission relationship, transmit the standard national flag pattern to each animation moment, generate multiple animation image frames, and splice the multiple animation image frames in time order to obtain the national flag waving animation.
[0077] This method utilizes the flag image to be processed and animation control data to establish a basic motion process without material detection disturbance. Then, material codes with opposite amplitudes are applied to the same basic motion process, so that each group of forward and reverse animation responses shares the same flag deformation, camera, lighting, occlusion sequence, and random generation state. The two responses are subtracted to weaken the common motion component and background component, and differential information related to the propagation of material codes is extracted. The actual destination of material units is inverted based on the differential signatures of multiple coding fields in the output image. The inversion results are corrected by constraints such as flagpole connection edge, adjacency topology, cross-time continuity, front and back correspondence, and visibility state. The standard flag pattern is transmitted using the corrected material address.
[0078] The main challenge of this invention is that the large-scale non-rigid deformation of the flag can cause the same material unit to exhibit changes in scale, orientation, and visibility at different animation moments. Local materials may completely disappear after self-occlusion and reappear after several frames. The generated model may also re-determine the wrinkle shape or movement rhythm due to changes in input encoding. If the output pixels under different encoding conditions are directly compared, encoding differences, motion differences, lighting differences, and random noise will be mixed together, making it difficult to determine whether the response change comes from the material position or from motion resampling. Therefore, this invention fixes the basic motion data, adopts positive and negative pair encoding, introduces multi-encoding consistency and material continuity constraints, so that the material transmission relationship can be identified and used stably outside the motion generation process.
[0079] Example 2:
[0080] The system can first read the original image of the national flag as an appearance reference, the standard template as the source of the standard pattern, and the parameters that control the animation rhythm and wind state. Then, it can separate the flag surface and its position connected to the flagpole from the original image, uniformly register the position of each material on the flag surface into the preset two-dimensional material coordinate system, and at the same time generate a set of basic motion records that only describe how the flag surface moves, how it is covered, and from what perspective it is observed.
[0081] The flag image to be processed refers to two-dimensional image data containing the complete or partial flag area. Its data format can be a floating-point image in RGB, RGBA, YCbCr or linear color space. In addition to the flag area, the image may also include flagpole, sky, buildings or other background objects. The flag image to be processed is used to provide the initial flag outline, initial posture, local lighting, flagpole position and scene background.
[0082] Among them, the standard national flag template refers to the template data that records the color partitions, number of graphics, shape of graphics, relative positions, boundary order and aspect ratio of the national flag in accordance with the predetermined specifications. The template may include front texture, back texture, nominal color value, allowable color difference range and pattern positioning points. The standard national flag pattern refers to the standard texture content obtained from the template and prepared to be attached to the material domain.
[0083] Among them, animation control data refers to the control quantities used to determine the motion characteristics of the target animation, including at least one of wind direction data, wind speed data, fluttering amplitude data, animation duration data, animation frame rate data, gravity direction, cloth damping, flagpole posture, camera motion trajectory, and random seed. The control quantities can be input by the user or generated by preset schemes, sensor data, or control models.
[0084] Among them, the flag material domain refers to the two-dimensional parameter domain representing the physical surface of the flag in a material coordinate system separate from the output image coordinates. Preferably, the material coordinates are denoted as... Where u represents the normalized position along the length of the flag, v represents the normalized position along the height of the flag, and the flagpole connecting edge corresponds to... or with Adjacent narrow band regions, free edges corresponding to or with Adjacent narrow band regions.
[0085] Among them, basic motion data refers to the data set that describes the flag motion state at each animation moment without relying on the standard pattern to be transmitted. It includes at least one of the following: flag deformation data, flag orientation data, flag occlusion data, camera data, and randomly generated states. Basic motion data can be explicitly represented as 3D mesh vertices, normals, depth, and visibility, or implicitly represented as deformation fields, optical flow fields, depth fields, occlusion masks, motion latent variables, or repeatedly invoked generated states.
[0086] The acquisition operation is used to establish a unified data entry point for subsequent processing. By recording the image source, template version, control parameters, and random state, the same basic motion process can be repeatedly called by forward material coding and reverse material coding, thereby avoiding uncontrollable output differences caused by different data reading order or random initialization.
[0087] Specifically, the system reads the national flag image to be processed and parses the image width, height, number of channels, color space, and transparency information; it reads the corresponding standard national flag template according to the national flag category or user-specified identifier, and verifies the template's aspect ratio, color area, and pattern positioning information; it reads the animation control data and converts it into internal control vectors; it generates the task identifier and random seed for this task, and stores the input image summary, template version number, control vector, and random seed together.
[0088] Preferably, the short side resolution of the national flag image to be processed is between 256 pixels and 4096 pixels. If it is lower than this range, bicubic interpolation or super-resolution network can be used to enlarge it first. If it is higher than this range, an image pyramid can be established for hierarchical processing. The animation frame rate is preferably between 12 frames per second and 120 frames per second, and the animation duration is preferably between 0.5 seconds and 30 seconds. The wind speed parameter can be a normalized mapping value between 0 meters per second and 25 meters per second. The random seed uses a 32-bit or 64-bit integer and remains unchanged throughout the generation of all paired responses.
[0089] Among them, the flag area recognition is used to determine which input pixels belong to the flag surface that is deformed by the wind, and the flagpole connection edge recognition is used to establish a fixed reference for material coordinates. The connection edge usually has a small displacement or is constrained by the flagpole in physical movement, so it can be used as the anchor position for subsequent transmission relationship correction.
[0090] Specifically, the national flag image to be processed undergoes denoising, color linearization, and size normalization; a national flag region mask is obtained using semantic segmentation, interactive contour annotation, joint color and edge segmentation, or template matching. ; Detect the set of boundary points in the national flag area that are connected to the flagpole area or aligned with a preset fixed direction; Fit the boundary point set with a straight line, curve, or piecewise curve to obtain the flagpole connecting edge. ; Remove false detection regions based on connectivity and area thresholds and fill mask holes.
[0091] Preferably, image preprocessing can employ bilateral filtering or nonlocal mean filtering with a radius of 1 to 5 pixels. The minimum retained area of the segmentation mask is preferably 0.2% to 80% of the total image area. The length of the flagpole connecting edge is preferably not less than 30% of the estimated flag height. When the fitting residual of the connecting edge is greater than 5% of the flag height or the detection confidence is less than 0.6, manual correction, key point reselection, or a backup positioning process based on the template aspect ratio is triggered.
[0092] The mapping operation converts the flag area in the input image affected by perspective, wrinkles and initial pose into a unified parameter domain corresponding to the physical material address, so that the subsequent encoded value is determined by the material coordinates rather than the current image position. Therefore, even if the same material unit moves, flips or is temporarily occluded in the animation, its encoded identity remains unchanged.
[0093] Specifically, a fixed boundary for the material domain is established using the two endpoints or multiple uniform sampling points of the flagpole connecting edge; the free edge, top edge, and bottom edge are determined along the outline of the national flag area, and a normalized rectangular domain is constructed according to the aspect ratio of the standard national flag template. The coordinates of the input image are obtained through thin-plate splines, piecewise affine transformation, biharmonic parameterization, mean coordinate parameterization, or deformable mesh fitting. Material coordinates Initial bidirectional mapping between and The system detects folding, out-of-bounds errors, and local area distortions in the mapping and corrects them using boundary constraints and smoothing regularization.
[0094] Preferably, the number of units in the material mesh is determined based on the flag projection size and the size of the smallest key graphic in the standard template. First, the flag projection width and height are obtained from the flag area mask. Then, the smallest key graphic is made to cover no less than 4 material units along its shortest direction, and the projection side length of the ordinary material unit in the output image is preferably 2 to 8 pixels.
[0095] At a standard resolution, the total number of material units can range from 1,024 to 131,072. When the flag projection width is less than 128 pixels, it can be reduced to 256 to 4,096. Too few units will result in insufficient positioning of pattern boundaries and narrow folds, while too many units will reduce unit response energy and increase coding costs. Therefore, the minimum graphic coverage requirement and a coding response signal-to-noise ratio of not less than 3 should be taken as common acceptance conditions.
[0096] In mapping optimization, the boundary constraint weights can be used as a candidate search range of 2 to 50 times the smoothing weights, and the local area scaling ratio is used as a validity check interval of 0.1 to 10. If the directional area of any grid cell is negative or the area ratio of adjacent cells exceeds 20, the region is marked as a low confidence region and neighborhood interpolation or local reparameterization is used.
[0097] The standard pattern extraction is used to separate the standard colors and graphic content from accidental lighting, dirt, occlusion or compression distortion in the input image, so that the flag pattern in the final animation comes from the standard template, while the input image is mainly used to determine the initial shape, scene appearance and motion conditions.
[0098] Specifically, the standard national flag template is cropped or margined according to the aspect ratio of the material domain; the template color is converted to linear RGB, CIELAB, or other color spaces suitable for interpolation; and the template is sampled based on the center coordinates or vertex coordinates of the material units to obtain the front standard texture. Read the independent back template when the target flag displays a specific specification on the back. Otherwise, the back texture is generated from the front template based on the physical flipping relationship of the flag; the pattern boundary, key graphic center, color partition boundary and uncrossable topological boundary are recorded as auxiliary information for subsequent correction.
[0099] Preferably, template sampling adopts bilinear, bicubic, or area average methods. Templates containing small stars, emblems, or text preferably use a texture resolution of no less than 4 times the material mesh resolution and perform anti-aliasing sampling during the output stage. Before color conversion, non-standard display gamma in the image file should be removed. Transparent areas of the template are recorded with independent transparency channels. It is prohibited to use the generation model to semantically redraw the standard national flag pattern itself.
[0100] The role of basic motion data is to first determine the deformation, orientation, obstruction and observation conditions of the flag at each moment, and then test the propagation results of different material codes under the same motion conditions. The structure of motion first and then detection can block the reverse influence of material codes on motion generation decisions.
[0101] Specifically, a two-dimensional or three-dimensional initial state of the flag surface is established based on the national flag area, the flagpole connecting edge, and the material domain; wind direction, wind speed, waving amplitude, duration, and frame rate are converted into external force or motion control sequences for each time step; and time-sequence data is generated through cloth physics simulation, differentiable rendering motion models, temporal neural networks, video generation models, or a combination of the above methods. Corresponding flag deformation state Orientation Depth state and visible state Fixed camera internal and external parameters, lighting conditions, background conditions, and randomly generated states, and wrote all states into reusable basic motion data. .
[0102] Preferably, the time step is 1 / 240 to 1 / 12 of a second, and the physical simulation can perform 1 to 20 substep iterations between each output frame. The tensile stiffness, bending stiffness, and damping coefficient of the fabric are all normalized to the range of zero to one before being input into the solver. When using a generative model, forward encoding and backward encoding must call the same motion latent variables, noise tensors, sampling steps, and random seeds. The camera focal length, attitude, and cropping window remain consistent element-wise in the same pair of responses.
[0103] Through the above data determination process, material coordinate parameterization separates the physical attachment position of the national flag pattern from the current image pixels, and establishes stable anchor points using the flagpole connecting edge. At the same time, the flag movement state is pre-fixed into reusable data, thereby solving the problems of perspective and wrinkles in the input image, inconsistent repeated generation due to model randomness, and the possibility of encoded information interfering with the motion pattern. This provides a basis for comparison of the same origin, same motion, and same perspective for subsequent pairwise difference.
[0104] Specifically, the normalized material domain can be divided into material units that can be identified individually, and a set of coded signatures across multiple coding fields can be configured for each material unit, so that different material locations are distinguishable in the coding dimension, and the coded signatures propagate with the material movement rather than being fixed with the image coordinates.
[0105] Among them, a material unit refers to the smallest processing unit with a defined coordinate range in the material domain. It can be a regular rectangle, triangle, hexagon, or an irregular region adaptively divided according to the pattern boundary. Each material unit has a unit number, central material coordinates, adjacency relationship, area weight, and front and back attributes.
[0106] Among them, the material coding field refers to the scalar field or vector field defined on the material domain. Where k represents the coding field number, and the coding value is determined by the material coordinates or material element number. Multiple coding fields at the same material location form a coding signature.
[0107] The coded signatures at different material locations meet the preset distinguishing conditions.
[0108] Among them, the preset differentiation conditions can be that the coded signatures of any two material units are not completely the same, the normalized correlation coefficient is lower than the set threshold, the Hamming distance is not lower than the set value, the Euclidean distance is not lower than the set value, or they can be located step by step in a multi-scale hierarchy. These conditions are used to ensure that the output differential response can identify the material source in reverse.
[0109] In this process, the material domain partitioning needs to strike a balance between positioning accuracy, computational load and noise resistance. When the unit is too large, it is difficult to describe fine patterns and narrow wrinkles. When the unit is too small, the response energy of each unit decreases and the number of codes increases. Therefore, it is preferable to perform adaptive partitioning based on output resolution, flag projection area, pattern boundary density and expected maximum deformation.
[0110] Specifically, an initial regular mesh is established based on the aspect ratio of the material domain; the color gradient, geometric boundaries, and key graphic regions of the standard national flag pattern are calculated; the mesh density is increased in color boundaries, star edges, emblem outlines, and areas with expected high curvature, while the mesh density is decreased in large areas of uniform color; an adjacency list of top, bottom, left, right, or triangular meshes is established for each material element, and the set of flagpole connecting edge elements, free edge elements, and pattern boundary elements are recorded.
[0111] Preferably, the minimum cell side length of the adaptive mesh can be 1 / 2 to 1 / 16 of the maximum cell side length, specifically determined by the color gradient of the standard template, geometric boundary density, and expected high curvature regions. After subdivision, each small graphic should still cover no less than 4 material cells along its shortest direction. If further subdivision results in the average signal-to-noise ratio of the cell encoding difference falling below 3, subdivision should be stopped, and a high-resolution standard texture combined with anti-aliasing sampling should be used to avoid sacrificing surface accuracy by infinitely increasing the number of material cells.
[0112] The design of the material coding field is equivalent to assigning detection signals that can be transmitted by the animation generation process to each material unit. The coding needs to have sufficient distinguishability and should maintain detectability when the amplitude is limited. It should also cover the global positioning and local refinement needs through multiple spatial frequencies and local support ranges.
[0113] Specifically, at least one set of binary coding fields is generated according to the material unit number. The binary codes can be taken from the Hadamard matrix, Walsh sequence, pseudo-random Bernoulli sequence, or Gray code. Gray-scale ramp coding fields and segmented gray-scale coding fields are generated along the u and v directions, respectively. Sine phase coding fields and cosine phase coding fields are generated at multiple spatial scales. Local pulse coding fields with finite support range are generated for key pattern regions, free edge regions, and low confidence regions. Each coding field is normalized with zero mean and unit energy and combined into a material coding matrix E.
[0114] Preferably, the binary encoding field uses -1 and +1, and the grayscale encoding field is normalized to [-1, +1]. The phase encoding field is determined by the material coordinates u and v, the length direction frequency, the height direction frequency, and the initial phase. The length direction frequency and the height direction frequency can be selected in stages from 1 to 64 periods, and the highest frequency does not exceed one-quarter of the corresponding material grid sampling frequency to reduce discrete aliasing; the initial phase is selected from 0 to 2π, and the sine field and cosine field are used in pairs.
[0115] The local pulse coding field uses finite support or Gaussian pulses centered on the target material location and performs mean removal processing. The pulse scale is obtained by the number of material units in the target sub-region. Preferably, the significant response covers 2 to 20 material units. When the coverage is less than 2 units, the response energy is easily covered by quantization noise. When the coverage is more than 20 units, the distinction between adjacent material locations decreases.
[0116] Specifically, the material coding matrix You can press The arrangement is as follows: K is the number of coding fields, J is the number of material units, and the k-th row and j-th column is the coding value of the k-th coding field on the j-th material unit; when Furthermore, when computational resources permit, orthogonal or near-orthogonal encoding can be used to obtain direct inversion conditions. Multi-scale localization, sparse response assumption, local coding supplementation, or block-based solution can be used to reduce the number of codes required.
[0117] Preferably, the number of coding fields K starts at 16 and gradually increases in batches of 8, 16, or 32 coding fields, up to a maximum of 1024. After each batch of coding fields is added, the maximum normalized correlation coefficient and the average signal-to-noise ratio of the paired responses of any two material unit coding signatures are calculated; the increase stops when the maximum correlation coefficient is not higher than 0.95 and the average signal-to-noise ratio is not lower than 3. If reaching 1024 still cannot meet the distinction condition, the coding is not increased globally, but layered decoding, local pulse coding, or material sub-region segmentation is adopted. The ratio of binary coding, phase coding, and local pulse coding can be within the range of 1:1:0.5 to 4:2:1 as candidate combinations. For low occlusion and low texture complexity scenes, the proportion of binary coding is increased to reduce the amount of computation, while for high occlusion or repetitive pattern scenes, the proportion of phase coding and local pulse coding is increased to reduce material address confusion.
[0118] Through the above material coding field generation process, multiple mutually distinguishable material coding fields can be used to establish cross-coding dimension identity signatures for material locations. By combining global binary coding, continuous phase coding and local pulse coding, global localization, sub-unit refinement and occlusion region enhancement are taken into account, which solves the problem that large areas of the same color, repeated patterns and similar colors in the national flag cause ordinary feature matching to lack unique identifiers.
[0119] Specifically, under the premise that the flag movement, camera, lighting and random state are exactly the same, positive and negative amplitude perturbations can be applied to the same material coding field to generate two response animations, one positive and one negative. The two animations are then saved as a set so that the common content can be eliminated by subtraction later.
[0120] Among them, positive material coding refers to the coding data obtained by superimposing a positive amplitude coding field on the appearance of neutral materials or the appearance of the detection reference, and reverse material coding refers to the coding data obtained by superimposing an equal amplitude reverse sign coding field. If the reference appearance is denoted as The encoded amplitude is denoted as Then the k-th pair of codes can be represented as follows:
[0121] and .
[0122] Among them, animation response refers to the images, feature maps, latent variable responses or visibility responses generated at each animation moment under the control of basic motion data after the encoded data is attached to the national flag material domain. The forward animation response and the reverse animation response are consistent in all generation conditions except for the encoded symbols.
[0123] Among them, the fixed generation state is used to ensure that only the coded symbol, a controlled variable, is retained between pairs of animation responses. When using a random video generation model or a random sampling renderer, even slight differences in the input appearance may cause the motion trajectory to bifurcate. Therefore, it is necessary to directly reuse the motion latent variables, random noise, sampling order, and rendering parameters as part of the basic motion data.
[0124] Specifically, the deformation state, orientation state, occlusion state, and camera state at each moment are read from the basic motion data; two identical state buffers are copied for the k-th encoding field; the same random seed is initialized to the forward and backward response branches, and the motion branch of the generated model is locked or the generated motion field is read directly; the consistency of timestamps, noise tensors, camera matrices, lighting parameters, and background images is verified item by item for both branches.
[0125] Preferably, the timestamp error between the forward and reverse branches should be zero or not exceed one-thousandth of the output frame period. The camera matrix and motion field preferably use the same memory object or the same checksum. The element-wise difference of the floating-point state is preferably less than [value missing]. If the model cannot guarantee that the encoding will not affect the motion, the motion generation stage should be run independently first and the motion results should be frozen. Then the encoding should be injected in the subsequent differentiable rendering or texture modulation stage.
[0126] Among them, equal amplitude inverse coding can form a central difference, which suppresses common brightness, background, shadow and motion components that are unrelated to coding when subtracted, while doubling the response components that are approximately linearly related to coding propagation, thereby improving the discriminability of weak material signals.
[0127] Specifically, determine the appearance of the detection reference. The reference appearance can be a uniform mid-gray texture, a depatterned flag color, the low-frequency components of a standard pattern, or injectable feature references within the model; calculate separately. and And perform color range clipping or feature amplitude normalization; and Attach to the material domain according to the same material coordinates; record the correspondence table between the coding field number, coding amplitude, reference appearance and material unit number.
[0128] Preferably, the encoded amplitude 'a' is selected from 0.01 to 0.4 in the normalized color or feature space as a candidate scanning range. The difference between the absolute values of the forward and reverse encoded amplitudes is no greater than 1% of the set amplitude. The actual value of 'a' is obtained by pre-scanning: starting from a low amplitude, the test is performed step by step. When the differential response signal-to-noise ratio of the effective flag area is not less than 3, the saturation clipping ratio of any channel is not higher than 5%, and the material-independent motion state difference between the forward and reverse branches does not exceed 0.25 material units or 1% of the flag projection width, the amplitude is determined to be valid. If the signal-to-noise ratio is insufficient, 'a' is increased. If the saturation ratio or motion state difference exceeds the limit, 'a' is decreased or the encoding is changed to be injected into the intermediate feature layer after the motion decoder.
[0129] Low-end values are used to avoid semantic and motion perturbations, while high-end values are used to improve the detectability of weak responses. These three acceptance conditions together ensure that the selected amplitudes within the candidate interval can form paired responses that can be used for material address inversion.
[0130] Among them, the generation of paired animation responses can be accomplished by an explicit renderer or an implicit generation model. The necessary condition is not the use of a specific model, but that the encoded signal is bound to the material coordinates and propagates along the same basic motion path, and that the non-encoded variables remain consistent between the two runs.
[0131] Specifically, in the forward branch, a forward animation response Y+k,t is generated based on the basic motion data B and the forward encoded data A+k; in the reverse branch, a reverse animation response Yk,t is generated based on the same basic motion data B and the reverse encoded data Ak; the same color conversion, size adjustment and anti-aliasing processing are performed on the outputs of the two branches; Y+k,t and Yk,t are combined into a set of paired responses according to the encoded field number k and the animation time t.
[0132] Preferably, the output response can be in the form of single-channel brightness, multi-channel color, intermediate features of the model, or a combination of the above data. It is preferable to convert the response into a linear space before calculating the difference. If an 8-bit image is used for storage, when the encoding difference is small, it is preferable to first calculate and save the intermediate results in 16-bit integer or 16-bit to 32-bit floating-point format to avoid quantization errors from swallowing up the material response.
[0133] Through the above-mentioned pairwise animation response generation process, by strictly controlling variables and using centrally symmetric positive and negative encoding, the common flag movement, background texture, lighting changes and random generation errors are canceled or significantly reduced in the subsequent difference, thus solving the core difficulty that a single position encoding will simultaneously change the model's movement and appearance, making it difficult to determine the material's direction.
[0134] Specifically, the difference between each pair of animations can be calculated pixel by pixel or feature by feature position. The difference values of the same output position under all coding fields can be used to form a response signature. Then, the response signature can be matched or inverted with the coding signature pre-assigned to each material unit to obtain which material unit the output position is most likely to come from and the corresponding confidence level.
[0135] The response difference refers to the difference between the forward and backward responses at the same coding field, the same animation moment, and the same output position. Central difference is preferred, and its calculation formula is as follows:
[0136] ,
[0137] in To determine the sampling location for the output image, For encoded amplitude, The physical meaning is the normalized sensitive response of the output position to the k-th material encoding field.
[0138] In the above central difference, k is the coding field number, t is the animation time number, and p is the sampling position in the output image or output feature map; and They are generated from the same basic motion data B, the same camera, the same lighting, the same occlusion sequence, and the same random state, respectively, with the only difference being the material coding symbol. The coding amplitude 'a' is obtained according to the aforementioned pre-scanning rules. If the response is multi-channel data, each channel is first normalized by unit variance, then the difference is calculated for each channel and stitched together in a fixed order.
[0139] Among them, animation response matrix You can press The arrangement is P, where P is the number of sampling positions in an animation frame, and Dk,t(p) is the material coding matrix in the k-th row and p-th column. according to Arrangement, transfer matrix according to The arrangement is such that the j-th row and p-th column represents the contribution weight of the j-th material element to the p-th output position response.
[0140] The candidate material transport relationship can be represented as a backsampling mapping. Distribution of weighted materials or forward projection mapping Inverse sampling mapping facilitates sampling from a standard template to the output frame, while weighted material distribution is convenient for describing the anti-aliasing and semi-transparent boundary conditions formed by the mixing of multiple adjacent material units in a pixel.
[0141] Specifically, when using relevance matching, a weighted cosine similarity is calculated between the response signature at output position p and the encoded signature of the j-th material unit. The reliability weight matrix Wp is a diagonal matrix, where each diagonal element is obtained by normalizing the unsaturated proportion, differential signal-to-noise ratio, and positive / negative branch consistency of the corresponding encoded dimension, with values ranging from 0 to 1. The candidate material number is taken from the material unit with the highest matching score, and the candidate confidence is preferably the difference between the highest and second-highest scores, combined with response energy correction. Weighted cosine similarity itself is a general matching method, and in this embodiment, it is only used as an alternative solution for determining the candidate material address from paired material responses.
[0142] The transfer matrix describes the contribution of material elements to the output sampling position. The candidate relation needs to be further converted into material coordinates and visibility weights for executable texture sampling. Uncertainty should be retained during the conversion so that step S5 can use spatial and temporal constraints for correction.
[0143] Specifically, for each output position, the material element with the largest contribution weight is selected as the primary candidate, and its weighted material coordinates with several neighboring material elements are calculated; the candidate visibility weight is calculated based on the sum of transmission weights, the maximum weight ratio, the coding matching score, and the positive and negative response energies. The candidate material transport relationship is composed of material coordinates, primary candidate number, secondary candidate set, visibility weight, and matching confidence. Background markers, non-material markers, and markers to be calibrated are set for the background position, flagpole position, and position where a stable response cannot be obtained, respectively.
[0144] Preferably, when the maximum matching score is below 0.4 to 0.8, the difference between the highest and second-highest scores is below 0.02 to 0.2, or the total transmission weights are below 0.1 to 0.5, the position can be marked as low confidence; material coordinate weighting is only performed within the first or second ring neighborhood of the main candidate to avoid averaging material units that are similar in code but far apart in space to the wrong position.
[0145] Through the above process of determining the transmission relationship of candidate materials, multiple pairs of differentials can be transformed into coded response signatures of output positions, and the material contribution and material address can be estimated using complete mathematical relationships. This can handle the case of a single pixel corresponding to a single material position, as well as the cases of edge blending and sub-pixel sampling, thereby solving the problem that ordinary optical flow is prone to misassociation when there is no observation in the occluded area, no texture in the same color area, and local appearance similar after flipping.
[0146] When the number of material units is large and the number of coding fields is limited by the generation cost, a coarse-to-fine layered decoding method can be adopted. First, low-frequency binary coding and low-frequency phase coding are used to divide the material domain into several coarse regions. Then, high-frequency phase coding and local pulse coding are called only in one or more coarse regions that best match the output response for fine localization, thereby converting the global search into a multi-level local search.
[0147] Specifically, the primary material partition to which the output position belongs is determined based on the low-frequency coding response; the secondary material partition is determined based on the mid-frequency coding within the primary material partition; the continuous material coordinates are obtained within the ring neighborhood of the secondary material partition based on the high-frequency phase and local impulse response; and the matching probabilities of each level are multiplied or the logarithmic probabilities are accumulated to form the final candidate confidence level.
[0148] Preferably, each material partition contains 4 to 64 sub-partitions, the number of levels is two to six, and the number of candidate partitions entering the next level is 1 to 8. If the difference between the highest probability and the second highest probability of the first-level candidate is less than 0.05 to 0.2, multiple partitions are retained at the same time to avoid early misjudgment that could lead to irrecoverable consequences.
[0149] In the block-based inversion method, the output image can be divided into processing blocks ranging from 64×64 pixels to 1024×1024 pixels. Adjacent processing blocks are set with an overlap band of 4 to 64 pixels. The response signature and candidate material relationship are calculated independently within the block. The material coordinates in the overlap band are fused based on confidence, window function weight of distance from the block center, and adjacency continuity to balance memory usage and full image continuity.
[0150] Layered decoding and block inversion only change the solution organization of material transport relationships, without changing the technical conditions that material encoding is determined by material coordinates, positive and negative responses share basic motion, and candidate relationships are subject to continuous material constraint correction. Therefore, it can be used for high-resolution output, long-term animation, and distributed computing scenarios.
[0151] Specifically, when determining the transmission relationship of target materials, the matching result given by a single pixel or a single coding field is not directly taken as the final answer. Instead, the results of the same material position in different coding fields, adjacent pixels, adjacent material units and adjacent animation moments are checked to see if they are consistent with each other. At the same time, isolated jumps are corrected by using the fixed edge of the flagpole, the front and back relationship and the occlusion visibility rules, and finally the target material address map that can continuously transmit standard patterns is obtained.
[0152] Transmission deviation refers to the difference in material coordinates obtained by different coding subsets, different solution methods, or adjacent time steps for the same material element or the same output position. It can be represented by the Euclidean distance of material coordinates, the distance between material element numbers, the difference in coding matching scores, or the difference in projection positions.
[0153] Among them, the material continuity constraints include the material position constraints corresponding to the flagpole connecting edge, the material adjacency constraints between adjacent material units, the material address continuity constraints of the same material unit at different animation times, the pattern correspondence constraints between the front and back of the national flag, and the correspondence constraints between the occlusion state and the visibility weight of the material unit.
[0154] Among them, the target material transfer relationship refers to the combination of material coordinate mapping, visibility weight, surface orientation and front and back markings obtained after multi-code consistency check and material continuous constraint correction. The target relationship can be saved by each output pixel, or by mesh vertex, sparse control point or continuous deformation function.
[0155] Among them, different coding fields have different spatial frequencies and local support ranges. If multiple coding subsets all point to similar material locations after independent decoding, the transmission results at that location are reliable. Otherwise, it indicates that the location may be affected by occlusion, saturation, coding aliasing, or nonlinear generation, and it is necessary to reduce the weight of data items and rely on continuous constraint correction.
[0156] Specifically, the material coding field is divided into at least two coding subsets according to type, scale, or random grouping; sub-candidate material relationships are calculated based on each coding subset; the weighted mean and dispersion of the coordinates of each sub-candidate material are calculated for the same output position; the dispersion of the candidate projection position of the same material element in the output image is calculated; and the dispersion is combined with the response confidence to form the transmission bias. and reliability weight .
[0157] Preferably, the coding subset contains no fewer than four coding fields and covers at least two coding types. The material coordinate dispersion can be calculated using the following formula:
[0158] ,
[0159] Calculation, where For subset reliability weights, Materials less than 0.5 to 2 times the diagonal length of the material unit can be considered consistent, while those more than 2 to 8 times are marked as needing correction.
[0160] In the calculation of the material coordinate discretization, g is the index of the encoded subset. The coordinates of the candidate materials are obtained by independently decoding only the g-th encoded subset. Let qg(p) be the weighted average of all qg(p). Let g be the reliability weight of the g-th encoded subset.
[0161] It is obtained by multiplying or weighting the normalized average response signal-to-noise ratio, the proportion of unsaturated coding dimensions, and the difference of the highest matching score of the subset, and then normalizing to make all The sum is 1. When the dispersion is less than 0.5 to 2 material unit diagonals, it indicates that different coding types point to similar material locations; when it is greater than 2 to 8 material unit diagonals, it indicates coding aliasing, occlusion, or nonlinear response, and the weight of the data item should be reduced and continuity correction or additional coding should be triggered.
[0162] In this context, the real flag cloth maintains local topological continuity without tearing, the material address of the flagpole connecting edge is fixed, the material element moves along a continuous trajectory in time, the switching between the front and back sides is caused by the change in surface orientation, and the occlusion state should correspond to the visibility weight. Therefore, the candidate material relationship can be regarded as a noisy observation and the target relationship that satisfies physical continuity can be recovered through graph optimization or variational optimization.
[0163] Specifically, a spatiotemporal graph structure consisting of output sampling positions, animation moments, and material elements is established; data consistency terms, spatial adjacency terms, temporal continuity terms, flagpole anchoring terms, front-back correspondence terms, and visibility terms are constructed; the weights of each data node are set according to the candidate confidence and transmission deviation; the material coordinates are corrected by solving the solution using gradient descent, Gauss-Newton, graph cut, confidence propagation, alternating direction multiplier method, or local iterative smoothing; and topology checks are performed on results that may fold or cross uncrossable boundary lines of the pattern, and the results are backed up to the next candidate material element.
[0164] Preferably, the data item weights are... Normalized to 1, spatial weight Time weight Flagpole anchoring weight Positive and negative weights and visibility weight The candidate search ranges are defined as 0.01 to 10, 0.05 to 20, 1 to 100, 0.1 to 20, and 0.1 to 20, respectively. The condition for acceptance is that the address jump between adjacent materials does not exceed two material units and does not cross the template boundary that cannot be crossed. The acceptance condition is that the temporal residual during the non-obstructed period does not exceed two material units; The average deviation of the flagpole connection edge is considered acceptable if it does not exceed 0.1% to 2% of the width of the material domain. The acceptance condition is that the consistency rate between the front and back markings and the surface normal symbol is not less than 99%. An acceptance condition is that the consistency rate between the visible weight and the depth buffer or occlusion mask is no less than 95%. Low-confidence or occluded locations have reduced local data weights and increased... and High-confidence pattern boundary positions increase local data weights and reduce cross-boundary spatial smoothing; flagpole connection edge positions increase... By directly labeling each weight with the above residuals and consistency rate, the weights actually used in the candidate range can correspond to clear technical effects.
[0165] Preferably, the spatial adjacency constraint does not directly require adjacent output pixels to have the same material coordinates, but requires that their material coordinate difference be adapted to the local projection scale, and anisotropic weights are used at the color boundaries or material grid polylines of the standard pattern, thereby avoiding excessive smoothing that would cause the edges of stars, strip boundaries or emblem outlines to be stretched.
[0166] Preferably, the visibility term is determined based on the transparency of the depth buffer, occlusion mask, or generated model output. When a material unit is occluded by another flag area, its output visibility weight should be close to zero, but the material address is still retained in the temporal state. When the material unit is re-revealed, it is preferentially recovered from the material address trajectory saved before occlusion, rather than re-identified based on the color of the newly appearing pixel.
[0167] In determining the target relationship, it is necessary to satisfy the continuity constraint and avoid the correction process from deviating from reliable pairwise response observations. Therefore, the acceptableness of the result is judged by the correction difference threshold, the degree of descent of the objective function, topological legality and cross-encoding consistency.
[0168] Specifically, the differences between the corrected material coordinates and the candidate material coordinates, as well as the residuals of each constraint, are calculated; it is checked whether the material coordinates are within the material domain, whether the flagpole edge remains anchored, whether the local mesh has been illegally flipped, and whether the front and back markings are consistent with the orientation; the corrected material coordinates and visibility weights are output for positions that meet the preset correction conditions; multiple candidates are retained for positions that still do not meet the conditions, and additional coding or neighborhood re-solution is triggered; the results at all times are combined to form the target material transport relationship Rtarget.
[0169] Preferably, the preset correction conditions may include a relative decrease of the objective function of not less than 1% to 20%, a material coordinate out-of-bounds ratio of less than 0.1% to 2%, an average deviation of the flagpole connecting edge of less than 0.1% to 2% of the material domain width, an illegal crossover ratio of adjacent material elements of less than 0.1% to 1%, and a correction displacement of no more than 1 to 5 material elements at the high-confidence observation position.
[0170] Through the above correction process, the results of local differential inversion can be combined with the physical laws that the flag fabric is not torn, the fixed edge is constrained, the material trajectory is continuous, the switching between the front and back sides is caused by reason, and the pattern can be recovered after occlusion. This ensures that when the occluded pattern reappears, it still points to the same material area as before occlusion, and suppresses isolated jump points, pattern repetition, color boundary misalignment, and confusion between the front and back sides.
[0171] To handle the situation where a material element is completely invisible for several consecutive frames, a state record can be established for each material element, including the nearest reliable material coordinates, projection velocity, visible state, front and back state, last reliable moment, and trajectory covariance. The state record continues to predict based on the basic motion data during the occlusion period, but does not use the background color of the occluded position to update the material identity.
[0172] Specifically, when a material element is visible and the matching confidence is higher than a threshold, its material trajectory and projection velocity are updated with the current observation; when the depth sorting indicates that the material element is occluded, the state is switched to occlusion and the last reliable address before occlusion is saved; during occlusion, the predicted position is propagated based on the basic motion data and the uncertainty is increased; when visibility is restored, the coded signature of the same material element is matched preferentially in the neighborhood of the predicted position; after the matching is restored, the trajectory before occlusion, the prediction during occlusion, and the re-reveal observation are smoothly fused.
[0173] Preferably, the state can be set to one of the following: visible, partially visible, completely occluded, flip transition, and mismatch pending recovery. When the visibility weight is greater than 0.7 to 0.95, it is determined to be visible; when it is less than 0.05 to 0.3, it is determined to be completely occluded; and when it is in the middle range, it is determined to be partially visible. The trajectory covariance increases by 1.01 to 2 times in each occluded frame. When it exceeds the preset upper limit, additional coding is triggered instead of directly deleting the material state.
[0174] Among them, the re-reveal confirmation can require high confidence matching of the same or adjacent material units in 2 to 8 consecutive frames, and the distance between the matching position and the predicted position of the occlusion period does not exceed 0.5% to 10% of the flag projection width. This multi-frame confirmation mechanism is used to avoid erroneous recovery caused by brief flashes of free edges or anti-aliasing noise.
[0175] By using occlusion state and material trajectory caching, even if a material element is temporarily not observed in the output image, its material identity is still saved as a state variable. When it is re-exposed, it is recovered using coded signature and motion prediction, which is different from the conventional method of regenerating material content based on the semantics of the re-emerging color or pattern.
[0176] In a preferred embodiment, the method further includes performing additional material coding for difficult periods such as occlusion, re-revealing, free edge flipping, or front-to-back switching, in order to avoid indiscriminately increasing the computational load for all animation periods.
[0177] Among them, difficult periods are usually characterized by decreased candidate confidence, rapid change of surface normal sign, sudden change of visible area, or increase in material coordinate temporal residual. At this time, adding local coding in the target material sub-region can improve the distinguishability of the corresponding material signature without having to regenerate all global coding responses.
[0178] Specifically, based on the basic motion data, the target animation period is detected where the visible weight changes from high to low and then back to high, the surface normal sign changes, the free edge curvature exceeds a threshold, or the material address residual continuously increases; the material units involved in the period are traced in reverse and the neighborhood of the first to third rings is expanded to obtain the target material sub-region. ,exist Generate local impulses, local Gray codes, or phase-encoded fields at higher frequencies; generate additional paired animation responses and update the response matrix for the target time period under the same underlying motion data; re-perform candidate inversion and continuity correction.
[0179] Preferably, the target animation period can consist of 2 to 30 consecutive frames, and the trigger threshold can be set to a candidate confidence level of less than 0.4 to 0.8, a change in surface normal inlay between adjacent frames of more than 0.2 to 1.5, a change in visible area of more than 10% to 80% of the previous frame, or a temporal residual of more than 2 to 10 times the diagonal length of the material unit. The outer width of the target material sub-region is preferably 1 to 8 material units.
[0180] By using the above-mentioned additional encoding process, computing resources can be concentrated on the occlusion and flipping regions where address loss is most likely to occur. This not only improves the material identification ability in difficult areas, but also avoids the excessive number of paired animations and storage caused by using high-density encoding throughout the process.
[0181] Specifically, the standard colors that should be displayed at each output position can be read from the standard flag template based on the target material address map, and then combined with the lighting, shadow, transparency and background information in the basic motion data to synthesize each animation frame, and finally encoded into a video or animation file in chronological order.
[0182] Among them, the target material transmission relationship determines the material source of the pattern content, and the basic motion data determines the position, orientation, occlusion and brightness of the material in the output image. The division of labor between the two types of data can avoid redrawing the national flag pattern according to semantics while maintaining the naturalness of the fluttering.
[0183] Preferably, when the texture sampling coordinates exceed the boundary, boundary clamping is preferred instead of periodic repetition. The number of anti-aliasing samples can be 2 to 16 times per pixel. The brightness factor is preferably limited to 0.4 to 1.6 and the chromaticity component is kept unchanged or only slightly adjusted to reduce unreasonable color shift of standard colors under shadow. Generative repair that changes the number of graphics and boundary topology is prohibited for the national flag pattern area. Missing material addresses are preferentially supplemented by neighbor material interpolation, temporal trajectory recovery or additional encoding.
[0184] Specifically, the output color is linearly synthesized between the standard pattern color and the background color according to visibility weights. The standard pattern color is obtained by selecting the corresponding standard texture from the front and back marks and sampling it at the target material coordinates; the lighting and shadow parameters are read from the basic motion data and applied to the standard pattern color through a brightness modulation function that maintains the chromaticity relationship of the template; the visibility weight is taken from 0 to 1, where 0 represents fully displaying the background, 1 represents fully displaying the flag surface, and intermediate values are used for anti-aliasing boundaries or semi-transparent areas. This linear synthesis is a conventional image compositing step and is not considered a creative basis for identifying material transport relationships; retaining the above textual rules is sufficient for those skilled in the art to implement it.
[0185] The animation frame generation process requires ensuring consistency in timestamps, material addresses, and color processing. The splicing process is only responsible for encoding and encapsulation, without changing the material relationships on the flag, thus avoiding the introduction of new pattern drift during post-processing before video compression.
[0186] Specifically, T output moments are generated according to the animation frame rate and duration; standard pattern sampling, lighting compositing, background compositing, and edge anti-aliasing are performed on each moment to obtain animation image frames Ft; F0 to FT-1 are sorted according to time order and written to the frame buffer; the frames are encapsulated using GIF, APNG, WebP, H.264, H.265, AV1, or other encoding formats to obtain the national flag waving animation; the output material address confidence map, low confidence area markers, and generation parameters are used as optional quality records.
[0187] Preferably, the output image resolution can be from 256×256 to 7680×4320, the frame rate is preferably from 12 frames per second to 120 frames per second, the video encoding chroma sampling is preferably 4:4:4 or 4:2:2 to reduce chroma loss at the edges of fine patterns, and the bit rate is set from 1 megabit per second to 200 megabits per second according to the resolution and frame rate. As intermediate frames in the patent implementation process, lossless or near-lossless formats are preferably used for saving.
[0188] Through the above standard pattern transmission and animation generation process, the target material transmission relationship can be used as the sole spatial source of the standard pattern, and the basic motion data can be used as the source of deformation and lighting. This allows the standard pattern and natural motion to be constrained by different data, which can reduce pattern drift, proliferation, missing parts, boundary misconnection and confusion between front and back sides, and maintain the background, wrinkles and shadows to change naturally with the animation.
[0189] In one specific implementation, the resolution of the national flag image to be processed is 2048×1365 pixels, the identified flag projection area accounts for about 35% of the image area, the standard template adopts a linear RGB texture with a 3:2 aspect ratio, the material domain is divided into 144×96 regular material units and subdivided once at the main graphic boundary, the output animation duration is 2 seconds, the frame rate is 24 frames per second, and a total of 48 animation moments are generated.
[0190] Specifically, the wind speed in the animation control data is set to 5.5 meters per second, the angle between the prevailing wind direction and the normal projection direction of the flagpole is set to 20 degrees, the normalization value of the fluttering amplitude is set to 0.65, the basic motion is generated by a combination of cloth simulation and differentiable rendering, each output frame contains 8 physical substeps, the vertices of the flagpole connecting edges are set to fixed constraints, the free edges are kept without position constraints, and the camera and lighting are directly reused in paired responses.
[0191] Specifically, the total number of material coding fields is set to 96, including 24 Walsh binary coding fields, 16 segmented grayscale coding fields along the u and v directions, 24 sine and cosine phase coding fields at six spatial scales, and 32 local pulse coding fields covering pattern boundaries, free edges, and estimated occlusion areas. The coding amplitude a is set to 0.18, and both the positive and negative branches use 16-bit floating-point format to store the response.
[0192] Specifically, the candidate relation first uses weighted cosine correlation to obtain the top four candidate material units at each output position, and then uses non-negative regularized least squares to calculate the contribution weights on the local candidate set. Set to 0.002. Set to 0.05, continuity correction in progress. , , , , , The values were set to 1, 0.8, 2, 20, 3, and 2 in sequence, and the iteration termination condition was set to the relative change of the objective function between two consecutive iterations being less than 1. Or the number of iterations reaches 200.
[0193] Under the above parameters, the implementation process can directly output the material coordinate map, front and back marking map, visible weight map and standard texture synthesis frame at each time. If the difference between the highest and second highest matching score of the free edge flipped area is less than 0.08, 8 to 24 local coding fields are added to the material sub-region and only the corresponding time period is updated to improve the identification stability of the material after flipping and re-exposing.
[0194] In an engineering implementation, the material domain description can be stored using a material element table and an adjacent edge table. The material element table records at least the element number, center material coordinates, vertex material coordinates, area, boundary category, standard texture index, and front and back attributes. The adjacent edge table records at least the adjacent element number, shared edge length, whether it crosses the pattern boundary, and spatial smoothing weight.
[0195] Basic motion data can be organized into state frames according to animation time. Each state frame contains at least a timestamp, flag deformation or projection data, normal or orientation data, depth or occlusion data, camera parameters, lighting parameters, and a random state summary. Paired animation responses only save references to the basic motion state frames and do not repeatedly store all motion data to reduce storage and ensure reference consistency.
[0196] Candidate material transport relationships can be stored using a four-channel to twelve-channel floating-point graph, with the first two channels recording... and Material coordinates: one channel records visibility weight, one channel records front and back markings, and the remaining channels record the highest matching score, the second highest matching score, the primary candidate material number, the timing residual, and the transmission bias. Low-confidence locations are marked with independent masks or special numbers.
[0197] When the number of material units is large, the transfer matrix does not need to be... The complete dense matrix can be permanently saved. For each output position, only the 1 to 8 candidate material elements with the highest weight and their corresponding weights can be saved, or it can be saved in a compressed sparse column format. After the continuity correction is completed, it can be converted into a continuous material coordinate map, thereby reducing memory usage and disk read / write.
[0198] The task execution log preferably records the input summary, template version, material mesh version, coded field parameters, basic motion data summary, paired response summary, solution parameters, abnormal regions, and output file summary. This ensures that any output animation can reproduce the process of determining its material transport relationship and facilitates auditing of whether the positive and negative branches use the same basic motion state.
[0199] Example 3:
[0200] Conventional positional encoding typically inputs coordinate information along with patterns or motion control into the model. The model may treat the encoding as a new texture semantic and change wrinkles, occlusions, or even camera motion, resulting in different encoding outputs no longer being comparable. This invention does not directly rely on a single encoding output, but performs positive and negative symmetrical perturbations on the same encoding direction under the same motion state. It approximates the directional derivative of the material encoding through the central difference, so that the common motion terms are canceled out in the first-order difference.
[0201] Specifically, the animation generation process is represented as ,in Based on motion data, For the appearance or characteristics of the material, targeting the coding direction use and Two calls, in F about Under the conditions of local differentiability or local monotonicity, we have:
[0202] ,
[0203] This yields the first-order response related to the material encoding propagation, while motion data It remains unchanged between the two calls.
[0204] Among them, the encoded amplitude Small differences are easily covered by numerical noise and quantization errors. When the value is too large, the higher-order nonlinear terms Increasing the amplitude may alter the semantic judgment of the model. Therefore, it is preferable to select an amplitude that ensures the differential signal-to-noise ratio is not less than 3 and the saturated pixel ratio is not higher than 5% through pre-scanning. Pre-scanning can be performed step by step among candidate amplitudes such as 0.01, 0.03, 0.05, 0.1, 0.2 and 0.4.
[0205] The second-order remainder in the above expansion is used to explain the source of nonlinear error when the amplitude is too large, and does not require the animation generation model to be differentiable across the entire input range. During implementation, the local approximation is verified by comparing the relative difference between the amplitude *a* and the normalized difference obtained from *a / 2*: if the relative difference does not exceed 10%, the current amplitude can be considered to be within the usable local response range; if it exceeds 10%, the amplitude is reduced or the injection of an intermediate feature layer is initiated. This test allows the applicability conditions of the central difference formula to be directly obtained from the output response.
[0206] Compared to applying forward encoding only once, pairwise forward and reverse encoding can not only eliminate the common response of the reference appearance and the background, but also amplify the odd symmetric material response to about twice the original, and suppress some even symmetric nonlinear interference. This effect cannot be directly obtained by ordinary optical flow or single texture replacement.
[0207] Binary coding fields are suitable for providing high energy and strong noise resistance. Their coding values are concentrated in -1 and +1, which are suitable for coarse positioning of large-scale material locations. However, high-frequency binary boundaries may produce local mixing after rendering anti-aliasing. Therefore, this invention uses continuous grayscale or phase coding to supplement sub-unit coordinate information.
[0208] The spatial frequency of the phase coding field determines the positioning scale. Low-frequency phase is used to distinguish large areas of the material domain, while high-frequency phase is used to distinguish adjacent material units. The pairing of sine and cosine phases can avoid insufficient sensitivity of a single phase at zero crossover. The use of multiple coprime or harmonic scales together can obtain continuous material coordinates through phase expansion and reduce confusion caused by repetition cycles.
[0209] Local pulse-coded fields exhibit significant responses only in finite material sub-regions, making them suitable for handling free edges, fine patterns, and re-exposed regions. The pulse width... When the response energy is too small, it is insufficient; when it is too large, the resolution decreases. It preferably covers 2 to 20 material units and is adaptively adjusted according to the projection scale of the target sub-region.
[0210] The combination of multiple coding types enables the coding matrix to simultaneously possess high energy, continuous localization, and local unmixing capabilities. With the same number of codes, it can handle large areas of the same color and occlusion boundaries more stably than a single random coding. Furthermore, when a certain type of coding becomes distorted due to the nonlinearity of the generation model, other types of coding can still provide independent candidates for consistency correction.
[0211] In one optional implementation, the basic motion data is generated by an artificial intelligence model. The model adopts a two-stage architecture that separates motion generation and material response. The first-stage motion generation network only receives the structural information of the national flag image to be processed, the national flag mask, the flagpole connecting edge, and the animation control data, and outputs flag deformation, depth, normal, occlusion, and motion latent variables that are independent of the pattern semantics. The second-stage material response rendering network receives the fixed output of the first stage and the forward or reverse material encoding, and generates the corresponding animation response.
[0212] The motion generation network can include an image encoder, a control encoder, a temporal fusion module, and a motion decoder. The image encoder is composed of a multi-layer convolutional network or a visual Transformer and outputs multi-scale structural features. The control encoder maps wind direction, wind speed, amplitude, frame rate, and duration into control vectors. The temporal fusion module uses 3D convolution, recurrent neural networks, temporal Transformers, or diffusion temporal modules to generate frame-by-frame latent variables. The motion decoder outputs a 2D deformation field, depth field, normal field, occlusion mask, and visibility weights.
[0213] The material response rendering network can include a material encoding input layer, a material feature sampling layer, a fixed motion transformation layer, a visibility synthesis layer, and an image output layer. The material encoding input layer... or The material features are encoded as material features. The material feature sampling layer establishes a feature map in the material domain. The fixed motion transformation layer propagates the material features based on the deformation or projection relationship output in the first stage. The visibility synthesis layer determines the contribution of each surface based on depth and occlusion information. The image output layer generates a positive or negative animation response. The data flow of each module is as follows: material encoding, material features, fixed motion propagation, visibility synthesis, and animation response.
[0214] Preferably, material encoding is only injected into the texture modulation layer after the second stage or motion decoder, and is not input into the motion generation network, so as to prevent the encoding from changing the basic motion from the network connection structure. If a single diffusion video model is used, the motion latent variable sampling is completed first with input without encoding and the noise state of each step is saved. Then, the motion-related features in the denoised trajectory are frozen, and forward and reverse encodings are injected only into the end texture cross attention layer respectively.
[0215] Training data can consist of legally authorized publicly available national flag images and videos, computer-generated standard national flag textures, synthetic motion sequences obtained from fabric physics simulation, and legally authorized and anonymized business images. Training samples include at least one of the following supervisory information: input image, flag mask, flagpole connecting edge, animation control parameters, frame-by-frame deformation or optical flow, depth or occlusion annotation, and standard material coordinates.
[0216] Before training, the input image is first converted to linear RGB and the pixel values are normalized to 0. The flag area is scaled to maintain aspect ratio. The missing areas are filled with the background mean, mirror filling or effective mask filling. Noisy images can be processed with median filtering, bilateral filtering or learning-based denoising networks. Missing motion labels can be generated by physical simulation, bidirectional optical flow consistency or multi-view reconstruction to generate pseudo labels.
[0217] The training process includes pre-training and task fine-tuning. In the pre-training stage, the non-rigid motion and occlusion rules of the flag are learned using cloth simulation sequences. In the task fine-tuning stage, the target motion is generated from a single image and control data using real or rendered national flag images. The material response rendering network accepts random material codes under fixed motion conditions and learns to propagate the codes along the material trajectory to the output time.
[0218] During training, at least three of the following methods can be used: motion supervision, adjacent frame displacement supervision, depth sequence supervision, surface normal supervision, occlusion supervision, temporal continuity supervision, and material response supervision.
[0219] Among them, the material response supervision is used to constrain the output of the random material code after propagation under a fixed motion state to be consistent with the simulation or rendering truth value. It is a necessary training objective in this embodiment to ensure that the material code can be transmitted along the material trajectory. The other losses are conventional optional training methods for obtaining basic motion data. They can be selected according to the actual annotations in the training data, and it is not required that all of them be used at the same time.
[0220] Each loss is normalized before calculation based on the number of effective pixels, coordinate range, and effective annotation ratio. The loss weights are not set to a fixed wide range outside the dataset, but are calibrated using the validation set: the material response supervision weight is first set to 1, and then other loss weights are increased one by one until the material address error does not increase, the occlusion area recovery error decreases, and the motion continuity index improves; if increasing a certain weight causes the material address error to increase by more than 5%, then that weight is rolled back.
[0221] The training optimizer can be Adam, AdamW, or other gradient-based first-order optimizers. The learning rate, weight decay, batch size, number of training epochs, and gradient clipping threshold are determined based on whether the validation set loss decreases steadily and whether the material address error converges. The learning rate is reduced when the material address error decreases by less than 1% for five consecutive validation epochs; gradient clipping is performed when the gradient norm increases abnormally and causes the loss to become non-finite. The optimizer and its hyperparameters are standard implementation conditions for model training and are not considered as independent inventive formulas in this invention.
[0222] The model input includes the image of the national flag to be processed, the flag mask, the flagpole connecting edge, the animation control vector, and the random seed. The motion generation network outputs frame-by-frame deformation field, depth field, normal field, occlusion mask, and motion latent variables. The material response rendering network further inputs forward or reverse material encoding and outputs paired animation responses. The technical connection between the input and output is that the motion output determines the spatial propagation and visibility of material features, while the material encoding determines the material identity in the differential response.
[0223] The input data and training datasets used in this embodiment should all be from compliant sources. The data can be taken from legally authorized public datasets, legally produced synthetic data, and business data authorized by user anonymization. No personal sensitive information or biometric data should be collected in violation of regulations. Personal information, device identification, or shooting location information that may be contained in the data should be deleted, obscured, or irreversibly anonymized before training.
[0224] This invention does not require an artificial intelligence model. In another embodiment, a mass spring mesh, a finite element thin shell mesh, or a position dynamics cloth model can be established based on the material domain. The flagpole connecting edge is set as a fixed boundary, and wind field, gravity, and damping are used as external force inputs. The three-dimensional vertex position and normal at each animation moment are obtained through numerical integration. Then, a fixed camera and a rasterization renderer are used to generate positive and negative material encoded responses.
[0225] In this process, the position dynamics solution can be performed sequentially at each time step, including external force integration, position prediction, tensile constraint projection, shear constraint projection, bending constraint projection, collision detection, collision constraint projection, and velocity update. The number of iterations is preferably 2 to 50. Material density, tensile compliance, bending compliance, and air damping are determined by measured flag fabric samples, simulation fitting, or publicly available material parameters.
[0226] When using physical simulation, material coordinates naturally correspond to mesh vertices, and paired encoding can be directly attached as vertex textures or patch textures. The basic motion data consists of the same set of vertex trajectories, camera matrix, depth buffer, and normal buffer. Therefore, it can deterministically guarantee the consistency of motion in both forward and inverse responses and is compatible with the aforementioned candidate inversion and continuity correction steps.
[0227] To ensure that the generated results can be used in display scenarios with high standardization requirements, material address quality judgment can be performed before animation output. The judgment includes at least one of the following: flagpole connection edge drift, number of pattern key points, pattern boundary topology, front and back consistency, material address continuity before and after occlusion, and color deviation.
[0228] Specifically, several key material points can be set in the standard template and their target projection positions can be tracked. If the same key point experiences discontinuous jumps during non-occlusion periods, multiple output positions simultaneously correspond to the same material point that should not be folded with high weights, or the pattern boundary topology is inconsistent with the template, then the corresponding frame is marked as an abnormal frame and local re-solution, additional encoding, or regression to the material trajectory of the previous reliable moment is triggered.
[0229] Color quality can be compared with the chromaticity difference between the output pattern and the standard template after removing the luminance component. If the average chromaticity difference exceeds the preset threshold, the luminance modulation function is readjusted or the post-processing that affects chromaticity is canceled. Pattern integrity can be checked by the number of color regions, the number of connected components, and the relative position of the center of key graphics in the standard template. However, the check is only used for quality control and does not replace the determination of material transport relationships.
[0230] Example 4:
[0231] like Figure 2 As shown, this embodiment provides an image generation system for a national flag waving animation. The system is used to execute the method of any of the above embodiments and can be implemented as a software module, hardware circuit, programmable logic, cloud service, or a combination of software and hardware.
[0232] The system includes a data determination module, an encoding generation module, a response generation module, a transmission relationship determination module, a transmission relationship correction module, and an animation generation module. Preferably, it also includes a target time period detection module, a quality judgment module, a task scheduling module, and a data storage module. Each module transmits data through a memory buffer, message queue, shared storage, bus, or network interface.
[0233] The data determination module is used to acquire the national flag image to be processed, the standard national flag template and animation control data, identify the national flag area and the flagpole connection edge, establish the national flag material domain and extract the standard national flag pattern, and generate or read basic motion data. Its output includes at least the material domain description, standard texture, motion state sequence, camera state and randomly generated state.
[0234] The encoding generation module is connected to the data determination module. It is used to read the material coordinates and material unit adjacency relationships in the material domain, generate at least one of the following: binary encoding field, grayscale encoding field, phase encoding field, multi-scale spatial encoding field and local pulse encoding field, and output the material encoding matrix, encoding amplitude and encoding field metadata.
[0235] The response generation module is connected to the data determination module and the encoding generation module respectively. It is used to read fixed basic motion data, construct forward material encoding and reverse material encoding for each material encoding field, attach the two encodings to the same material domain, and generate forward animation response and reverse animation response under the same motion, camera and random generation state.
[0236] The transmission relationship determination module is connected to the response generation module. It is used to calculate the response difference between the forward animation response and the reverse animation response, establish the animation response matrix, perform correlation matching, regularization inversion or hierarchical decoding on the animation response matrix and the material coding matrix, and output the candidate material coordinates, candidate material elements, contribution weight, visibility weight and matching confidence.
[0237] The transmission relationship correction module is connected to the transmission relationship determination module and the data determination module respectively. It is used to calculate the transmission deviation based on the consistency between different coding subsets, and read the flagpole connection edge, material adjacency relationship, cross-time motion state, front and back orientation and occlusion state to establish material continuity constraints, correct the candidate material transmission relationship and output the target material transmission relationship.
[0238] The animation generation module is connected to the transmission relationship correction module, the data determination module, and the data storage module. It is used to sample the standard colors from the standard national flag pattern according to the target material coordinates, combine the lighting, shadow, visibility, and background information in the basic motion data to generate animation image frames, and cache, encode, and encapsulate them in chronological order.
[0239] The target time period detection module is used to detect low confidence, occlusion, re-exposure, free edge flipping and front-back switching events, and sends the target material sub-region and additional encoding request to the encoding generation module. The response generation module generates additional paired responses only for the target time period, and the transmission relationship determination module and transmission relationship correction module update the target material transmission relationship accordingly.
[0240] The quality judgment module is used to check for flagpole connection edge drift, material address out of bounds, illegal folding of local mesh, key pattern topology, front and back consistency and color retention. When the judgment result does not meet the threshold, it sends a re-solution, additional encoding, parameter adjustment or output alarm command to the task scheduling module.
[0241] When the system is executed, the national flag image to be processed, the standard national flag template, and the animation control data first enter the data determination module. The data determination module outputs the material domain, standard texture, and basic motion data. The material domain enters the encoding generation module to form a material encoding field. The material encoding field and the basic motion data enter the response generation module to form paired animation responses. The paired animation responses and the material encoding matrix enter the transmission relationship determination module to form candidate material transmission relationships. The candidate relationships, the basic motion state, and the material continuity constraints enter the transmission relationship correction module to form target material transmission relationships. The target relationships, the standard texture, and the background data finally enter the animation generation module to form the national flag waving animation.
[0242] Preferably, the basic motion data is provided to the response generation module and the transmission relationship correction module in read-only mode. The forward response branch and the reverse response branch refer to the same basic motion data identifier. Before generating each pair of responses, the system verifies the data summary. If the summary is inconsistent, the group of responses is terminated and reloaded to ensure the consistency of control variables at the system level.
[0243] Preferably, the material coding field, animation response matrix, and transmission matrix can be stored and computed in a block-based manner. At least one of the frame dimension, coding dimension, and image space dimension can be allocated in parallel to the graphics processor, neural network processor, or multiple computing nodes. The block boundaries are set with overlapping areas and weighted by a window function during merging to reduce block seams.
[0244] like Figure 3 As shown, this embodiment also provides an electronic device, including a processor, a memory, a communication interface, and a data bus. The memory stores a computer program. When the processor executes the computer program, it implements the national flag waving animation image generation method of any of the above embodiments. The communication interface is used to receive the image to be processed, the standard template, and the animation control data, and output the generated animation.
[0245] The processor can be a central processing unit, a graphics processing unit, a neural network processor, a digital signal processor, a field-programmable gate array, an application-specific integrated circuit, or a combination thereof; the memory can include random access memory, read-only memory, solid-state drive, disk storage, or network storage; and the data bus is used to transfer data between the processor, memory, communication interface, and display or encoding device.
[0246] In a preferred configuration, the electronic device includes at least eight general-purpose processing cores, 8GB to 256GB of system memory, and a graphics processor with 4GB to 80GB of video memory. Material coding responses can be generated in parallel by coding field batches, transmission relationship inversion can be performed in parallel by animation frames or image blocks, and continuity correction can be performed in a multi-scale coarse-to-fine manner to reduce video memory usage.
[0247] In cloud-based or distributed implementations, the data determination module and quality assessment module can be deployed on the task control node, the response generation module can be deployed on one or more accelerated computing nodes, the transmission relationship determination module and correction module can be deployed on computing nodes with shared high-speed storage, and the animation generation module can be deployed on the encoding output node. Each node is connected via an encrypted network and shares a basic motion data summary based on the task identifier.
[0248] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the above-described method steps. The storage medium can be a non-transitory storage medium, including solid-state memory, optical disk, magnetic disk, read-only memory, erasable and rewritable memory, or server storage space.
[0249] The material domain of this invention is not limited to a single-layer planar rectangle. When the object to be processed is a flag with a swallowtail shape, triangle, notch or other non-rectangular outline, the material domain can be set as the corresponding two-dimensional polygon parameter domain and the material units can be divided according to the outline boundary. The coding field is still generated by the material coordinates, and the transmission relationship inversion and continuity correction methods remain unchanged.
[0250] The output of this invention is not limited to ordinary two-dimensional video, but can also output animation with alpha channel, dynamic textures in three-dimensional scenes, augmented reality overlay materials, or material coordinate sequences that can be used by subsequent renderers. If the output is a three-dimensional scene, the target material transmission relationship can be saved as the standard texture coordinates and visibility state of each mesh vertex.
[0251] The standard national flag template of this invention is not limited to a single resolution. It can create a template package that includes vector patterns, multiple raster levels, and color specification metadata. The animation generation module selects the corresponding level according to the output scale and maintains the consistency of the pattern boundary topology. When the template version changes, it is only necessary to re-execute the standard pattern transmission without regenerating the basic motion data and material transmission relationship.
[0252] Those skilled in the art should understand that the above embodiments are used to illustrate the technical concept and possible implementation methods of the present invention. Without departing from the technical concept defined by the claims, equivalent substitutions or conventional transformations made to the encoding type, solving algorithm, motion generation method, parameter range, module deployment method and data storage format should all fall within the protection scope of the present invention.
[0253] Based on the preferred embodiments of the present invention described above, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.
Claims
1. A method for generating images of a national flag waving animation, characterized in that, include: S1. Obtain the image of the national flag to be processed, the standard national flag template, and the animation control data; determine the national flag material domain, the standard national flag pattern, and the basic motion data. S2. Generate multiple material coding fields that correspond to the material coordinates in the national flag material domain; S3. Under the condition that the basic motion data remains consistent, generate paired animation responses based on the forward material code and reverse material code corresponding to each material code field; S4. Determine the candidate material transmission relationship based on the response difference between the multiple material coding fields and the corresponding paired animation responses; S5. Based on the consistency between the candidate material transmission relationships corresponding to different material coding fields and the material continuity constraint corresponding to the national flag material domain, the candidate material transmission relationship is corrected to obtain the target material transmission relationship. S6. Based on the target material transmission relationship, the standard national flag pattern is transmitted to each animation moment to generate multiple animation image frames, and the multiple animation image frames are spliced together in chronological order to obtain the national flag waving animation.
2. The image generation method for the national flag waving animation according to claim 1, characterized in that, S1 includes: Identify the national flag region and the flagpole connecting edge in the national flag image to be processed; Based on the standard national flag template, the national flag area is mapped to a preset material coordinate range to obtain the national flag material domain; Extract the standard national flag pattern corresponding to the national flag material field from the standard national flag template; Based on the flag image to be processed and the animation control data, the flag movement states corresponding to multiple animation moments are generated to obtain the basic motion data.
3. The image generation method for the national flag waving animation according to claim 2, characterized in that: The animation control data includes at least one of wind direction data, wind speed data, flutter amplitude data, animation duration data, and animation frame rate data; The basic motion data includes at least one of the following: flag deformation data, flag orientation data, flag occlusion data, camera data, and randomly generated states.
4. The image generation method for the national flag waving animation according to claim 1, characterized in that, S2 includes: The national flag material domain is divided into multiple material units according to a preset division rule; The multiple material coding fields are obtained by generating corresponding coding values based on the material coordinates of each material unit. Among them, different material coding fields meet preset distinction conditions, and the material coding fields include at least one of binary coding fields, grayscale coding fields, phase coding fields, multi-scale spatial coding fields, and local pulse coding fields.
5. The image generation method for the national flag waving animation according to claim 1, characterized in that, S3 includes: The flag motion state, camera state, and randomly generated state are fixed when generating each pair of animation responses; Generate positive and negative material codes with opposite coding amplitudes for the same material coding field; The forward material encoding and reverse material encoding are applied to the national flag material domain respectively to obtain forward encoded data and reverse encoded data; Based on the same basic motion data, positive animation response and negative animation response are generated according to the forward encoded data and the reverse encoded data respectively, and the positive animation response and negative animation response are used as the paired animation response.
6. The image generation method for the national flag waving animation according to claim 1, characterized in that, S4 includes: Determine the response difference between the positive and negative animation responses corresponding to the same material coding field; A material coding matrix is established based on the multiple material coding fields, and an animation response matrix is established based on the response difference corresponding to each material coding field; The transmission matrix is determined based on the material encoding matrix and the animation response matrix; Based on the transmission matrix, the correspondence between the material units in the national flag material domain and the image sampling positions at each animation moment is determined, thereby obtaining the candidate material transmission relationship.
7. The image generation method for the national flag waving animation according to claim 1, characterized in that, S5 includes: Based on the transmission relationship of candidate materials corresponding to different material coding fields, the transmission deviation corresponding to the same material unit is determined; The transport relationship of the candidate materials is adjusted based on the transport deviation and the material continuity constraint. The material continuity constraints include at least one of the following: material position constraints corresponding to the flagpole connecting edge, material adjacency constraints between adjacent material units, material address continuity constraints of the same material unit at different animation times, pattern correspondence constraints between the front and back of the national flag, and correspondence constraints between the occlusion state and visibility weight of the material unit. The material transport relationship that satisfies the material continuity constraint and whose difference from the candidate material transport relationship meets the preset correction condition is determined as the target material transport relationship.
8. The image generation method for the national flag waving animation according to claim 1, characterized in that, Also includes: Based on the aforementioned basic motion data, determine the target animation time periods where occlusion, re-revealing, free edge flipping, or front-back switching occurs; Determine the target material sub-region corresponding to the target animation time period; An additional material coding field is generated based on the material coordinates in the target material sub-region, and additional paired animation responses are generated while maintaining consistency with the basic motion data; Update the candidate material transport relationship corresponding to the target animation period based on the response difference between the additional material coding field and the additional paired animation response. The target material transport relationship is re-determined based on the updated candidate material transport relationship, and the animation image frame corresponding to the target animation period is generated based on the re-determined target material transport relationship.
9. A system for generating images of a national flag waving, characterized in that, include: The data determination module is used to acquire the image of the national flag to be processed, the standard national flag template, and the animation control data, and to determine the national flag material domain, the standard national flag pattern, and the basic motion data. The encoding generation module is used to generate multiple material encoding fields that correspond to the material coordinates in the national flag material field. The response generation module is used to generate paired animation responses based on the forward and reverse material codes corresponding to each material coding field, provided that the basic motion data remains consistent. The transmission relationship determination module is used to determine the transmission relationship of candidate materials based on the response difference between the multiple material coding fields and the corresponding pairs of animation responses; The transmission relationship correction module is used to correct the candidate material transmission relationship based on the consistency between the candidate material transmission relationships corresponding to different material coding fields and the material continuity constraint corresponding to the national flag material domain, so as to obtain the target material transmission relationship. An animation generation module is used to transmit the standard national flag pattern to each animation moment according to the target material transmission relationship, generate multiple animation image frames, and splice the multiple animation image frames in chronological order to obtain the national flag waving animation.
10. An electronic device, characterized in that, The device includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the image generation method for the national flag waving animation as described in any one of claims 1 to 8.