Image drawing method and device

By analyzing the images to be drawn and referenced images and calculating and adjusting the location of image elements, the inefficiency of the design of advertising images in different sizes is solved, and automated image size adaptation is achieved, labor and cost savings are achieved.

CN110490951BActive Publication Date: 2025-01-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910773299.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-21
Publication Date
2025-01-03
Estimated Expiration
2039-11-05

AI Technical Summary

Technical Problem

In the prior art, advertising images need to be manually redesigned in different sizes of delivery scenarios, resulting in low efficiency and high cost.

Method used

By analyzing the images to be drawn, a reference image set of multiple sizes is obtained, the position offset parameters of the elements are calculated, and the positions of the image elements are adjusted according to these parameters to generate target images that are adapted to different sizes.

Benefits of technology

No need for manual design, automatically generate advertising images that are adapted to different sizes, saving manpower and cost, and improving image drawing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110490951B_ABST
    Figure CN110490951B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses an image drawing method and device, the method comprising: obtaining an image to be drawn, the image to be drawn includes multiple elements, obtaining at least one set of reference image sets, wherein each set of reference image sets includes reference images of multiple sizes, the reference images include multiple reference elements, calculating the position offset parameters of the elements according to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image, adjusting the position information corresponding to each element in the image to be drawn according to the reference position information to obtain an adjusted image, offsetting the elements in the adjusted image according to the position offset parameters, and drawing the target image after the size expansion. The scheme can generate the target image after the size expansion according to the target expansion size parameter by analyzing the given image to be drawn.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image drawing method and device. Background Art

[0002] In actual applications, in order to promote products or provide services, companies will use advertising images and other methods to spread product or service information to consumers or users. Usually, an advertising image needs to be placed on multiple platforms, multiple advertising positions, and multiple electronic devices. Since these different placement scenarios usually have different sizes, the same advertising image needs to include multiple size types to adapt to different placement scenarios.

[0003] Currently, when expanding an advertising image to other sizes, designers are required to manually redesign it. Not only is manual design inefficient, but it is also costly. Summary of the invention

[0004] The embodiments of the present application provide an image drawing method and device, which can generate a target image after size expansion by analyzing a given image to be drawn.

[0005] The present application embodiment provides an image drawing method, including:

[0006] Acquire an image to be drawn, wherein the image to be drawn includes a plurality of elements;

[0007] Acquire at least one set of reference image sets, wherein each set of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements;

[0008] Calculate the position offset parameter of the element according to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image;

[0009] Adjusting the position information corresponding to each element in the image to be drawn according to the reference position information to obtain an adjusted image;

[0010] The elements in the adjusted image are offset according to the position offset parameters to draw a target image after the size expansion.

[0011] Accordingly, the embodiment of the present application further provides an image drawing device, including:

[0012] A first acquisition module, used for acquiring an image to be drawn, wherein the image to be drawn includes a plurality of elements;

[0013] A second acquisition module is used to acquire at least one group of reference image sets, wherein each group of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements;

[0014] A calculation module, used for calculating the position offset parameter of the element according to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image;

[0015] An adjustment module, used for adjusting the position information corresponding to each element in the image to be drawn according to the reference position information to obtain an adjusted image;

[0016] A drawing module is used to offset the elements in the adjusted image according to the position offset parameters to draw a target image after the size expansion.

[0017] The first acquisition module may be used to acquire an original image to be drawn, perform format conversion on the original image to be drawn to obtain a format-converted image, and annotate multiple elements in the format-converted image to obtain an image to be drawn.

[0018] Optionally, in some embodiments, the calculation module may include a first acquisition submodule, a second acquisition submodule, a construction submodule and a calculation submodule, as follows:

[0019] The first acquisition submodule may be configured to acquire relative position information between every two reference elements in the reference image according to reference position information corresponding to each reference element in the reference image;

[0020] The second acquisition submodule may be used to acquire the fluctuation degree information of the relative position between the two reference elements in the reference image according to the relative position information between the two reference elements in the reference image;

[0021] The construction submodule may be used to construct position attribute information of a reference element in the reference image according to the reference position information, the relative position information, and the fluctuation degree information;

[0022] The calculation submodule may be used to calculate the position offset parameter of the element according to the target expansion size parameter, the position information of the element in the image to be drawn, and the position attribute information of the reference element in the reference image.

[0023] The construction submodule can be used to obtain discrete degree information based on the relative position information and the fluctuation degree information, combine the relative position information and the fluctuation degree information to obtain element distribution center information, obtain element restriction information based on preset restriction conditions of the reference position information, and construct the position attribute information of the reference element in the reference image based on the discrete degree information, the element distribution center information, and the element restriction information.

[0024] The second acquisition submodule can be used to acquire at least one reference image of corresponding size from at least one set of reference images, acquire relative position information between two reference elements in at least one reference image, and calculate the fluctuation degree information of the relative position between the two reference elements in the reference image based on at least one relative position information.

[0025] The image drawing device can also be used to determine the enclosing rectangle corresponding to each element in the image to be drawn, obtain element size information corresponding to each element in the image to be drawn, and element position information corresponding to each element, obtain rectangular size information of the enclosing rectangle, and obtain position information of the element in the image to be drawn based on the element size information, the element position information, and the rectangular size information.

[0026] Optionally, in some embodiments, the adjustment module may include an image acquisition submodule, a calculation submodule and an adjustment submodule, as follows:

[0027] The image acquisition submodule may be configured to acquire at least one candidate reference image corresponding to the target expansion size parameter from at least one set of reference images;

[0028] The calculation submodule may be used to perform mean calculation on the reference position information in at least one candidate reference image to obtain the target reference position information;

[0029] The adjustment submodule may be used to adjust the position information corresponding to each element in the image to be drawn according to the target reference position information to obtain an adjusted image.

[0030] The adjustment submodule can be used to adjust the element position information corresponding to each element in the image to be drawn according to the target reference element position information to obtain adjusted element position information, adjust the element size information corresponding to each element in the image to be drawn according to the target reference element size information to obtain adjusted element size information, and draw the adjusted image according to the adjusted element position information and the adjusted element size information.

[0031] In addition, an embodiment of the present application further provides a computer storage medium, which stores a plurality of instructions, and the instructions are suitable for a processor to load to execute the steps in any one of the image drawing methods provided in the embodiment of the present application.

[0032] In addition, an embodiment of the present application also provides a computer device, which includes a processor and a memory, wherein the memory stores multiple instructions; the processor loads instructions from the memory to execute the steps in any image drawing method provided in the embodiment of the present application.

[0033] The embodiment of the present application can obtain an image to be drawn, which includes multiple elements, obtain at least one set of reference image sets, wherein each set of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements. According to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image, the position offset parameter of the element is calculated, and the position information corresponding to each element in the image to be drawn is adjusted according to the reference position information to obtain the adjusted image, and the elements in the adjusted image are offset according to the position offset parameter to draw the target image after the size expansion. The scheme can generate the target image after the size expansion according to the target expansion size parameter by analyzing the given image to be drawn. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0035] Figure 1 is a scene schematic diagram of an image rendering system provided by an embodiment of the present application;

[0036] Figure 2 is a first flow chart of the image drawing method provided in an embodiment of the present application;

[0037] Figure 3 is a second flow chart of the image drawing method provided in an embodiment of the present application;

