Blind box sticker generation method and system based on dynamic grid layout
By using a dynamic grid layout method based on Delaunay triangulation and affine transformation, the problems of monotonous layout and insufficient interaction in photo booth generation are solved. This method enables personalized grid layout, blind box IP display, and multimodal fusion of sound resources, thereby improving user experience and visual effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2026-03-31
AI Technical Summary
Existing photo sticker generation methods lack the ability to dynamically adjust graphic layout and interactive effects, resulting in a monotonous user experience, sticker position displacement and occlusion, and a lack of multimodal fusion of sound resources and dynamic linkage of time information.
A dynamic mesh layout method based on Delaunay triangulation is adopted. By locating seed points in each mesh, calculating the distortion factor, performing affine transformation, reconstructing the convex hull boundary, and mapping blind box IP, sound resources and timestamps, personalized profile pictures are generated.
It enables diverse grid layouts, random display of blind box IPs, addition of sound resources, and dynamic linkage of timestamps, enhancing user interaction and visual artistry, and solving the problems of monotonous layouts and insufficient interaction in traditional methods.
Smart Images

Figure CN121074313B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blind box photo sticker generation technology based on dynamic grid layout, specifically to a method and system for generating blind box photo stickers based on dynamic grid layout. Background Technology
[0002] With the rapid development of social networks and short video platforms, photo booth creation based on the "blind box" concept has become a new form of user interaction. After users take or upload their personal photos, the system randomly assigns a combination of virtual idols (IPs), sound clips, and stickers of specific styles, bringing a surprise experience in the form of "opening a blind box." However, existing photo booth creation methods still have many shortcomings in terms of graphic layout and interactive effects, making it difficult to meet users' needs for personalized, diverse, and immersive experiences.
[0003] On the one hand, existing technologies typically employ fixed grids or templated sticker layouts. These methods divide the entire image into several regular rectangular or circular regions, pre-setting fixed sticker shapes and positions within each region, and then filling the corresponding regions with avatars or IP images based on the blind box results. Because the grid shapes and positions are preset, they lack dynamic adjustment capabilities, preventing users from experiencing the visual novelty of freely twisting, deforming, or irregular layouts. Furthermore, fixed templates often fail to automatically adapt when aspect ratios, resolutions, or character compositions change, leading to issues such as sticker misalignment or occlusion between the sticker and the subject's face or background. On the other hand, some technologies attempt to introduce algorithms such as triangulation or Voronoi segmentation to divide the image into regions, but these are often used only for image segmentation or texture synthesis, rather than specifically for sticker grid layout. The typical Delaunay triangulation method has mature applications in geographic information systems and image processing, generating non-overlapping triangular meshes with optimal angles. However, existing solutions merely project the results into regular polygons or regular shapes, failing to further utilize the triangulation data to generate differentiated, irregular mesh units, nor to correlate the geometric characteristics of the triangular units with the sticker distortion depth. This results in a still monotonous layout lacking innovation and personalization. Furthermore, most current blind box image generation processes are limited to static image output, lacking the integration of multimodal resources such as sound or timestamps. In terms of audio interaction, existing technologies mostly focus on external audio playback for video stickers or animated stickers, rather than generating sound resources as blind box elements that correspond one-to-one with sticker grids. Therefore, stickers and sound are not truly "bound" logically, and the experience lacks novelty. At the same time, time information is usually only used as a watermark or simple text box annotation, and is not integrated into the overall layout strategy, appearing in a fixed position and unable to interact with dynamic layouts. In addition, existing methods lack sufficiently in-depth processing of the technical details of grid deformation and boundary reconstruction. Some solutions employ affine transformations or free-form deformations to locally distort the graphics, but there is no clear way to measure the intensity of the distortion. They often rely on empirical parameters, manual adjustments, or black-box random functions, leading to unpredictable and difficult-to-reproduce generation results. For convex hull boundary reconstruction, most methods are limited to simple minimum rectangle or circle fitting, lacking the ability to accurately calculate the convex hull of the distorted vertex set. This results in visually jagged, overlapping, or gapped mesh boundaries.
[0004] Therefore, this case aims to propose a method and system for generating blind box stickers based on dynamic grid layout. First, the input image is divided into several grids, and a seed point is located in each grid. Then, polygonal units are constructed using Delaunay triangulation. Next, the distortion factor is dynamically calculated based on the distance from the seed point to the image centroid. Then, an affine transformation is performed on each triangular unit to create a unique local deformation effect. Subsequently, the convex hull boundary of each grid unit is reconstructed to ensure that the generated graphics are continuous and non-overlapping. Then, the blind box IP, sound resources, and global timestamp are mapped to each unit, giving the sticker a mysterious blind box feel. Finally, a data package that can be directly rendered is encapsulated and output. Summary of the Invention
[0005] This invention provides a method and system for generating blind box photo stickers based on dynamic grid layout, which helps to solve the problems mentioned in the background art.
[0006] This invention provides the following technical solution: a method and system for generating blind box photo stickers based on dynamic grid layout, comprising:
[0007] The image to be processed is divided into grids, and the center point is determined in each grid to construct a seed point set;
[0008] Enumerate the triplets of the grid seed points and perform an empty circle check on each triplet to select triangular elements that meet the Delaunay triangulation conditions.
[0009] Calculate the Euclidean distance between the centroid of each triangular unit and the overall centroid of the image, and calculate the distortion factor based on this distance and the preset maximum distance;
[0010] Based on the twist factor, construct the affine twist matrix of the corresponding triangular unit;
[0011] Affine transformation is performed on the vertex coordinates of each triangular element using an affine twist matrix.
[0012] Using the transformed vertex set, reconstruct the convex hull boundary of each mesh cell;
[0013] Map the blind box IP resources, sound resources, and global timestamps to the corresponding grid cells;
[0014] The mapped grid cell data is encapsulated and output.
[0015] Optionally, the step of dividing the image to be processed into a grid, determining the center point in each grid, and constructing a seed point set specifically includes:
[0016] To obtain an image whose width equals its height, denote the width as... The height is recorded as ;
[0017] In the image domain Establish a Cartesian coordinate system with the origin at the top left corner. Axis to the right, Axial downwards;
[0018] Divide the image into equal parts There are 100 squares; among them, The number of rows and columns in which the image is segmented;
[0019] right Calculate row and column indices:
[0020] , ;in, Number the grid cells; For the first Each cell row index; For the first Individual cell column index; This is the floor function; Modulo operation; This represents the total number of squares.
[0021] Calculate the first The center coordinates of each grid cell:
[0022] , ;in, For the first The center of each grid Axis coordinates; For the first The center of each grid Axis coordinates;
[0023] Set the first The coordinate vector of the center point of each grid is ;
[0024] Set the seed point set as .
[0025] Optionally, the enumeration of triples of mesh seed points and the empty circle check of each triple to filter triangular elements that meet the Delaunay triangulation conditions specifically include:
[0026] Enumerate all distinct index triples ;
[0027] For each group Let vector ,vector scalar ,like If the three points are collinear, skip them; among them, Seed point and exist Coordinate difference in direction; Seed point and exist Coordinate difference in direction; Seed point and exist Coordinate difference in direction; Seed point and exist Coordinate difference in direction;
[0028] Calculate the coordinates of the circumcenter ;
[0029] Calculate the radius of the circumcircle ;
[0030] in, , which is a Euclidean norm;
[0031] If for all They all Then the unit number will be... Add to triangular unit set In the middle, and record the vertex index. ;in, Index another seed point; The triangular unit number; For the first The seed point index of the three vertices of the unit.
[0032] Optionally, the step of calculating the Euclidean distance between the centroid of each triangular unit and the overall centroid of the image, and calculating the distortion factor based on this distance and a preset maximum distance, specifically includes:
[0033] Calculate the image centroid ;
[0034] Calculate the first Euclidean distance from point to centroid ;
[0035] Get the maximum possible distance ;
[0036] Calculate the distortion factor .
[0037] Optionally, constructing the affine twist matrix of the corresponding triangular unit based on the twist factor specifically includes:
[0038] For each triangular unit Perform the following steps:
[0039] S101, Calculate the... Unit centroid ;
[0040] S102, Take two edge vectors , ;
[0041] in, For the first The first edge vector of the unit; For the first The second edge vector of the unit;
[0042] S103. Calculate the direction angle of the side vector:
[0043] , ;
[0044] in, edge vectors Direction angle; edge vectors Direction angle; return to The polar angle between them; For the edge exist Components in direction; For the edge exist Components in direction; For the edge exist Components in direction; For the edge exist Components in direction;
[0045] S104. Calculate the rotation angle and matrix:
[0046] , ;in, For the first Unit rotation angle; For the first Unit rotation matrix;
[0047] S105. Set the perturbation matrix:
[0048] , ;in, For the first The perturbation matrix of the unit; for identity matrix;
[0049] S106, Calculate the average torsional strength of the unit ;
[0050] S107, Constructing an affine twist matrix .
[0051] Optionally, the affine transformation of the vertex coordinates of each triangular element by applying an affine twist matrix specifically includes:
[0052] For each unit Its three vertex indices are , corresponding to the original point Calculate the first Affine-distorted coordinates of the vertex ;in, This is the vertex index.
[0053] Optionally, reconstructing the convex hull boundary of each mesh cell using the transformed vertex set specifically includes:
[0054] For each cell Perform the following steps:
[0055] S210, Collect the set of twisted vertices ;
[0056] S220, Set the convex hull algorithm:
[0057] S221, Starting Point: Select center leftmost point ;
[0058] S222, Given the current endpoint of the convex hull With candidate points traverse all ,like
[0059] Then let ;in, For directed area testing, a value greater than 0 indicates... exist Left side;
[0060] S223, until returning The convex hull vertex sequence is obtained. ;
[0061] S230, Set grid boundary polygon .
[0062] Optionally, mapping the blind box IP resources, sound resources, and global timestamps to corresponding grid cells specifically includes:
[0063] Get the global timestamp, denoted as ;
[0064] Calculation module Remainder ;
[0065] Set the first The IP index of the grid is ;
[0066] Set the first Grid Sound Index ;
[0067] Each grid Related , , ;in, For the first A blind box celebrity IP; For the first A blind box sound.
[0068] Optionally, the encapsulation and output of the mapped grid cell data specifically includes:
[0069] Construct the first The grid boundary, IP, sound, and timestamp quadruple ;
[0070] Complete output package .
[0071] A system for implementing the aforementioned blind box photo sticker generation method and system based on dynamic grid layout includes:
[0072] Calculation module: used for data calculation;
[0073] Mesh generation module: used for mesh generation and seed point location;
[0074] Triangulation module: used to perform Delaunay triangulation and empty circle checks;
[0075] Twisting Factor Calculation Module: Used to calculate the twisting factor of the seed point;
[0076] Affine Twist Module: Used to construct the affine transformation matrix of the triangular unit;
[0077] Vertex Transformation Module: Used to perform affine transformations on the vertices of triangular units;
[0078] Boundary Reconstruction Module: Used to reconstruct the convex hull boundary of each mesh cell;
[0079] Mapping module: Used to map IP addresses, audio resources, and timestamps to corresponding grids;
[0080] The encapsulation output module is used to construct and output complete data packets.
[0081] The present invention has the following beneficial effects:
[0082] This solution enables different grid layouts (grids of various shapes), random celebrity IP display in blind boxes, and the addition of sound resources and timestamps. It dynamically adjusts the grid shape and content distribution through algorithms, and combines this with a blind box mechanism to randomly load celebrity materials, ultimately generating personalized profile pictures.
[0083] 1. By dividing the image domain equally in a Cartesian coordinate system with preset rows and columns, the center of each grid is precisely located as a seed point, replacing traditional regular cutting or random sampling, making the layout controllable and uniform. The uniformly distributed set of seed points provides a stable geometric basis for subsequent Delaunay subdivision and distortion effects, avoiding units that are too large or too small due to irregular seeds, thus ensuring overall visual consistency and controllable details.
[0084] 2. A custom Delaunay triangulation process is adopted, enumerating triples and performing empty circle checks, skipping collinear cases, to ensure that the generated triangular elements strictly satisfy the Delaunay conditions, thus balancing mesh regularity and topological rationality. The Delaunay triangulation can maximize the minimum angle, avoiding overly sharp or distorted triangles, improving the stability of subsequent affine distortion and the visual user experience; at the same time, the modular design facilitates parallel computing and improves efficiency.
[0085] 3. Based on the Euclidean distance from the centroid of each triangular unit to the centroid of the overall image, a normalized distortion factor is calculated, resulting in stronger or weaker deformation in areas farther from the center, creating a rich visual sense of depth. Dynamic distortion factor mapping enables the sticker to exhibit a radial deformation effect, highlighting the central focal point while maintaining the gradual deformation of the edges, thus increasing its artistic appeal and playfulness.
[0086] 4. For each triangular element, the rotation matrix is first calculated, then a perturbation matrix is generated by combining the twist factor. Finally, an affine twist matrix is constructed to achieve local affine deformation that integrates rotation and scaling. The matrix decomposition design allows the deformation to retain the original orientation information of the element while flexibly controlling the scaling and rotation ratios. The affine transformation has low computational cost and can be parallelized on the GPU, making it suitable for real-time rendering of large-scale elements.
[0087] 5. Apply the corresponding affine matrix M to the three vertices of each triangular unit in sequence to achieve local vertex distortion based on the centroid, ensuring coordinated deformation of the internal structure of the unit. Precise affine application at the vertex level avoids overall image distortion while preserving the relative topological relationships of the triangles, ensuring seamless splicing of the distorted units.
[0088] 6. For the set of distorted vertices in each mesh unit, the polygon boundary is reconstructed using the convex hull algorithm along the positive oriented area criterion, ensuring that the boundary is free of depressions and continuous. The polygons reconstructed by the convex hull better fit the distorted vertex distribution, avoiding redundant pixels of simple bounding boxes or convex quadrilaterals, and eliminating rendering defects caused by depressions.
[0089] 7. The global timestamp T is mapped to IP resource index and sound resource index respectively through modulo operation, forming a one-to-one correspondence with the grid cell sequence number, thus realizing the binding of time and content. The modulo operation mapping mechanism is simple and efficient, and can generate dynamic blind box sequences according to different times, enhancing the fun of stickers and user interaction; the resource pool is scalable, facilitating later maintenance and operation. Attached Figure Description
[0090] Figure 1 This is a schematic diagram of the process of the present invention. Detailed Implementation
[0091] 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.
[0092] Example, refer to Figure 1 A method for generating blind box photo stickers based on dynamic grid layout includes:
[0093] This allows for different grid layouts (grids of various shapes), random celebrity IP displays within blind boxes, and the addition of sound resources and timestamps. The algorithm dynamically adjusts the grid shape and content distribution, combining this with a blind box mechanism to randomly load celebrity materials, ultimately generating personalized profile pictures.
[0094] The image to be processed is divided into grids, and the center point is determined in each grid to construct a seed point set;
[0095] Enumerate the triplets of the grid seed points and perform an empty circle check on each triplet to select triangular elements that meet the Delaunay triangulation conditions.
[0096] Calculate the Euclidean distance between the centroid of each triangular unit and the overall centroid of the image, and calculate the distortion factor based on this distance and the preset maximum distance;
[0097] Based on the twist factor, construct the affine twist matrix of the corresponding triangular unit;
[0098] Affine transformation is performed on the vertex coordinates of each triangular element using an affine twist matrix.
[0099] Using the transformed vertex set, reconstruct the convex hull boundary of each mesh cell;
[0100] Map the blind box IP resources, sound resources, and global timestamps to the corresponding grid cells;
[0101] The mapped grid cell data is encapsulated and output.
[0102] This paper proposes a method and system for generating blind box stickers based on dynamic mesh layout. The input image is divided into a mesh and the central seed point is extracted. Triangular units are selected based on Delaunay triangulation conditions. The distortion factor of each triangular unit relative to the image centroid is calculated. An affine distortion matrix is constructed and applied to transform the vertex coordinates. The convex hull boundary of each mesh unit is reconstructed. Finally, the blind box IP, sound resources, and timestamp are mapped to the mesh units and packaged for output. This method balances the structural integrity of the image and the requirements of dynamic deformation, providing a standardized data structure for subsequent rendering. By uniformly dividing the image to be processed into a mesh and constructing a set of seed points, using the Delaunay triangulation method to ensure that the mesh units do not overlap, and then calculating the distortion factor based on the Euclidean distance from the seed point to the overall centroid, affine distortion and convex hull reconstruction are applied to each triangular unit. Finally, the blind box IP, sound, and timestamp are mapped and packaged for output. This method solves the problems of simple layout and lack of dynamic interaction in traditional sticker generation; it can automatically generate stickers with rich visual distortion effects and personalized resource mapping, improving the user's interactive experience and the aesthetics of the stickers.
[0103] The process of dividing the image to be processed into a grid, determining the center point in each grid, and constructing a seed point set specifically includes:
[0104] Divide the image domain equally Determine the center seed point of each cell;
[0105] To obtain an image whose width equals its height, denote the width as... The height is recorded as ;
[0106] In the image domain Establish a Cartesian coordinate system with the origin at the top left corner. Axis to the right, Axis downward; determine the two-dimensional coordinate range of the image to provide a reference frame for all subsequent geometric calculations;
[0107] Divide the image into equal parts There are 100 squares; among them, The number of rows and columns in which the image is segmented;
[0108] right Calculate row and column indices:
[0109] , ;;in, Number the grid cells; For the first Each cell row index; For the first Individual cell column index; This is the floor function; Modulo operation; The total number of cells; number them. The row and column numbers are mapped to an N x N grid, which facilitates the location of the center point;
[0110] Calculate the first The center coordinates of each grid cell:
[0111] , ;in, For the first The center of each grid Axis coordinates; For the first The center of each grid Axis coordinates; each cell is evenly distributed at the center of the image domain according to the row and column indices;
[0112] Set the first The coordinate vector of the center point of each grid is ;
[0113] Set the seed point set as ;
[0114] Will The grid center serves as the seed for Delaunay triangulation, laying the foundation for grid reconstruction.
[0115] The specific algorithms for grid division and seed point construction are detailed, including: dividing the image domain equally to determine the grid, calculating the row and column indices and center coordinates of each grid in the Cartesian coordinate system, and then... The grid center serves as the seed for Delaunay meshing. This step lays the spatial layout foundation for the entire deformation algorithm, ensuring that the seed points are distributed regularly and repeatedly. By establishing a Cartesian coordinate system within the image domain and accurately calculating the row and column indices and center coordinates of each grid cell, a high-precision set of seed points is constructed. This solves the problem of deformation distortion or misalignment caused by inaccurate center point positioning in traditional mesh generation; it provides a reliable geometric basis for subsequent Delaunay meshing and affine distortion, ensuring the spatial consistency and aesthetics of each unit in the sticker.
[0116] The process of enumerating triples of mesh seed points and performing an empty circle check on each triple to select triangular elements that meet the Delaunay triangulation conditions specifically includes:
[0117] Original Divide the circle to ensure that no other points are inside the circle after connecting any three points;
[0118] Enumerate all distinct index triples Generate candidate triangle combinations, ensuring no repetition;
[0119] For each group Let vector ,vector scalar ,like If the three points are collinear, skip them; among them, Seed point and exist Coordinate difference in direction; Seed point and exist Coordinate difference in direction; Seed point and exist Coordinate difference in direction; Seed point and exist Coordinate differences in direction; determining whether three points are collinear using determinants;
[0120] Calculate the coordinates of the circumcenter ;
[0121] Calculate the radius of the circumcircle ;
[0122] in, , which is a Euclidean norm; find the circumcircle of the triangle for subsequent empty circle verification; where, , Representing vectors respectively exist Axial direction, Components along the axial direction;
[0123] If for all They all Then the unit number will be... Add to triangular unit set In the middle, and record the vertex index. ;in, Index another seed point; The triangular unit number; For the first The seed point index of the three vertices of the unit;
[0124] Ensure that the Delaunay triangle does not contain other seed points to achieve a non-overlapping mesh.
[0125] This paper describes the process of enumerating triples and performing an empty circle check to select triangular elements that meet the Delaunay condition. This includes collinearity determination, calculation of the circumcenter and radius, and removal of triangles containing other seed points. This step ensures that the generated triangular mesh is non-overlapping and free of holes, providing a high-quality mesh topology for subsequent affine deformation. By enumerating all distinct index triples and performing determinant collinearity determination and circumcircle empty circle checks, it is ensured that the selected triangular elements have no other seed points intruding into the circle, solving the problem of overlap or holes easily generated by simple mesh segmentation. The generated triangular mesh elements are regular and compact, providing a stable mesh structure foundation for subsequent distortion deformation, ensuring the continuity and visual consistency of the sticker distortion effect.
[0126] The calculation of the Euclidean distance between the centroid of each triangular unit and the overall centroid of the image, and the calculation of the distortion factor based on this distance and a preset maximum distance, specifically includes:
[0127] The distortion factor is generated based on the normalized distance of the seed point from the image centroid.
[0128] Calculate the image centroid ; serves as the benchmark for calculating all distortion factors;
[0129] Calculate the first Euclidean distance from point to centroid ;
[0130] Get the maximum possible distance ;
[0131] Quantify the distance and maximum possible distance between each seed point and the image center;
[0132] Calculate the distortion factor Map the distance to , as the intensity of the subsequent affine transformation.
[0133] For each triangular unit, the Euclidean distance from its centroid to the overall centroid of the image is calculated and converted into a normalized distortion factor by comparing it with a preset maximum distance. This distortion factor is used in the subsequent affine matrix construction, allowing the deformation intensity to automatically adjust according to the distance, meeting the design requirement of "slight deformation in the central area and large deformation in the edge area". By calculating the normalized distance from the centroid of each triangular unit to the image centroid and mapping it to a distortion factor, the problem of visual inconsistency between the central and edge areas caused by the traditional uniform deformation intensity is solved. The distortion intensity can be flexibly allocated according to positional differences, making the sticker more stable in the center and more dynamic at the edges, enhancing the overall visual impact and sense of layering.
[0134] The construction of the affine twist matrix corresponding to the triangular unit based on the twist factor specifically includes:
[0135] Generate an affine twist around the centroid of each triangular unit;
[0136] For each triangular unit Perform the following steps:
[0137] S101, Calculate the... Unit centroid Determine the reference point for the affine transformation;
[0138] S102, Take two edge vectors , ;
[0139] in, For the first The first edge vector of the unit; For the first The second edge vector of the unit; construct a reference vector for calculating the rotation angle;
[0140] S103. Calculate the direction angle of the side vector:
[0141] , ;
[0142] in, edge vectors Direction angle; edge vectors Direction angle; return to The polar angle between them; For the edge exist Components in direction; For the edge exist Components in direction; For the edge exist Components in direction; For the edge exist Components in direction; obtaining the orientation of edge vectors;
[0143] S104. Calculate the rotation angle and matrix:
[0144] , ;in, For the first Unit rotation angle; For the first Unit rotation matrix; calculate the average angle of the twist rotation to avoid excessive offset; To achieve rotation;
[0145] S105. Set the perturbation matrix:
[0146] , ;in, For the first The perturbation matrix of the unit; for identity matrix; The difference between the value and the identity matrix is recorded as a perturbation;
[0147] S106, Calculate the average torsional strength of the unit The torsion factors at the three vertices are summarized to uniformly control the deformation intensity; among them, For the first The first vertex of the triangular unit The distortion factor; For the first The second vertex of the triangular unit The distortion factor; For the first The third vertex of the triangular unit The distortion factor;
[0148] S107, Constructing an affine twist matrix Generates affine transformation matrices that can apply rotation and scaling to vertices.
[0149] This paper proposes specific steps for constructing an affine distortion matrix based on a distortion factor, including centroid localization, edge vector calculation, orientation angle and rotation matrix generation, perturbation matrix setting, and comprehensive intensity quantization. The final result is a complete affine matrix that rotates and scales the vertices. This matrix maintains local structural coherence while allowing flexible control over the deformation direction and magnitude. By calculating the triangular element rotation angle, perturbation matrix, and average distortion intensity step by step and combining them into the final affine transformation matrix, the problem of inflexible control over deformation direction and intensity caused by simple scaling or rotation is solved. It enables differentiated fine-tuning of each element while ensuring mesh element coherence.
[0150] The affine transformation of the vertex coordinates of each triangular element by applying an affine twist matrix specifically includes:
[0151] Twist the original vertices around the unit centroid;
[0152] For each unit Its three vertex indices are , corresponding to the original point Calculate the first Affine-distorted coordinates of the vertex ;in, Use the vertex index; rotate and fine-tune the triangle vertices around the centroid to generate twisted mesh vertices.
[0153] An affine distortion matrix is applied to the vertex coordinates of each triangular element, and the original vertices are finely rotated around their centroids to obtain the distorted mesh vertices. This step completes the actual mapping from mathematical matrices to spatial coordinates, preparing for boundary reconstruction. By applying a customized affine matrix transformation to the original vertex coordinates around the centroids of each element, the problem of local distortion or overstretching caused by traditional uniform distortion of the entire image is solved; the degree and direction of deformation of each mesh element can be precisely controlled, ensuring that the distortion effect is both random and regular.
[0154] The process of reconstructing the convex hull boundary of each mesh cell using the transformed vertex set specifically includes:
[0155] Construct the boundary polygon for each cell using the twisted vertex set;
[0156] For each cell Perform the following steps:
[0157] S210, Collect the set of twisted vertices Gathering all influences The twisted vertices of the grid;
[0158] S220, Set the convex hull algorithm:
[0159] S221, Starting Point: Select center leftmost point ;
[0160] S222, Given the current endpoint of the convex hull With candidate points traverse all ,like
[0161] Then let ;in, For directed area testing, a value greater than 0 indicates... exist Left side;
[0162] S223, until returning The convex hull vertex sequence is obtained. ;
[0163] Calculate the convex hull of the twisted vertices to ensure that the boundary is smooth and without depressions;
[0164] S230, Set grid boundary polygon Encapsulate the convex hull vertex sequence into the first... The final shape of the grid.
[0165] A convex hull algorithm is used to reconstruct the boundaries of the transformed vertex set. This includes selecting the starting point, traversing directed area tests until loops are reached, and finally generating a smooth convex polygon boundary for each cell. This algorithm avoids concavity and intersecting edges, improving the overall aesthetics and renderability of the mesh cell shape. By performing convex hull reconstruction on the deformed vertex set, the problem of concavity or uneven boundaries caused by simply connecting vertices is solved. The newly generated boundary polygons are smooth and non-overlapping, ensuring the graphic integrity and aesthetics of each cell in the sticker, which is beneficial for subsequent rendering and interactive operations.
[0166] The process of mapping blind box IP resources, sound resources, and global timestamps to corresponding grid cells specifically includes:
[0167] Ensure that each cell is uniquely associated Sound and the same timestamp;
[0168] Get the global timestamp, denoted as Generate a globally unique time stamp for the sticker;
[0169] Calculation module Remainder Provides pseudo-random mapping seeds;
[0170] Set the first The IP index of the grid is ; Celebrity IPs are allocated cyclically based on time and grid number;
[0171] Set the first Grid Sound Index Ensure that each sound corresponds to a specific IP address, enhancing the blind box experience;
[0172] Each grid Related , , ;in, For the first A blind box celebrity IP; For the first Each blind box contains a sound; the IP address and sound content for each compartment are then determined.
[0173] This paper describes the process of mapping blind box IP resources, sound resources, and global timestamps to corresponding grid cells. Modulo operations and cyclic allocation ensure that each cell is uniquely associated with an IP and sound, and the timestamp is synchronized, thus binding sticker content to time sequence. By using pseudo-random mapping based on global timestamps and cell numbers, IP and sound resources are accurately mapped to each cell, solving the problem of monotonous or repetitive resource allocation. The advantage is that each generated sticker possesses uniqueness and randomness, increasing the mystery and interactive fun of the blind box experience and enhancing user engagement.
[0174] The encapsulation and output of the mapped grid cell data specifically includes:
[0175] Form a data structure that can be directly rendered;
[0176] Construct the first The grid boundary, IP, sound, and timestamp quadruple Package the grid shape, IP address, sound, and timestamp into a single complete record;
[0177] Complete output package Generate data that can be directly rendered or stored by the front end. Grid blind box dataset.
[0178] The mapped grid cell data is encapsulated and output to form a data structure that can be directly rendered. The grid shape, IP, sound, and timestamp are packaged into a complete record and generated. Mesh blind box dataset. By encapsulating boundary shapes and multimedia resources into unified data records as quadruples, it solves the problems of cumbersome front-end rendering interfaces and scattered, difficult-to-manage data. The advantages are that the output data structure is clear and can be directly called, reducing the difficulty of system integration and rendering, and improving development efficiency and runtime performance.
[0179] This embodiment also provides a system for generating blind box photo stickers based on dynamic grid layout, including:
[0180] Calculation module: used for data calculation;
[0181] Mesh generation module: used for mesh generation and seed point location;
[0182] Triangulation module: used to perform Delaunay triangulation and empty circle checks;
[0183] Twisting Factor Calculation Module: Used to calculate the twisting factor of the seed point;
[0184] Affine Twist Module: Used to construct the affine transformation matrix of the triangular unit;
[0185] Vertex Transformation Module: Used to perform affine transformations on the vertices of triangular units;
[0186] Boundary Reconstruction Module: Used to reconstruct the convex hull boundary of each mesh cell;
[0187] Mapping module: Used to map IP addresses, audio resources, and timestamps to corresponding grids;
[0188] The encapsulation output module is used to construct and output complete data packets.
[0189] The above sound can be any sound or a user-uploaded sound.
[0190] A system architecture corresponding to the above method is proposed, including a computation module, a mesh generation module, a triangulation module, a distortion factor calculation module, an affine distortion module, a vertex transformation module, a boundary reconstruction module, a mapping module, and an encapsulation output module. Each module has a clear responsibility, facilitating system implementation and maintenance. By dividing the functional steps in the method into independent modules that work collaboratively, the problems of poor maintainability and high coupling in monolithic implementations are solved. The advantages are a clear system structure, well-defined responsibilities, ease of subsequent functional expansion, performance optimization, and system maintenance, and improved system stability and scalability.
[0191] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0192] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A blind box sticker generation method based on a dynamic grid layout, characterized in that, The method comprises the following steps: grid division is performed on the image to be processed, and a center point is determined in each grid to construct a seed point set; the grid division is performed on the image to be processed, and the center point is determined in each grid to construct the seed point set, specifically comprising: An image with width equal to height is acquired, with width noted as and height noted as ; In the image domain A Cartesian coordinate system is established with the origin at the upper left corner, The axis is to the right, The axis is downward; dividing the image into cells; wherein, is the number of rows and columns into which the image is divided. To Compute row and column indices: , ; wherein, is a cell number; is a first cell row index; is a second cell column index; is a floor function; is a modulo operation; is a total number of cells; Computing the coordinates of the individual lattice centers: , ;in, For the first The center of each grid Axis coordinates; For the first The center of each grid Axis coordinates; The first grid center point coordinate vector is ; Setting the seed point set as ; triads of the grid seed points are enumerated, and an empty circle test is performed on each group of triads to screen triangular units meeting the Delaunay triangulation condition; the triads of the grid seed points are enumerated, and the empty circle test is performed on each group of triads to screen the triangular units meeting the Delaunay triangulation condition, specifically comprising: enumerating all distinct index triplets ; For each group , let vector , vector , scalar , if , three points are collinear, then skip; wherein, is the coordinate difference between seed point and in the direction of ; is the coordinate difference between seed point and in the direction of ; is the coordinate difference between seed point and in the direction of ; is the coordinate difference between seed point and in the direction of ; Computing circumscribed circle center coordinates ; Computing the circumscribed circle radius ; wherein is the Euclidean norm; If for all They all Then the unit number will be... Add to triangular unit set In the middle, and record the vertex index. ;in, Index another seed point; The triangular unit number; For the first The seed point index of the three vertices of the unit; a Euclidean distance between the centroid of each triangular unit and the overall center of gravity of the image is calculated, and a distortion factor is calculated based on the distance and a preset maximum distance; the Euclidean distance between the centroid of each triangular unit and the overall center of gravity of the image is calculated, and the distortion factor is calculated based on the distance and a preset maximum distance, specifically comprising: Computing image barycenter ; Computing the first Euclidean distance from a point to the barycenter ; acquiring the maximum distance possible ; Computing a warping factor ; an affine distortion matrix of the corresponding triangular unit is constructed according to the distortion factor; the affine distortion matrix of the corresponding triangular unit is constructed according to the distortion factor, specifically comprising: For each triangle element the following steps are performed: S101、calculating the first cell centroid ; S102、Take two edge vectors , ; in, For the first The first edge vector of the unit; For the first The second edge vector of the unit; S103, calculating an edge vector direction angle: , ; wherein is the direction angle of the edge vector ; is the direction angle of the edge vector ; is the polar angle between ; ; is the component of the edge in direction; is the component of the edge in direction; is the component of the edge in direction; is the component of the edge in direction; S104, calculating a rotation angle and a matrix: , ; wherein, is the rotation angle of the unit; is the rotation matrix of the unit; S105, setting a perturbation matrix: , ;in, For the first The perturbation matrix of the unit; for identity matrix; S106, calculating the average distortion strength of the unit ; S107, constructing an affine warping matrix ; affine transformation is performed on the vertex coordinates of each triangular unit by applying the affine distortion matrix; the affine transformation is performed on the vertex coordinates of each triangular unit by applying the affine distortion matrix, specifically comprising: for each cell whose three vertex indices are , the corresponding original point , compute the coordinates of the first vertex after affine warping ; wherein, is the vertex sequence number index; a convex hull boundary of each grid unit is reconstructed by using the transformed vertex set; the blind box IP resource, the sound resource and the global timestamp are mapped to the corresponding grid unit; the mapped grid unit data is packaged and output.
2. The blind box sticker generation method based on a dynamic grid layout according to claim 1, characterized in that, the convex hull boundary of each grid unit is reconstructed by using the transformed vertex set, specifically comprising: for each cell the following steps are performed: S210, collect a set of twist vertices ; S220, setting a convex hull algorithm: S221, start: select leftmost point in the middle ; S222, given the current convex hull end point with candidate points , iterate over all , if , then let ; where, is a directed area test, greater than 0 indicates In left side; S223, until back to , get convex hull vertex sequence ; S230, setting a lattice boundary polygon .
3. The blind box sticker generation method based on a dynamic grid layout according to claim 2, characterized in that, the blind box IP resource, the sound resource and the global timestamp are mapped to the corresponding grid unit, specifically comprising: obtain a global timestamp, denoted as ; Computing module Remainder ; Setting the first IP index of the grid is ; Setting the first Sound index of the grid ; Each lattice Correlation , , ; wherein, is the Blind Box Star IP; is the Blind Box Sound.
4. The blind box sticker generation method based on a dynamic grid layout according to claim 3, characterized in that, the mapped grid unit data is packaged and output, specifically comprising: Constructing a first border, IP, sound, and timestamp quadruple of a grid ; complete output packet .
5. A system for generating a blind box sticker based on the dynamic grid layout of claim 4, characterized in that, The method comprises the following steps: a calculation module for data calculation; a grid generation module for grid division and seed point positioning; a triangulation module for performing Delaunay triangular unit enumeration and empty circle test; a distortion factor calculation module for calculating seed point distortion factors; an affine distortion module for constructing an affine transformation matrix of a triangular unit; a vertex transformation module for performing affine transformation on triangular unit vertices; a boundary reconstruction module for reconstructing a convex hull boundary of each grid unit; a mapping module for mapping IP and sound resources and timestamps to corresponding grids; an encapsulation output module for constructing and outputting a complete data packet.
Citation Information
Patent Citations
Human face mapping method and device
CN106570822A
Image splicing method based on grid deformation
CN107067370A