Search

CN-121982154-A - Intelligent image generation method and system based on dynamic template

CN121982154ACN 121982154 ACN121982154 ACN 121982154ACN-121982154-A

Abstract

The invention relates to the technical field of image processing, in particular to an intelligent image generation method and system based on a dynamic template, wherein the method comprises the steps of obtaining a target template identifier and a service data set; the method comprises the steps of obtaining vector data and structured data from a preset database in an indexing mode according to a target template identifier, constructing an object node tree to obtain dynamic rendering control data, mapping the service data set to each vector layer node in the object node tree according to a variable mapping table to generate a document structure to be rendered, calculating the rendering size of each vector layer node in the document structure to be rendered according to the self-adaptive constraint rule set, correcting the geometric attribute field of each vector layer node to obtain a target document structure, converting the target document structure into bitmap data stream and outputting the bitmap data stream.

Inventors

  • YU JUANJUAN

Assignees

  • 钛动科技股份有限公司

Dates

Publication Date
20260505
Application Date
20260209

Claims (10)

  1. 1. The intelligent image generation method based on the dynamic template is characterized by comprising the following steps of: The method comprises the steps of receiving an image generation request comprising source material image data, obtaining a target template identifier and a service data set according to the source material image data, obtaining vector data and structured data from a preset database in an indexing way according to the target template identifier, constructing an object node tree through the vector data, and obtaining dynamic rendering control data through the structured data, wherein the object node tree comprises a plurality of vector layer nodes, the vector layer nodes comprise unique identifiers, element labels and a rendering attribute set, and the rendering attribute set comprises a geometric attribute field used for recording initial coordinates and sizes, a font attribute field used for recording text styles and a transformation attribute field used for recording space transformation parameters; Mapping the service data set to each vector layer node in the object node tree according to the variable mapping table to generate a document structure to be rendered; Calculating the rendering size of each vector layer node in the document structure to be rendered according to the self-adaptive constraint rule set, correcting the geometric attribute field of each vector layer node according to the rendering size of each vector layer node to obtain a target document structure, converting the target document structure into a bitmap data stream and outputting the bitmap data stream.
  2. 2. The intelligent image generating method based on dynamic templates according to claim 1, wherein obtaining a target template identifier comprises extracting characteristics of the source material data to obtain geometric characteristic parameters and content semantic tags of the source material data, calculating a comprehensive matching score of the source material data and each candidate template in a preset database, determining a unique identifier of the candidate template with the highest comprehensive matching score as the target template identifier; the obtaining of the service data set comprises the step of packaging the source material image data into a preset universal key value pair structure to obtain the service data set, wherein the universal key value pair structure comprises a main content field key name pointing to the source material image data.
  3. 3. The intelligent image generating method based on dynamic templates according to claim 2, wherein each candidate template in the database is configured with an applicable scene tag and a historical rendering efficiency normalization value, and a formula for calculating a comprehensive matching score of the source material data and the candidate templates in a preset database is as follows: , For the said composite match score, For the aspect ratio of the main image area in the candidate template, For the aspect ratio of the main image in the source material data, For the number of coincidences of the applicable scene tags of the candidate templates and the source material semantic tags, For the total number of applicable scene tags of the candidate templates and the source material semantic tags after de-duplication, And normalizing the historical rendering efficiency of the candidate template, wherein omega 1 、ω 2 and gamma are preset weight coefficients.
  4. 4. The intelligent image generation method based on dynamic templates according to claim 1, wherein constructing an object node tree from the vector data comprises: The method comprises the steps of carrying out grammar analysis on vector data to obtain a plurality of layer element labels and nested hierarchical relations among the layer element labels, constructing an object node tree topology with a father-son index structure according to the nested hierarchical relations among the layer element labels, wherein the layer element labels comprise position coordinates, outline dimensions and visual style attributes of layers; mapping and storing the layer element labels as geometric attribute fields of corresponding vector layer nodes in the object node tree.
  5. 5. The intelligent image generation method based on dynamic templates according to claim 1, wherein obtaining dynamic rendering control data through the structured data comprises: carrying out grammar analysis on the structured data to obtain a variable binding configuration item and a layout adaptation parameter item; And obtaining a geometric threshold parameter and a corresponding deformation strategy instruction according to the layout adaptation parameter item, and instantiating the geometric threshold parameter and the corresponding deformation strategy instruction into the self-adaptive constraint rule set for controlling the dynamic behavior of the vector image layer node.
  6. 6. The intelligent image generating method based on dynamic template according to claim 1, wherein mapping the service data set to each vector layer node in the object node tree according to the variable mapping table, generating a document structure to be rendered comprises: traversing each vector layer node in the object node tree to obtain a unique identifier of the vector layer node; if so, extracting corresponding service data content from the service data set by taking the target service field name as an index key; And binding the service data content to the vector layer node to obtain the document structure to be rendered.
  7. 7. The intelligent image generation method based on dynamic templates according to claim 1, wherein modifying the geometric attribute field of the vector layer node according to the rendering size of the vector layer node comprises: Judging the type of the vector layer node, wherein the type of the vector layer node is a text type or an image type; responding to the type of the vector layer node as a text class, measuring the original rendering width according to the text content of the vector layer node, calculating a target scaling word size when the original rendering width exceeds a container threshold value in the self-adaptive constraint rule set, and updating a font attribute field of the vector layer node through the target scaling word size; And in response to the type of the vector layer node being a text class, calculating an affine transformation matrix according to the aspect ratio of the image resource and the center of the saliency area of the vector layer node, and applying the affine transformation matrix to the transformation attribute field of the vector layer node.
  8. 8. The intelligent image generation method based on dynamic template according to claim 7, wherein the formula for calculating the target scaling word size is: ; Wherein the method comprises the steps of The word size is scaled for the target, To update the initial font size in the vector layer node font properties field prior to updating, As a result of the threshold value of the container, Is the combination of the preset safe inner margin, Is the preset original rendering width, and the rendering width is the preset original rendering width, Is a preset buffer coefficient.
  9. 9. The intelligent image generation method based on dynamic templates according to claim 7, wherein calculating an affine transformation matrix comprises: Calculating a minimum scaling factor K, wherein the calculation formula is as follows: ; for the width of the main image area in the candidate template, For the height of the main image area in the candidate template, For the width of the source image to be large, Is the high of the source image; calculating a limited alignment offset of the center of the saliency region in the horizontal direction And a first alignment offset in the vertical direction, wherein the calculation formula is: ; ; as the horizontal coordinates of the center of the saliency region, Is the vertical coordinate of the center of the salient region; Constructing an affine transformation matrix, wherein the radial transformation matrix M satisfies: 。
  10. 10. a dynamic template based intelligent image generation system comprising a processor and a memory, wherein the memory stores a computer program, the processor executing the computer program to implement the dynamic template based intelligent image generation method of any of claims 1-9.