[0038] Figure 4 is a third flow chart of the image drawing method provided in an embodiment of the present application;

[0039] Figure 5 is a schematic diagram of marking elements in an image provided by an embodiment of the present application;

[0040] Figure 6It is a schematic diagram of the types of labels provided in the embodiments of the present application;

[0041] Figure 7 is a schematic diagram of a reference image provided in an embodiment of the present application;

[0042] Figure 8 is a schematic diagram of adjusting elements in an image to be drawn provided by an embodiment of the present application;

[0043] Fig. 9 is a schematic diagram of generating a target image according to an image to be drawn provided by an embodiment of the present application;

[0044] Fig.10 is a schematic diagram of the structure of an image drawing device provided in an embodiment of the present application;

[0045] Fig.11 It is a structural diagram of the network device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] Please refer to the drawings, where the same component symbols represent the same components, and the principles of the present application are illustrated by implementing them in an appropriate computing environment. The following description is based on the illustrated specific embodiments of the present application, which should not be considered as limiting other specific embodiments of the present application that are not described in detail herein.

[0047] In the following description, the specific embodiments of the present application will be described with reference to the steps and symbols performed by one or more computers, unless otherwise stated. Therefore, these steps and operations will be mentioned several times as being performed by a computer, and the computer execution referred to herein includes the operation of a computer processing unit by an electronic signal representing data in a structured form. This operation converts the data or maintains it at a location in the memory system of the computer, which can be reconfigured or otherwise change the operation of the computer in a manner familiar to testers in the field. The data structure maintained by the data is a physical location in the memory, which has specific characteristics defined by the data format. However, the principles of the present application are described in the above text, which does not represent a limitation, and testers in the field will understand that the various steps and operations described below can also be implemented in hardware.

[0048] The term "module" used herein can be regarded as a software object executed on the computing system. The different components, modules, engines and services described herein can be regarded as implementation objects on the computing system. The apparatus and method described herein can be implemented in software, and of course can also be implemented in hardware, all within the scope of protection of this application.

[0049] The terms "first", "second", and "third" in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules that are not listed, or some embodiments also include other steps or modules inherent to these processes, methods, products, or devices.

[0050] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0051] The embodiment of the present application provides an image drawing method, and the execution subject of the image drawing method can be the image drawing device provided in the embodiment of the present application, or a network device integrated with the image drawing device, wherein the image drawing device can be implemented in hardware or software. Among them, the network device can be a smart phone, a tablet computer, a handheld computer, a laptop computer, or a desktop computer. The network device includes but is not limited to a computer, a network host, a single network server, a set of multiple network servers, or a cloud composed of multiple servers.

[0052] See also Figure 1 , Figure 1 A schematic diagram of an application scenario of an image drawing method provided in an embodiment of the present application, taking the image drawing device integrated in a network device as an example, the network device can obtain an image to be drawn, the image to be drawn includes multiple elements, obtain at least one set of reference image sets, wherein each set of reference image sets includes reference images of multiple sizes, the reference images include multiple reference elements, and according to a target expansion size parameter, position information corresponding to each element in the image to be drawn, and reference position information corresponding to each reference element in the reference image, calculate a position offset parameter of the element, adjust the position information corresponding to each element in the image to be drawn according to the reference position information, obtain an adjusted image, offset the elements in the adjusted image according to the position offset parameter, and draw the target image after the size expansion.

[0053] See also Figure 2 , Figure 2 The following is a flow chart of the image drawing method provided in the embodiment of the present application, which is specifically described by the following embodiments:

[0054] 201. Obtain an image to be drawn.

[0055] The image in this embodiment can be a medium for disseminating information about goods or services to consumers or users. The image can reflect the central purpose and vividly express the main emotional ideas or propaganda center. The image is usually a relatively beautiful picture designed by professional designers. For example, the image can be an advertisement, a banner, a flag, a newspaper title, a banner advertisement inside a mobile application or a website page, etc.

[0056] In order to expand the scope of publicity and achieve effective publicity effects when placing advertisements in actual scenarios, it is necessary to place advertisements on multiple platforms, multiple ad slots, and multiple terminals. These different advertising scenarios usually have ad slots of different sizes. Therefore, it is necessary to design multiple advertisements of different sizes but the same content to support advertising in multiple scenarios. Among them, the image to be drawn can be an image that has been designed for size expansion. For example, the image to be drawn can be an advertising image that has been designed. By analyzing the image to be drawn, the image to be drawn can be expanded in size to generate multiple target images of different sizes but with the same content as the image to be drawn.

[0057] The image to be drawn may include multiple elements. The elements may be data information in the image to express the promotional content. The elements may include background, product pictures, advertising text, promotional text, etc. For example, Figure 7 As shown, the image to be drawn may be an advertisement for a washing machine, and the image to be drawn may include elements such as a washing machine picture, a trademark, decorations, and a title.

[0058] In practical applications, in order to save manpower in designing multiple advertisements with the same content but different sizes, the existing images to be drawn can be analyzed and the sizes of the images to be drawn can be expanded to obtain advertisements of various sizes, thereby avoiding the need for designers to design advertisements of different sizes multiple times. This not only saves manpower but also greatly improves efficiency.

[0059] For example, the image to be drawn may be obtained. There are many ways to obtain the image to be drawn. The image to be drawn may be obtained through a network device, from local storage, or by using an advertising image designed by a designer as the image to be drawn, and so on.

[0060] In one embodiment, since the image mainly includes four elements: text, subject, logo, and decoration, in order to give the computer the ability to design target images of various sizes from the existing image to be drawn, after the image to be drawn is obtained, the elements in the image to be drawn can be structured. Specifically, the step of "obtaining the image to be drawn" may include:

[0061] Get the original image to be drawn;

[0062] Performing format conversion on the original image to be drawn to obtain an image after format conversion;

[0063] A plurality of elements in the image after the format conversion are marked to obtain an image to be drawn.

[0064] In practical applications, for example, since PSD format files can regularly represent the element information in an image, the image to be drawn can be converted into PSD format and read through PSD-Tools in Python environment. Among them, the tools for parsing PSD format files include not only PSD-Tools, but also other parsing tools.

[0065] Then, in order to facilitate reading and understanding of PSD format files, it is necessary to label the elements in the image to be drawn in PSD format. For example, the designer can understand the elements in the image to be drawn and use labels to label the elements in the image to be drawn. Among them, when the image to be drawn includes multiple elements of the same type, digital subscripts can also be used to distinguish them. Through the labeling of elements by designers, the computer can accurately obtain the category of the elements, thereby facilitating the computer to perform subsequent processing according to different categories. For example, Figure 6 As shown in FIG. 1 , examples of various tags in a PSD format file are shown. Designers can use various tags to mark multiple elements in an image.

[0066] In one embodiment, as shown in Table 1, the labels corresponding to the elements in the image can be divided into four primary labels, which can be: copy, main body, logo, and decoration. Among them, the "copy" in the primary label can include three secondary labels: main copy, secondary copy, and action point copy.

[0067] The main text is the text that gives an overall description of the image. For example, when the image is an advertisement promoting a discount day, the main text may be "Big sale on xx day".

[0068] Among them, the sub-copy is the copy that assists in explaining the image content. The sub-copy may include explanatory copy that explains the image content. For example, when the image is an advertisement for a certain product, the sub-copy may include information such as the product price, payment method, and whether shipping is free.

[0069] The action point copy may be a copy on the image that guides the user to perform an operation. For example, when the image is an advertisement promoting a certain product, the action point copy may be a copy that guides the user to purchase the product, such as "Buy Now" and so on.

[0070] Among them, the "subject" in the first-level label can include three second-level labels: goods, items, and people.

[0071] The commodity may be the main subject matter promoted in the image. For example, when the image is an advertisement for a certain product, the commodity may be a photo of the product to attract users to purchase.

[0072] Among them, the object can be an object used to assist in the expression in the image. For example, when the image is an advertisement for a product, the object can be an image that can attract users to purchase the product, such as an image related to expressing the performance of the product.

[0073] The person may be a portrait of a person used to assist in the performance of the image. For example, when the image is an advertisement for a product, the person may be a star or a celebrity who endorses the product. For the sake of image aesthetics, a non-full-body person image may be placed along the bottom edge of the image.

[0074] Among them, the "logo" in the first-level label can include a second-level label: trademark. A trademark can be a brand or part of a brand legally registered with the relevant government departments. For example, when the image is an advertisement for a product, the trademark can be the product trademark corresponding to the product.

[0075] Among them, the "modification" in the first-level label can include five second-level labels: main area modification, text area modification, action point modification, fragment modification, and border modification.

[0076] The subject area modification may be a modification that has a fixed positional relationship with the subject. For example, when the image is an advertisement for a certain product, the subject area modification may be a modified image that modifies the product photo.

[0077] The text area modification may be a modification that has a fixed positional relationship with the text, for example, the text area modification may be a color block at the bottom of the text, and so on.

[0078] The action point modification may be a modification picture for modifying the action point in the read image, for example, the action point modification may be an action point button picture.

[0079] The fragment modification may be a modified picture of a small piece in the image, for example, the fragment modification may be leaves, petals, small graphics, etc. in the image.

[0080] Among them, the border modification can be a border modification picture placed on the edge of the image, and the border modification can fill the edge of the image by stretching.

[0081] In one embodiment, the labels marked by the designer may be increased or decreased according to actual conditions and are not limited to the labels in Table 1.

[0082] Table 1

[0083]

[0084] For example, Figure 5 As shown, it is an image that has been distinguished by the designer. The image may include content background, and multiple elements, wherein the elements may include main copy, sub-copy, action point copy, border modification, action point modification, product, fragment modification-1, fragment modification-2, fragment modification-3, and fragment modification-4.

[0085] 202. Obtain at least one set of reference images.

[0086] In practical applications, changes in factors such as image size, number of lines of text, size of title, and aspect ratio of elements will affect the design of the image. Therefore, in order to ensure that a number of target images of different sizes can be generated by expanding the size of a completely designed image to be drawn, it is also necessary to obtain a certain amount of representative reference images. For example, at least one set of reference image sets can be obtained, wherein each set of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements.

[0087] In one embodiment, for example, Figure 7 As shown, multiple reference image sets can be obtained, each of which includes reference images of 10 reference sizes, where the reference sizes may include (1280 / [200, 368, 445, 576, 660, 720, 1067, 1280, 1920, 2276]), all reference images are fully designed images, and the reference images may include multiple reference elements. The number of reference image sets may be increased or decreased according to actual conditions, and the number of reference images in each reference image set may also be changed according to actual conditions, and is not limited to 10 sizes.

[0088] In one embodiment, after acquiring at least one set of reference images, reference elements in the reference images may be structured. The manner of structuring the elements in the images has been described in step 201 and will not be repeated here.

[0089] In this embodiment, the timing between step 201 and step 202 is not limited. For example, step 201 may be before step 202, or step 202 may be before step 201. Of course, steps 201 and 202 may also be performed simultaneously, etc.

[0090] 203. Calculate the position offset parameter of the element according to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image.

[0091] The target expansion size parameter may be a size corresponding to a target image to which the image to be drawn is to be expanded. For example, the target expansion size parameter may include values ​​of width and height of the target image to be expanded.

[0092] Among them, the position information can be information that characterizes the position and size of the elements in the image. According to the position information corresponding to the elements in the image, the position of the elements in the image and the size of the elements can be known, thereby realizing the positioning of the elements in the image.

[0093] The position offset parameter may be the offset of an element in the image to be drawn when the image to be drawn is expanded in size. After the position offset parameter is obtained, the element may be offset according to the position offset parameter to obtain the desired target image.

[0094] In practical applications, in order to generate target images of different sizes based on a known image to be drawn, the position offset parameters of the elements can be calculated based on the target expansion size parameters, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image, and the elements are offset. For example, the target expansion size parameters can be determined based on the image size to be expanded, and the target expansion size parameters can include w t and h t , where w t Can be the width of the image to be expanded, h t It can be the height of the image to be expanded. And obtain the position information corresponding to each element in the image to be drawn and the reference position information corresponding to each reference element in the reference image. According to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image, an optimized objective function can be constructed, and the position offset parameter of the element can be obtained by solving the objective function.

[0095] In one embodiment, in order to more accurately describe the position and size of the elements in the image, the position information corresponding to each element can be determined by obtaining the element size information and element position information of each element in the image to be drawn. Specifically, after the step of "obtaining the image to be drawn", it can also include:

[0096] Determine the enclosing rectangle corresponding to each element in the image to be drawn;

[0097] Acquire element size information corresponding to each element in the image to be drawn, and element position information corresponding to each element;

[0098] Obtaining the rectangular size information of the enclosing rectangle;

[0099] The position information of the element in the image to be drawn is acquired according to the element size information, the element position information, and the rectangle size information.

[0100] The enclosing rectangle may be a rectangle that can enclose the elements in the image, for example Figure 7 As shown, the dotted rectangle enclosing the washing machine image may be the enclosing rectangle corresponding to the washing machine image.

[0101] The element size information may be size data of the element in the image. For example, the element size information may be width data and height data of the element in the image. The width data of the element may be represented by w, and the height data of the element may be represented by h.

[0102] The element position information may be data representing the position of the element in the image, for example, the position of the element in the image may be determined in the form of coordinates, such as the upper left corner of the image may be used as the origin, the upper left corner abscissa of the element may be defined as x, and the upper left corner ordinate of the element may be defined as y.

[0103] In practical applications, for example, Figure 7 As shown, when the image to be drawn is a washing machine advertisement, the enclosing rectangle corresponding to each element in the washing machine advertisement can be obtained. The enclosing rectangle can be a dotted rectangle that envelops the element. And the element size information corresponding to each element, that is, the width and height of the element, can be obtained. The width data of the element can be represented by w, and the height data of the element can be represented by h. To obtain the element position information corresponding to each element, the upper left corner of the washing machine advertisement can be used as the origin, the upper left corner of the element's horizontal coordinate is defined as x, and the upper left corner of the element's vertical coordinate is defined as y. To obtain the rectangular size information of the enclosing rectangle corresponding to the element, w can be used. f Represents the width of the rectangle, through h f Represents the height data of the rectangle. Then, the position information corresponding to each element in the washing machine advertisement can be constructed based on the acquired data information. The position information can be expressed as