Description

Intelligent image generation method and system based on dynamic template Technical Field The present invention relates generally to the field of image processing technology. More particularly, the invention relates to a dynamic template-based intelligent image generation method and system. Background With the rapid development of mobile internet, electronic commerce and digital marketing technology, the form of information transmission has changed from simple text to graphic and text multimedia with great visual impact. In the scenes of e-commerce promotion, social media operation, personalized advertisement delivery and the like, in order to preempt the attention of users and improve the conversion rate, the demands of enterprises on high-quality, diversified and targeted marketing visual materials show an exponential growth situation. In order to cope with massive drawing demands, the existing image production mode mainly goes through two stages, namely a manual design mode based on professional design software (such as Adobe Photoshop), which has high drawing quality but is highly dependent on personal experience of designers, has low production efficiency and cannot meet large-scale concurrency demands, and an automatic generation mode based on a fixed template, which replaces business data (such as commodity names and pictures) to the designated positions of the template by a program through presetting a fixed layer structure, so that mass production of materials is realized. However, in the process of drawing or poster making, when the number of the title words filled in by the user is large, the words are often cut off directly or exceed the frame, and when the proportion of the picture uploaded by the user (such as a vertical screen photo) is inconsistent with the pit position of the template (such as a horizontal screen frame), the picture is often forced to stretch and deform or the core main body (such as a face and commodities) is wrongly cut off. Disclosure of Invention In order to solve the technical problems that the generated picture is easy to deform and sample, the invention provides the following aspects. In the first aspect, the intelligent image generating method based on the dynamic template comprises the steps of responding to an image generating request comprising source material image data, obtaining a target template identifier and a service data set according to the source material image data, obtaining vector data and structured data from a preset database in an indexing mode according to the target template identifier, constructing an object node tree through the vector data, obtaining dynamic rendering control data through the structured data, wherein the object node tree comprises a plurality of vector layer nodes, each vector layer node comprises a unique identifier, an element tag and a rendering attribute set, the rendering attribute set comprises a geometric attribute field used for recording initial coordinates and sizes, a font attribute field used for recording text styles and a transformation attribute field used for recording space transformation parameters, mapping the service data set to each vector layer node in the object node tree according to the variable mapping table, generating a to-be-rendered document structure, calculating each vector layer node in the to-be-rendered document structure according to the self-adaptive constraint rule set, and rendering the vector layer nodes are converted into a target document structure, and the target document structure is rendered according to the size of each vector layer node, and the target rendering attribute set is obtained. Preferably, obtaining the target template identifier comprises the steps of extracting the characteristics of the source material data to obtain geometric characteristic parameters and content semantic labels of the source material data, calculating comprehensive matching scores of the source material data and candidate templates in a preset database, determining a unique identifier of the candidate template with the highest comprehensive matching score as the target template identifier, and obtaining a service data set, wherein the service data set is obtained by packaging the source material image data into a preset universal key value pair structure, and the universal key value pair structure comprises a main content field key name pointing to the source material image data. Preferably, each candidate template in the database is configured with an applicable scene tag and a historical rendering efficiency normalization value, and a formula for calculating a comprehensive matching score of the source material data and the candidate template in the preset database is as follows: wherein For the said composite match score,For the aspect ratio of the main image area in the candidate template,For the aspect ratio of the main image in the source material data,For the number of coincidences of the ap