[0104] In one embodiment, the position offset parameters of the element may be defined as sx, sy, sw, sh, where sx and sy may represent the offset relative to x and y; sw may represent the scaling factor relative to w; sh may represent the scaling factor relative to h, and sh may be a function related to (sx, sy, sw, w, h) to maintain the original aspect ratio of various elements so that the image will not be greatly distorted after being expanded in size.

[0105] In one embodiment, in order to improve the accuracy of the position offset parameter result, the relative position between two reference elements in the reference image, the degree of fluctuation and other information may be introduced. Specifically, the step of "calculating the position offset parameter of the element according to the target extension size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image" may include:

[0106] Acquire relative position information between every two reference elements in the reference image according to reference position information corresponding to each reference element in the reference image;

[0107] Acquiring information on the degree of fluctuation of the relative position between the two reference elements in the reference image according to the relative position information between the two reference elements in the reference image;

[0108] Constructing position attribute information of a reference element in the reference image according to the reference position information, the relative position information, and the fluctuation degree information;

[0109] The position offset parameter of the element is calculated according to the target expansion size parameter, the position information of the element in the image to be drawn, and the position attribute information of the reference element in the reference image.

[0110] In practical applications, for example, after obtaining the reference position information corresponding to each reference element in the reference image, the relative position information between each two reference elements in the reference image can be obtained by calculating the difference in the reference position information between each two reference elements in the reference image. Then, the relative position information between each two reference elements obtained can be subjected to a second-order moment operation to obtain the degree of fluctuation of the relative position between each two reference elements in the reference image. Then, the position attribute information of the reference element in the reference image can be constructed through the reference position information, the relative position information, and the degree of fluctuation information. Then, an optimized objective function can be constructed based on the target extension size parameter, the position information of the element in the image to be drawn, and the position attribute information of the reference element in the reference image, and the objective function can be solved to obtain the position offset parameter of the element.

[0111] In one embodiment, the relative position and fluctuation degree information between two elements in the image to be drawn can also be introduced to improve the accuracy of the position offset parameter result. For example, after obtaining the position information corresponding to each element in the image to be drawn, the relative position information between each two elements in the image to be drawn can be obtained by calculating the difference between the position information of each two elements in the image to be drawn. Then, the relative position information between each two elements obtained can be subjected to a second-order moment operation to obtain the fluctuation degree information of the relative position between each two elements in the image to be drawn. Then, the position attribute information of the element in the image to be drawn can be constructed by the position information, the relative position information, and the fluctuation degree information of the relative position between each two elements in the image to be drawn. Then, an optimized objective function can be constructed according to the target extension size parameter, the constructed position attribute information of the element in the image to be drawn, and the position attribute information of the reference element in the reference image, and the objective function is solved to obtain the position offset parameter of the element.

[0112] For example, when the reference image includes n reference elements, after obtaining the reference position information corresponding to each reference element in the reference image After that, the reference position information corresponding to each two elements can be solved by difference to obtain the relative position information between each two reference elements, thereby obtaining n (n-1) relative position information, where the relative position information can be represented by a, that is, a jt =p j -p t , where j and t both represent the reference element numbers. Then, the second-order moments corresponding to the n(n-1) relative position information are calculated respectively. The second-order moments are the fluctuation degree information of the relative position between the two reference elements. The fluctuation degree information can be represented by b, that is, b jt =a jt 2 Since a and b are both lateral quantities, there is no need to consider third-order or higher moments. Then, the position attribute information of the reference element in the reference image is constructed based on the acquired reference position information, relative position information a, and fluctuation degree information b.

[0113] After obtaining the position attribute information of the reference element in the reference image, the position attribute information of the element in the image to be drawn can be constructed by analogy with the above steps. Then, an optimized objective function can be constructed according to the target expansion size parameter, the constructed position attribute information of the element in the image to be drawn, and the position attribute information of the reference element in the reference image, and the objective function can be solved to obtain the position offset parameter of the element.

[0114] In one embodiment, since at least one set of reference image sets is obtained, each set of reference image sets includes reference images of corresponding sizes. Therefore, in order to improve the accuracy of data acquisition, the fluctuation degree information can be calculated based on multiple images in at least one set of reference image sets. Specifically, the step of "obtaining the fluctuation degree information of the relative position between two reference elements in the reference image based on the relative position information between two reference elements in the reference image" may include:

[0115] Acquire at least one reference image of corresponding size from at least one set of reference images;

[0116] Acquiring relative position information between two reference elements in at least one reference image;

[0117] According to at least one relative position information, the fluctuation degree information of the relative position between two reference elements in the reference image is calculated.

[0118] In practical applications, for example, when m sets of reference image sets are obtained, and each set of reference image data includes reference images of 10 sizes, a reference image of the corresponding size can be obtained from each set of reference image sets, such as a reference image of the same size. Therefore, for each size, m reference images of corresponding sizes can be obtained. Then, the relative position information between two reference elements of corresponding positions in the m reference images of corresponding sizes can be obtained, so that m relative position information can be obtained. Then, the second-order moment of the m relative position information is solved, and the result obtained is the fluctuation degree information of the relative position between the two reference elements in the reference image.

[0119] In one embodiment, the accuracy of obtaining the position offset parameter can be improved by introducing discrete degree information, element distribution center information, and element restriction information. Specifically, the step of "constructing the position attribute information of the reference element in the reference image according to the reference position information, the relative position information, and the fluctuation degree information" may include:

[0120] Acquire discrete degree information according to the relative position information and the fluctuation degree information;

[0121] Combining the relative position information and the fluctuation degree information to obtain element distribution center information;

[0122] Acquiring element restriction information according to a preset restriction condition of the reference position information;

[0123] Position attribute information of the reference element in the reference image is constructed according to the discrete degree information, the element distribution center information, and the element restriction information.

[0124] In practical applications, for example, for a reference image, after obtaining the relative position information a and the fluctuation degree information b, the discrete degree information f1 can be defined: jt =a jt logb jt Then, each group [a, b] can be combined to obtain a matrix X with n(n-1) rows, and the element distribution center information f2 = ||X|| can be defined, where ||X|| is a low-rank representation of the matrix X. This representation can reduce the situation where some elements in the reference image have special distribution and outliers. Since some elements have special restrictions, such as The value of needs to be between [0,1], so the element restriction information can be defined as Among them, for The constraint that the value is greater than 0 can eliminate negative values ​​in the subsequent optimization solution, making the calculation simple and feasible. After defining the discrete degree information, element distribution center information, and element restriction information, the position attribute information of the reference element in the reference image can be constructed, and the position attribute information of the reference element in the reference image includes the discrete degree information, element distribution center information, and element restriction information.

[0125] In one embodiment, for the image to be drawn, the position attribute information of the elements in the image to be drawn can also be obtained through the above steps, wherein the position attribute information of the elements in the image to be drawn may include discrete degree information corresponding to the elements in the image to be drawn, element distribution center information, and element restriction information.

[0126] In one embodiment, after obtaining the target expansion size parameters, the position attribute information of the elements in the image to be drawn, and the position attribute information of the reference elements in the reference image, the optimization objective function can be constructed. For example, the unknown position offset parameters in the objective function can be defined as sx, sy, sw, sh; the discrete degree information of the reference element in the reference image is f1, the element distribution center information is f2, and the element restriction information is f3; the discrete degree information of the elements in the image to be drawn is g1, the element distribution center information is g2, and the element restriction information is g3. Then the formula of the objective function can be: Since the above optimization models are convex optimization and non-convex optimization, the global optimal or local optimal solution can be obtained by using stochastic gradient descent (SGD). For example, the solution tool provided in Python3 can be used to obtain the solution of the objective function.

[0127] In one embodiment, the method for solving the objective function is not limited to the example method, and a brute force search may be performed in a limited discrete space, or a reinforcement learning method may be used to solve the objective function, and so on.

[0128] That is to say, when there are n reference elements in the defined reference image, the reference position information corresponding to the jth reference element is When , the position information corresponding to the jth element in the image to be processed is Therefore, after the values ​​of sx, sy, sw, and sh are obtained, the position offset parameters can be used to Make corrections.

[0129] 204. Adjust the position information corresponding to each element in the image to be drawn according to the reference position information to obtain an adjusted image.

[0130] In practical applications, when the size of an element in an image changes, it will affect the overall layout of the image, so it is necessary to perform appropriate adaptive fine-tuning on the size and position of the elements in the image to be drawn. For example, a reference image corresponding to the size of the image to be drawn can be obtained from multiple reference images, and reference position information corresponding to the reference element in the reference image can be obtained. Then, based on the obtained reference position information, the size and position of the element in the image to be drawn are adjusted to obtain the adjusted image.

[0131] In one embodiment, in order to improve the accuracy of image size expansion, the image to be drawn may be adjusted to facilitate subsequent further offset of elements in the adjusted image. Specifically, the step of "adjusting the position information corresponding to each element in the image to be drawn according to the reference position information to obtain the adjusted image" may include:

[0132] Acquire at least one candidate reference image corresponding to the target expansion size parameter from at least one set of reference images;

[0133] Performing mean calculation on reference position information in at least one candidate reference image to obtain target reference position information;

[0134] According to the target reference position information, the position information corresponding to each element in the image to be drawn is adjusted to obtain an adjusted image.

[0135] In practical applications, for example, since multiple sets of reference image sets may be obtained, a reference image corresponding to the size of the image to be drawn may be obtained from each set of reference image sets, that is, multiple reference images may be obtained, and the multiple reference images may be averaged. For example, the reference position information in the multiple reference images obtained may be averaged to obtain target reference position information, which may represent the average of the reference images corresponding to the size of the image to be drawn in the multiple sets of reference images. The calculation using this information may avoid the problem of inaccurate results due to the particularity of the reference samples. Then, the position information corresponding to each element in the image to be drawn may be adjusted according to the target reference position information to obtain the adjusted image.

[0136] For example, it can be considered that the reference position information corresponding to the reference elements in the reference images corresponding to each set of sizes conforms to the Gaussian distribution, that is, each reference element has a certain variance attached to a certain mean. Then, when m reference images corresponding to the size of the image to be drawn are obtained, each reference image has n reference elements, and the reference position information corresponding to the reference element is Where i = [1, m], j = [1, n]. Then the calculated target reference position information is: The target variance is

[0137] In one embodiment, when adjusting the image to be drawn according to the target reference position information, it is possible to ensure that the elements of the image to be drawn before and after the adjustment are not distorted as much as possible. Therefore, the accuracy of the elements after adjustment can be ensured by ensuring the aspect ratio of the elements. Specifically, the step of "adjusting the position information corresponding to each element in the image to be drawn according to the target reference position information to obtain the adjusted image", wherein the target reference position information includes the target reference element size information and the target reference element position information, can include:

[0138] According to the target reference element position information, the element position information corresponding to each element in the image to be drawn is adjusted to obtain adjusted element position information;

[0139] According to the target reference element size information, adjusting the element size information corresponding to each element in the image to be drawn to obtain adjusted element size information;

[0140] The adjusted image is drawn according to the adjusted element position information and the adjusted element size information.

[0141] In practical applications, for example, after obtaining the target reference position information and the target variance, the position information of the element in the image to be drawn can be regarded as a variable, and the aspect ratio of the element in the adjusted image can be defined to be the same as the aspect ratio of the element in the image to be drawn. Then, the adjusted element position information of the element in the adjusted image can be determined based on the target reference element position information, such as making the center points of the enclosing rectangles corresponding to the two elements have the same coordinates relative to the origin in the upper left corner of the image. Then, the elements in the image to be drawn can be scaled while keeping the aspect ratio unchanged, so that the enclosing rectangle of the element can maximally not exceed the enclosing rectangle of the element corresponding to the target reference position information. Then, the mean error between the image corresponding to the target reference position information and the image to be drawn can be calculated, such as weighted error processing can be performed using the variance value.

[0142] In this embodiment, the timing between step 203 and step 204 is not limited. For example, step 203 may be before step 204, or step 204 may be before step 203. Of course, steps 203 and 204 may also be performed simultaneously, etc.

[0143] 205. Offset the elements in the adjusted image according to the position offset parameters to draw the target image after the size expansion.

[0144] In practical applications, for example, after obtaining the adjusted image and the position offset parameters, the elements in the adjusted image can be offset according to the position offset parameters, and the target image with the expanded size can be drawn according to the offset image.

[0145] In one embodiment, after the elements in the adjusted image are offset, the offset image may be manually fine-tuned so that the target image finally obtained can meet the user's needs to the greatest extent.

[0146] As can be seen from the above, the embodiment of the present application can obtain an image to be drawn, which includes multiple elements, obtain at least one set of reference image sets, wherein each set of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements. According to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image, the position offset parameter of the element is calculated, and the position information corresponding to each element in the image to be drawn is adjusted according to the reference position information to obtain the adjusted image, and the elements in the adjusted image are offset according to the position offset parameter to draw the target image after the size expansion. The scheme can analyze the position information of the elements in the image to be drawn, thereby expanding the size of the given image to be drawn and generating the target image after the size expansion. Through the image drawing method, there is no need to repeatedly design the image to be drawn by manpower to obtain target images of different sizes, thereby freeing up manpower, saving costs, and greatly improving the efficiency of image drawing, so that subsequent information dissemination work can be carried out smoothly.

[0147] According to the method described in the above embodiment, the image drawing device will be further described in detail below by taking the example of being specifically integrated into a network device.

[0148] refer to Figure 3 The specific process of the image drawing method of the embodiment of the present application can be as follows:

[0149] 301. A network device obtains an advertisement image to be drawn and multiple groups of reference advertisement image sets.

[0150] In practical applications, for example, Figure 4 As shown, the network device can obtain an advertisement image that has been designed by a designer as the advertisement image to be drawn, and the advertisement image to be drawn includes multiple elements. Figure 7 As shown, the network device can also obtain multiple groups of designed reference advertising image sets, wherein each group of reference advertising image sets includes 10 reference advertising images of different sizes, wherein the reference sizes may include (1280 / [200, 368, 445, 576, 660, 720, 1067, 1280, 1920, 2276]), and the reference advertising image includes multiple reference elements.

[0151] In one embodiment, in order to facilitate the computer to identify and analyze the acquired advertising image, and read the type, size, position and other information of the elements in the advertising image, and expand the size according to the existing advertising image, the advertising image to be drawn and the reference advertising image can be annotated to achieve the structuring of the elements in the advertising image. For example, the acquired advertising image to be drawn and the reference image can be converted into a PSD format file, so as to regularly represent various information of the elements in the advertising image, and read through PSD-tools in the Python environment.

[0152] After the advertisement image to be drawn and the reference image are converted into PSD format files, the designer can manually mark the elements in the advertisement image to be drawn and the reference elements in the reference image. For example, the designer can mark the elements in the advertisement image with tags. By marking the elements, the computer can accurately identify the various elements and smoothly perform subsequent algorithm processing.

[0153] Among them, the labels used by designers when marking can include four first-level labels: copy, main body, logo, and decoration. The first-level label "copy" can include three second-level labels: main copy, secondary copy, and action point copy. The first-level label "main body" can include three second-level labels: goods, items, and characters. The first-level label "logo" can include the second-level label "trademark". The first-level label "decoration" can include five second-level labels: main area decoration, copy area decoration, action point decoration, fragment decoration, and border decoration.

[0154] 302. The network device obtains position information of an element in the to-be-drawn advertisement image and reference position information of a reference element in the reference advertisement image.

[0155] In practical applications, after obtaining the advertisement image to be drawn and the reference advertisement image, data processing can be performed on the obtained advertisement image. Figure 7 As shown, the enclosing rectangle corresponding to each reference element in the reference advertisement image can be obtained. The enclosing rectangle can be a dotted rectangle that can enclose the reference element as a whole. Then define the point in the upper left corner of the reference advertisement image as the origin, and define the coordinates of the upper left corner of the reference element as (x, y), where x is the horizontal coordinate of the upper left corner of the reference element, and y is the vertical coordinate of the upper left corner of the reference element. And w represents the width of the reference element, h represents the height of the reference element, and w represents the height of the reference element. f Indicates the width of the enclosing rectangle corresponding to the reference element, through h f Indicates the height of the enclosing rectangle of the reference element. Then you can Indicates the reference position information corresponding to the reference element in the reference advertisement image.

[0156] In one embodiment, the position information corresponding to each element in the to-be-drawn advertisement image may also be obtained by the above-mentioned method of obtaining reference position information, which will not be described in detail here.

[0157] 303. The network device adjusts the position information of the elements in the advertisement image to be drawn according to the reference position information to obtain an adjusted advertisement image.

[0158] In practical applications, since multiple sets of reference advertising image sets are obtained, the multiple sets of reference advertising image sets can be averaged first to obtain more general reference data. For example, the data information in the multiple sets of reference advertising image sets can be defined to conform to the Gaussian distribution, that is, each reference element has a certain variance attached to a certain mean.

[0159] Therefore, when m sets of reference advertising images are obtained, and each reference image includes n reference elements, m reference advertising images with the same size as the advertising image to be drawn can be obtained from the m sets of reference advertising images. Then the reference position information corresponding to the reference element can be expressed as Where i = [1, m], j = [1, n]. Then the m reference advertisement images of the same size are averaged and the variance is calculated. The target reference position information after the solution can be expressed as The target variance can be expressed as

[0160] like Figure 4 As shown, after obtaining the target reference position information, the reference advertisement image can be drawn according to the target reference position information, and the target reference advertisement image can be drawn. The target reference advertisement image can represent the average size of multiple groups of reference advertisement image sets. Then, the elements in the advertisement image to be drawn can be adjusted according to the target reference advertisement image. For example, Figure 8 As shown, the elements in the advertisement image to be drawn can be scaled while keeping the aspect ratio of the elements in the advertisement image to be drawn unchanged, so that one side of the enclosing rectangle can fill the reference element in the target reference advertisement image.

[0161] 304. The network device constructs position attribute information of the reference element in the reference advertisement image according to the reference position information of the reference element in the reference advertisement image.

[0162] In one embodiment, the network device obtains the reference position information of the reference element in the reference advertisement image. After that, the relative position information between each two reference elements can be calculated based on the reference position information. The relative position information can be expressed as a jt =p j -pt , where n elements are included in the reference advertisement image, n(n-1) relative position information can be calculated. Then, based on the acquired relative position information, the fluctuation degree information of the relative position between two reference elements in the reference image can be calculated, where the fluctuation degree information can be expressed as b jt =a jt 2 , wherein, when the reference advertisement image includes n elements, n(n-1) pieces of fluctuation degree information can be calculated.

[0163] After obtaining the reference position information, relative position information a, and fluctuation degree information b in the reference advertisement image, the discrete degree information f1 can be defined. jt =a jt log b jt Then, the obtained [a, b] can be combined into a matrix X with n (n-1) rows, and the element distribution center information f2 = ||X|| is defined, where ||X|| is the low-rank representation of the matrix. In addition, due to the special restrictions on the reference elements, such as The value needs to be between (0,1), so the element restriction information can be expressed as Among them, for Constraints greater than 0 can eliminate negative values ​​during subsequent optimization.

[0164] After obtaining the discrete degree information f1, element distribution center information f2, and element restriction information f3, the position attribute information of the reference element in the reference advertisement image can be constructed, wherein the position attribute information of the reference element includes the discrete degree information f1, element distribution center information f2, and element restriction information f3.

[0165] 305. The network device constructs position attribute information of the element in the advertisement image to be drawn according to the position information of the element in the advertisement image to be drawn.

[0166] In actual applications, the network device can define the discrete degree information g1, element distribution center information g2, and element restriction information g3 corresponding to the elements in the advertising image to be drawn by the same method as step 304, and construct the position attribute information of the elements in the advertising image to be drawn by the discrete degree information g1, element distribution center information g2, and element restriction information g3, which will not be repeated here.

[0167] 306. The network device calculates a position offset parameter of the element according to the target expansion size parameter, the position attribute information of the element in the to-be-drawn advertisement image, and the position attribute information of the reference element in the reference advertisement image.

[0168] In practical applications, the network device may obtain the advertisement image size to which the advertisement image to be drawn is expected to be expanded, where w t It can represent the width to be expanded, h t It can indicate the height to be expanded. Then the position offset parameters sx, sy, sw, sh of the element can be defined, where sx is the offset corresponding to x, sy is the offset corresponding to y, sw is the scaling factor of w, and sh is the scaling factor of h. Where sh can be a function of (sx, sy, sw, w, h), so as to maintain the aspect ratio of the element in the advertising image.

[0169] Then, the objective function can be constructed according to the target expansion size parameter, the position attribute information of the element in the to-be-drawn advertisement image, and the position attribute information of the reference element in the reference advertisement image. For example, the target expansion size parameter w t and h t , f1, f2, f3, g1, g2, g3 construct the objective function, which can be expressed as

[0170] After obtaining the objective function, the global or local optimal solution can be calculated by stochastic gradient descent (SGD). For example, the solution tool provided in Python 3 can be used for solution.

[0171] 307. The network device offsets the elements in the adjusted advertisement image according to the position offset parameter, and draws a target advertisement image after the size is expanded.

[0172] In one embodiment, if Fig. 9 As shown, after the network device obtains the position offset parameter, it can offset the elements in the adjusted advertisement image according to the position offset parameter, thereby drawing the target advertisement image after the size is expanded.

[0173] As can be seen from the above, the embodiment of the present application can obtain the advertising image to be drawn and multiple groups of reference advertising image sets through the network device, obtain the position information of the elements in the advertising image to be drawn and the reference position information of the reference elements in the reference advertising image, adjust the position information of the elements in the advertising image to be drawn according to the reference position information, obtain the adjusted advertising image, construct the position attribute information of the reference elements in the reference advertising image according to the reference position information of the reference elements in the reference advertising image, construct the position attribute information of the elements in the advertising image to be drawn according to the position information of the elements in the advertising image to be drawn, calculate the position offset parameter of the element according to the target expansion size parameter, the position attribute information of the elements in the advertising image to be drawn, and the position attribute information of the reference elements in the reference advertising image, offset the elements in the adjusted advertising image according to the position offset parameter, and draw the target advertising image after the size expansion. The scheme can analyze the position information of the elements in the image to be drawn, thereby expanding the size of the given image to be drawn and generating the target image after the size expansion. Through this image drawing method, there is no need to repeatedly design the image to be drawn by manpower to obtain target images of different sizes, thereby freeing up manpower, saving costs, and greatly improving the efficiency of image drawing, so that subsequent information dissemination work can proceed smoothly.

[0174] In order to better implement the above method, an embodiment of the present application may also provide an image drawing device, which may be specifically integrated in a network device, which may include a server, a terminal, etc., wherein the terminal may include: a mobile phone, a tablet computer, a laptop computer or a personal computer (PC, Personal Computer), etc.

[0175] For example, Fig.10 As shown, the image drawing device may include a first acquisition module 101, a second acquisition module 102, a calculation module 103, an adjustment module 104 and a drawing module 105, as follows:

[0176] A first acquisition module 101 is used to acquire an image to be drawn, wherein the image to be drawn includes a plurality of elements;

[0177] A second acquisition module 102 is used to acquire at least one set of reference image sets, wherein each set of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements;

[0178] The calculation module 103 is used to calculate the position offset parameter of the element according to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image;

[0179] An adjustment module 104, configured to adjust the position information corresponding to each element in the image to be drawn according to the reference position information to obtain an adjusted image;

[0180] The drawing module 105 is used to offset the elements in the adjusted image according to the position offset parameters to draw a target image after the size expansion.

[0181] In one embodiment, the calculation module 103 may include a first acquisition submodule 1031, a second acquisition submodule 1032, a construction submodule 1033 and a calculation submodule 1034, as follows:

[0182] A first acquisition submodule 1031 is used to acquire relative position information between every two reference elements in the reference image according to reference position information corresponding to each reference element in the reference image;

[0183] The second acquisition submodule 1032 is used to acquire the fluctuation degree information of the relative position between the two reference elements in the reference image according to the relative position information between the two reference elements in the reference image;

[0184] A construction submodule 1033, configured to construct position attribute information of a reference element in the reference image according to the reference position information, the relative position information, and the fluctuation degree information;

[0185] The calculation submodule 1034 is used to calculate the position offset parameter of the element according to the target expansion size parameter, the position information of the element in the image to be drawn, and the position attribute information of the reference element in the reference image.

[0186] In one embodiment, the first acquisition submodule 1031 may be specifically used for:

[0187] Get the original image to be drawn;

[0188] Performing format conversion on the original image to be drawn to obtain an image after format conversion;

[0189] A plurality of elements in the image after the format conversion are marked to obtain an image to be drawn.

[0190] In one embodiment, the construction submodule 1033 may be specifically used for:

[0191] Acquire discrete degree information according to the relative position information and the fluctuation degree information;

[0192] Combining the relative position information and the fluctuation degree information to obtain element distribution center information;

[0193] Acquiring element restriction information according to a preset restriction condition of the reference position information;

[0194] Position attribute information of the reference element in the reference image is constructed according to the discrete degree information, the element distribution center information, and the element restriction information.

[0195] In one embodiment, the second acquisition submodule 1032 may be specifically used for:

[0196] Acquire at least one reference image of corresponding size from at least one set of reference images;

[0197] Acquiring relative position information between two reference elements in at least one reference image;

[0198] According to at least one relative position information, the fluctuation degree information of the relative position between two reference elements in the reference image is calculated.

[0199] In one embodiment, the image drawing device may also be used for:

[0200] Determine the enclosing rectangle corresponding to each element in the image to be drawn;

[0201] Acquire element size information corresponding to each element in the image to be drawn, and element position information corresponding to each element;

[0202] Obtaining the rectangular size information of the enclosing rectangle;

[0203] The position information of the element in the image to be drawn is acquired according to the element size information, the element position information, and the rectangle size information.

[0204] In one embodiment, the adjustment module 104 may include an image acquisition submodule 1041, a calculation submodule 1042 and an adjustment submodule 1043, as follows:

[0205] The image acquisition submodule 1041 is used to acquire at least one candidate reference image corresponding to the target expansion size parameter from at least one set of reference images;

[0206] A calculation submodule 1042 is used to perform mean calculation on the reference position information in at least one candidate reference image to obtain target reference position information;

[0207] The adjustment submodule 1043 is used to adjust the position information corresponding to each element in the image to be drawn according to the target reference position information to obtain an adjusted image.

[0208] In one embodiment, the adjusting submodule 1043 may be specifically used for:

[0209] According to the target reference element position information, the element position information corresponding to each element in the image to be drawn is adjusted to obtain adjusted element position information;

[0210] According to the target reference element size information, adjusting the element size information corresponding to each element in the image to be drawn to obtain adjusted element size information;

[0211] The adjusted image is drawn according to the adjusted element position information and the adjusted element size information.

[0212] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.

[0213] As can be seen from the above, the embodiment of the present application can obtain the image to be drawn by the first acquisition module 101, and the image to be drawn includes multiple elements, and obtain at least one set of reference image sets by the second acquisition module 102, wherein each set of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements, and the position offset parameters of the elements are calculated by the calculation module 103 according to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image, and the position information corresponding to each element in the image to be drawn is adjusted by the adjustment module 104 according to the reference position information to obtain the adjusted image, and the elements in the adjusted image are offset according to the position offset parameters by the drawing module 105 to draw the target image after the size expansion. The scheme can analyze the position information of the elements in the image to be drawn, thereby expanding the size of the given image to be drawn and generating the target image after the size expansion. Through the image drawing method, there is no need to repeatedly design the image to be drawn by manpower to obtain target images of different sizes, thereby freeing up manpower, saving costs, and greatly improving the efficiency of image drawing, so that subsequent information dissemination work can be carried out smoothly.

[0214] The embodiment of the present application also provides a network device, which can integrate any image drawing device provided in the embodiment of the present application.

[0215] For example, Fig.11 As shown, it shows a schematic diagram of the structure of the network device involved in the embodiment of the present application, specifically:

[0216] The network device may include one or more processing core processors 111, one or more computer-readable storage media memories 112, a power supply 113, an input unit 114 and other components. Those skilled in the art will appreciate that Fig.11 The network device structure shown in the figure does not constitute a limitation on the network device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0217] The processor 111 is the control center of the network device. It uses various interfaces and lines to connect various parts of the entire network device. It executes various functions of the network device and processes data by running or executing software programs and / or modules stored in the memory 112, and calling data stored in the memory 112, thereby controlling the network device as a whole. Optionally, the processor 111 may include one or more processing cores; preferably, the processor 111 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 111.

[0218] The memory 112 can be used to store software programs and modules. The processor 111 executes various functional applications and data processing by running the software programs and modules stored in the memory 112. The memory 112 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the network device, etc. In addition, the memory 112 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 112 may also include a memory controller to provide the processor 111 with access to the memory 112.

[0219] The network device also includes a power supply 113 for supplying power to each component. Preferably, the power supply 113 can be logically connected to the processor 111 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 113 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0220] The network device may further include an input unit 114, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0221] Although not shown, the network device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 111 in the network device will load the executable files corresponding to the processes of one or more application programs into the memory 112 according to the following instructions, and the processor 111 will run the application programs stored in the memory 112, thereby realizing various functions, as follows:

[0222] An image to be drawn is obtained, wherein the image to be drawn includes a plurality of elements, and at least one set of reference image sets is obtained, wherein each set of reference image sets includes reference images of a plurality of sizes, and the reference images include a plurality of reference elements, and a position offset parameter of the element is calculated according to a target expansion size parameter, position information corresponding to each element in the image to be drawn, and reference position information corresponding to each reference element in the reference image, and the position information corresponding to each element in the image to be drawn is adjusted according to the reference position information to obtain an adjusted image, and the elements in the adjusted image are offset according to the position offset parameter to draw a target image after the size expansion.

[0223] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0224] As can be seen from the above, the embodiment of the present application can obtain an image to be drawn, which includes multiple elements, obtain at least one set of reference image sets, wherein each set of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements. According to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image, the position offset parameter of the element is calculated, and the position information corresponding to each element in the image to be drawn is adjusted according to the reference position information to obtain the adjusted image, and the elements in the adjusted image are offset according to the position offset parameter to draw the target image after the size expansion. The scheme can analyze the position information of the elements in the image to be drawn, thereby expanding the size of the given image to be drawn and generating the target image after the size expansion. Through the image drawing method, there is no need to repeatedly design the image to be drawn by manpower to obtain target images of different sizes, thereby freeing up manpower, saving costs, and greatly improving the efficiency of image drawing, so that subsequent information dissemination work can be carried out smoothly.

[0225] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0226] To this end, an embodiment of the present application provides a computer device, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the image drawing methods provided in the embodiments of the present application. For example, the instructions can execute the following steps:

[0227] An image to be drawn is obtained, wherein the image to be drawn includes a plurality of elements, and at least one set of reference image sets is obtained, wherein each set of reference image sets includes reference images of a plurality of sizes, and the reference images include a plurality of reference elements, and a position offset parameter of the element is calculated according to a target expansion size parameter, position information corresponding to each element in the image to be drawn, and reference position information corresponding to each reference element in the reference image, and the position information corresponding to each element in the image to be drawn is adjusted according to the reference position information to obtain an adjusted image, and the elements in the adjusted image are offset according to the position offset parameter to draw a target image after the size expansion.

[0228] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0229] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0230] Since the instructions stored in the storage medium can execute the steps in any image drawing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any image drawing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0231] The above is a detailed introduction to an image drawing method and device provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An image drawing method, characterized in that: include: Acquire an image to be drawn, wherein the image to be drawn includes a plurality of elements; Acquire at least one set of reference image sets, wherein each set of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements; Calculate the position offset parameter of the element according to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image; Acquire at least one candidate reference image corresponding to the target expansion size parameter from at least one set of reference images; Performing mean calculation on reference position information in at least one candidate reference image to obtain target reference position information; Adjusting the position information corresponding to each element in the image to be drawn according to the reference position information to obtain an adjusted image; The elements in the adjusted image are offset according to the position offset parameters to draw a target image after the size expansion.

2. The image drawing method according to claim 1, characterized in that: Calculating the position offset parameter of the element according to the target extension size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image includes: Acquire relative position information between every two reference elements in the reference image according to reference position information corresponding to each reference element in the reference image; Performing a second-order moment operation on the relative position information between the two reference elements in the reference image to obtain the fluctuation degree information of the relative position between the two reference elements in the reference image; Constructing position attribute information of a reference element in the reference image according to the reference position information, the relative position information, and the fluctuation degree information; The position offset parameter of the element is calculated according to the target expansion size parameter, the position information of the element in the image to be drawn, and the position attribute information of the reference element in the reference image.

3. The image drawing method according to claim 2, characterized in that: The location attribute information includes discrete degree information, element distribution center information, and element restriction information; Constructing position attribute information of a reference element in the reference image according to the reference position information, the relative position information, and the fluctuation degree information, including: Acquire discrete degree information according to the relative position information and the fluctuation degree information; Combining the relative position information and the fluctuation degree information to obtain element distribution center information; Acquiring element restriction information according to a preset restriction condition of the reference position information; Position attribute information of the reference element in the reference image is constructed according to the discrete degree information, the element distribution center information, and the element restriction information.

4. The image drawing method according to claim 2, characterized in that: Acquiring information on the degree of fluctuation of the relative position between the two reference elements in the reference image according to the relative position information between the two reference elements in the reference image, including: Acquire at least one reference image of corresponding size from at least one set of reference images; Acquiring relative position information between two reference elements in at least one reference image; According to at least one relative position information, the fluctuation degree information of the relative position between two reference elements in the reference image is calculated.

5. The image drawing method according to claim 1, characterized in that: After obtaining the image to be drawn, it also includes: Determine the enclosing rectangle corresponding to each element in the image to be drawn; Acquire element size information corresponding to each element in the image to be drawn, and element position information corresponding to each element; Obtaining the rectangular size information of the enclosing rectangle; The position information of the element in the image to be drawn is acquired according to the element size information, the element position information, and the rectangle size information.

6. The image drawing method according to claim 1, characterized in that: The target reference position information includes target reference element size information and target reference element position information; According to the target reference position information, the position information corresponding to each element in the image to be drawn is adjusted to obtain an adjusted image, including: According to the target reference element position information, the element position information corresponding to each element in the image to be drawn is adjusted to obtain adjusted element position information; According to the target reference element size information, adjusting the element size information corresponding to each element in the image to be drawn to obtain adjusted element size information; The adjusted image is drawn according to the adjusted element position information and the adjusted element size information.

7. The image drawing method according to claim 1, characterized in that: Get the image to be drawn, including: Get the original image to be drawn; Performing format conversion on the original image to be drawn to obtain an image after format conversion; A plurality of elements in the image after the format conversion are marked to obtain an image to be drawn.

8. An image drawing device, characterized in that: include: A first acquisition module, used for acquiring an image to be drawn, wherein the image to be drawn includes a plurality of elements; A second acquisition module is used to acquire at least one group of reference image sets, wherein each group of reference image sets includes reference images of multiple sizes, and the reference images include multiple reference elements; A calculation module, used for calculating the position offset parameter of the element according to the target expansion size parameter, the position information corresponding to each element in the image to be drawn, and the reference position information corresponding to each reference element in the reference image; An image acquisition submodule, configured to acquire at least one candidate reference image corresponding to the target expansion size parameter from at least one set of reference images; A calculation submodule is used to calculate the mean of the reference position information in at least one candidate reference image to obtain the target reference position information. ; An adjustment module, used for adjusting the position information corresponding to each element in the image to be drawn according to the reference position information to obtain an adjusted image; A drawing module is used to offset the elements in the adjusted image according to the position offset parameters to draw a target image after the size expansion.

9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed on a computer, the computer is enabled to execute the image drawing method according to any one of claims 1 to 7.