CN116663088A - Automatic typesetting layout method and system for labels, electronic equipment and storage medium - Google Patents

Automatic typesetting layout method and system for labels, electronic equipment and storage medium Download PDF

Info

Publication number
CN116663088A
CN116663088A CN202310535920.2A CN202310535920A CN116663088A CN 116663088 A CN116663088 A CN 116663088A CN 202310535920 A CN202310535920 A CN 202310535920A CN 116663088 A CN116663088 A CN 116663088A
Authority
CN
China
Prior art keywords
layout
elements
sub
tag
constraint
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310535920.2A
Other languages
Chinese (zh)
Inventor
柳雄
杜智洁
李�杰
王一平
胡新平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Jingchen Wisdom Logo Technology Co ltd
Original Assignee
Wuhan Jingchen Wisdom Logo Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Jingchen Wisdom Logo Technology Co ltd filed Critical Wuhan Jingchen Wisdom Logo Technology Co ltd
Priority to CN202310535920.2A priority Critical patent/CN116663088A/en
Publication of CN116663088A publication Critical patent/CN116663088A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • G06F30/12Geometric CAD characterised by design entry means specially adapted for CAD, e.g. graphical user interfaces [GUI] specially adapted for CAD
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04847Interaction techniques to control parameter settings, e.g. interaction with sliders or dials
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2111/00Details relating to CAD techniques
    • G06F2111/04Constraint-based CAD
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2111/00Details relating to CAD techniques
    • G06F2111/06Multi-objective optimisation, e.g. Pareto optimisation using simulated annealing [SA], ant colony algorithms or genetic algorithms [GA]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The application discloses a label automatic typesetting layout method, a label automatic typesetting layout system, electronic equipment and a storage medium. The method comprises the steps of: obtaining the size information of a virtual drawing board, and obtaining tag elements and tag element attribute information input by a user, wherein the tag element attribute information at least comprises a plurality of constants; generating an equation set for solving a layout scheme of the tag element in the virtual drawing board based on the size information of the virtual drawing board and the tag element attribute information, wherein the equation set comprises an objective function and constraint conditions, and the layout scheme comprises values of a plurality of layout variables to be optimized of the tag element; and solving the equation set, determining the layout scheme, and displaying the label element on the virtual drawing board based on the layout scheme.

Description

Automatic typesetting layout method and system for labels, electronic equipment and storage medium
Technical Field
The application belongs to the field of label printing, and in particular relates to an automatic typesetting layout method, an automatic typesetting layout system, electronic equipment and a storage medium for labels.
Background
The label refers to the literal, graphic and symbol on the product and all the explanatory matters. The label is widely applied to the scenes of super-retail business, industrial production, express delivery, clothing, office management and the like, such as price labels, product description labels, shelf labels, bar code labels, clothing labels, document labels, file storage labels, various articles, stationery labels, express delivery face sheets and the like. The user can edit the label by using label printing software matched with the labeler, and the label is sent to the labeler for printing after the editing is finished.
In the prior art, when the label editing is performed, the layout of various label elements on the virtual drawing board needs to be manually adjusted, but the manual adjustment is relatively dependent on user experience, and the operation is inconvenient and the time consumption is long.
In the prior art, an automatic typesetting layout method is also provided, but the current automatic typesetting layout method is mainly applied to the field of Web front ends and is not suitable for automatic typesetting layout of labels. For example, automatic typesetting based on a streaming algorithm is not well suited for scenes where the number of text is not high, such as for a particular scene where text is automatically wrapped. Although the grid algorithm is simple, the size of the grid is not easy to adjust in the case of extremely large changes of the drawing board size, the element size and the like. In addition, based on the machine learning algorithm, a large amount of training data and data cleaning are needed, and the resource occupation is high.
In view of the foregoing, there is a need for an automatic layout method for labels.
Disclosure of Invention
Aiming at the defects or improvement demands of the prior art, the application provides an automatic typesetting layout method, an automatic typesetting layout system, electronic equipment and a storage medium for labels, which can automatically determine the layout scheme of label elements on a virtual drawing board.
In order to achieve the above object, according to an aspect of the present application, there is provided an automatic layout method of labels, comprising the steps of:
obtaining the size information of a virtual drawing board, and obtaining tag elements and tag element attribute information input by a user, wherein the tag element attribute information at least comprises a plurality of constants;
generating an equation set for solving a layout scheme of the tag element in the virtual drawing board based on the size information of the virtual drawing board and the tag element attribute information, wherein the equation set comprises an objective function and constraint conditions, the objective function is a function for measuring the layout effect of the layout scheme, the constraint conditions are mathematical expressions for describing the requirements of the layout scheme, and the layout scheme comprises values of a plurality of layout variables to be optimized of the tag element;
and solving the equation set, determining the layout scheme, and displaying the label element on the virtual drawing board based on the layout scheme.
Further, the tag element comprises any one or any combination of a text element, a picture element, a table element, a two-dimensional code element, a bar code element, a one-dimensional code element and a geometric figure element, the constant of the tag element attribute information comprises the width and height dimension information of the tag element, and the layout variable to be optimized of the element attribute information comprises the coordinate information of the tag element on the virtual drawing board.
Further, the tag element comprises a text element, the constant of the attribute information of the text element comprises the total number of words of the text element, and the layout variable to be optimized of the attribute information of the text element comprises the width-height size information of the text element and the coordinate information of the text element on the virtual drawing board.
Further, the tag element includes a picture element, the constant of the attribute information of the picture element includes aspect ratio information of the picture element, and the layout variable to be optimized of the picture element includes width-height size information of the picture element and coordinate information of the picture element on the virtual drawing board.
Further, the objective function is a weighted function of a plurality of sub-objectives, the plurality of sub-objectives measure the layout effect of the layout scheme from a plurality of dimensions respectively, the constraint condition includes a plurality of sub-constraint conditions, and the plurality of sub-constraint conditions describe the condition required to be satisfied by the layout scheme from a plurality of dimensions respectively.
Further, the plurality of sub-targets measure the layout effect of the layout scheme from a first relationship and/or a second relationship, respectively, the first relationship being a relationship between the label elements, and the second relationship being a relationship between the label elements and the virtual drawing board relationship.
Further, the sub-targets include any one or any combination of a first sub-target, a second sub-target, a third sub-target, a fourth sub-target, and a fifth sub-target, wherein the first sub-target is a function for measuring the overlapping degree between the label elements, the second sub-target is a function for measuring the alignment degree between the label elements, the third sub-target is a function for measuring the white degree between the label elements, the fourth sub-target is a function for measuring the centering degree of the label elements on the virtual drawing board, and the fifth sub-target is a function for measuring the frame distance between the label elements and the virtual drawing board.
Further, a machine learning method is employed to determine the weights of the sub-targets.
Further, the constraint includes a first sub-constraint that is an equality constraint based on a constant of the tag element attribute information.
Further, the constraints include a second sub-constraint that is an inequality constraint describing that all of the tag elements are located within the virtual palette frame.
Further, the constraints include a third sub-constraint that is an inequality constraint describing the relative positions between the tag elements.
Further, if the tag element includes a picture element, identifying a non-blank region in the picture element, the constraint includes a fourth sub-constraint that describes non-blank regions in which the tag element other than the picture element cannot be stacked in the picture element.
Further, if the tag element includes a picture element and a text element, identifying the content of the picture element, and determining a constraint condition of a relative position between the picture element and the text element as the third sub-constraint condition according to a content identification result of the picture element.
Further, the solving the equation set includes the steps of:
and determining an optimization algorithm according to the objective function and the constraint condition, and adopting the optimization algorithm to carry out iterative optimization on the layout variable to be optimized until the objective function is converged, and taking the value of the layout variable to be optimized as the layout scheme when the objective function is converged.
According to a second aspect of the present application, there is provided an automatic layout system for labels, comprising:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring the size information of the virtual drawing board and acquiring tag elements and tag element attribute information input by a user, and the tag element attribute information at least comprises a plurality of constants;
an equation set generating module, configured to generate an equation set for solving a layout scheme of the tag element in the virtual drawing board based on the size information of the virtual drawing board and the attribute information of the tag element, where the equation set includes an objective function and constraint conditions, the objective function is a function for measuring a layout effect of the layout scheme, the constraint conditions are mathematical expressions describing conditions required to be satisfied by the layout scheme, and the layout scheme includes values of a number of layout variables to be optimized of the tag element;
and the solving module is used for solving the equation set, determining the layout scheme and displaying the label element on the virtual drawing board based on the layout scheme.
According to a third aspect of the present application, there is provided an electronic device comprising at least one processing unit, and at least one storage unit, wherein the storage unit stores a computer program which, when executed by the processing unit, causes the processing unit to perform the steps of any of the above-described automatic layout method of labels.
According to a fourth aspect of the present application, there is provided a storage medium storing a computer program executable by an access authentication apparatus, the computer program, when run on the access authentication apparatus, causing the access authentication apparatus to perform the steps of any one of the above-described automatic layout method of labels.
In general, the above technical solutions conceived by the present application have the beneficial effects compared with the prior art:
(1) And the equation set is generated based on the size information of the virtual drawing board and the attribute information of the tag elements, and the equation set is solved, so that the layout scheme of the tag elements in the virtual drawing board is determined, the automatic typesetting layout of the tag elements is realized, the operation is simple and convenient, the requirement on users is low, and the typesetting layout time is greatly reduced.
(2) The method is very suitable for the field of labels, and can realize better automatic typesetting and layout effects for scenes with few texts, such as labels, and scenes with extremely-changed drawing board sizes, element sizes and the like.
(3) And a large amount of training data and clear data are not needed, and the consumption of calculation resources is low.
(4) More and more personalized layout effects can be quickly realized by adjusting constants, layout variables to be optimized, objective functions and constraint conditions in the attribute information.
Drawings
FIG. 1 is a flow chart of an automatic layout method of an embodiment of the present application;
FIG. 2 is a schematic diagram of tag elements prior to automatic layout according to an embodiment of the present application;
fig. 3 is a schematic diagram of tag elements after automatic layout according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application. In addition, the technical features of the embodiments of the present application described below may be combined with each other as long as they do not collide with each other.
In the description of embodiments of the present application, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. The meaning of "a plurality of" means at least two, e.g., two, three, etc., unless explicitly defined otherwise. The meaning of "a number" is at least one, such as one, two, three, etc., unless explicitly defined otherwise.
The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or modules is not necessarily limited to those steps or modules that are expressly listed or inherent to such process, method, article, or device.
The naming or numbering of the steps in the embodiments of the present application does not mean that the steps in the method flow must be executed according to the time/logic sequence indicated by the naming or numbering, and the named or numbered flow steps may change the execution order according to the technical purpose to be achieved, so long as the same or similar technical effects can be achieved.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
The application provides a label automatic typesetting layout method, a label automatic typesetting layout system, electronic equipment and a storage medium, and the method, the system and the storage medium are respectively described below.
As shown in fig. 1, the automatic typesetting layout method for labels according to the embodiment of the application includes the steps of:
s101, obtaining the size information of the virtual drawing board, and obtaining a tag element and tag element attribute information input by a user, wherein the tag element attribute information at least comprises a plurality of constants.
The virtual palette, i.e., canvas, is the area where the tab elements are drawn. The user inputs the tag element on the virtual drawing board, and sets attribute information of the tag element. The virtual palette may be implemented using the Google open source build user interface toolkit Flutter.
The tag element may be any one or any combination of text element, picture element, form element, two-dimensional code element, bar code element, one-dimensional code element, geometric figure element, etc. The categories of tag elements may also be extended as desired.
The tag element attribute information is used for describing tag elements, such as width and height size information of the tag elements, coordinate information of the tag elements on the virtual drawing board, specific content of the tag elements, category information of the tag elements and the like. The tag element attribute information may be different for different tag elements.
The tag element attribute information includes at least a number of constants, but which attribute information is constant is flexibly adjustable.
S102, based on the size information of the virtual drawing board and the attribute information of the tag elements, generating an equation set for solving a layout scheme of the tag elements in the virtual drawing board, wherein the equation set comprises an objective function and constraint conditions, the layout scheme comprises values of a plurality of layout variables to be optimized of the tag elements, the objective function is a function for measuring the layout effect of the tag elements based on the layout variables to be optimized and the constants, and the constraint conditions are conditions required to be met by describing the layout variables to be optimized of the tag elements based on the layout variables to be optimized and the constants.
The embodiment of the application abstracts the problem of automatic layout and typesetting of the tag elements in the virtual drawing board into the problem of solving the equation set. The user or developer only needs to define and adjust the constants, the layout variables to be optimized, the objective function and the constraint conditions in the attribute information of the tag elements to declare the layout typesetting effect expected to be achieved by himself, such as centering, alignment, uniform distribution, white keeping, overlapping avoidance and the like, and the equation set is solved by a computer, so that the value of the layout variables to be optimized can be determined, and the determined layout scheme can be determined. The extremum of the objective function can be obtained by adopting various existing optimization algorithms, and when the objective function is the extremum, the value of the layout variable to be optimized is the optimal layout scheme.
First is the abstraction of the problem and the definition of the layout variables to be optimized. For document layout problems, one reasonable abstraction is to abstract the relevant elements into rectangular elements with attribute information. A rectangular coordinate system is established by the width and height directions of the drawing board, and other elements are positioned on the coordinate system. Defining attribute information of tag elements as constants or variables: such as the tag element category, tag element ID, tag element coordinate system information (x value, y value), width to height size (width, height), number, etc.
In one embodiment, the tag element includes any one or any combination of a text element, a picture element, a table element, a two-dimensional code element, a bar code element, a one-dimensional code element, and a geometric figure element, the constant of the tag element attribute information includes width-height dimension information of the tag element, and the layout variable to be optimized of the element attribute information includes coordinate information of the tag element on the virtual drawing board. At this time, the width and height size information of the tag element is a fixed value, and the coordinate information of the tag element on the virtual drawing board is a variable to be solved.
In one embodiment, the tag element includes a text element, the constant of the text element attribute information includes a total number of words of the text element, and the layout variable to be optimized of the text element attribute information includes width-height size information of the text element, and coordinate information of the text element on the virtual palette. That is, in this embodiment, for the text element, the text box is allowed to be adjusted in width and height dimensions by means of text line feed, and specifically, the width and height of the text element may be constrained in consideration of a streaming algorithm or the like.
In another embodiment, the tag element includes a picture element, the constant of the attribute information of the picture element includes aspect ratio case information of the picture element, and the layout variable to be optimized of the picture element includes width-height size information of the picture element and coordinate information of the picture element on the virtual drawing board. That is, in this embodiment, the size of the picture element is allowed to be adjusted for the equal aspect ratio case.
After the layout variables to be optimized are defined, determining an objective function and constraint conditions, and generating an equation set. The objective function describes the layout effect of the tag element by a function, and the objective function is a function of constant and layout variables to be optimized based on attribute information of the tag element. The constraint condition is to convert the condition that the layout variable to be optimized of the tag element needs to satisfy into a mathematical expression.
The constant, the layout variable to be optimized, the objective function and the constraint condition can be flexibly adjusted by users and developers, and more personalized layout effects can be rapidly realized by adjusting the constant, the layout variable to be optimized, the objective function and the constraint condition in the attribute information.
In another embodiment, the objective function is a weighted function of a plurality of sub-objectives, the plurality of sub-objectives measure the layout effect of the tag element from a plurality of dimensions, respectively, the constraint comprises a plurality of sub-constraints, and the plurality of sub-constraints describe the condition required to be satisfied by the layout variable to be optimized of the tag element from a plurality of dimensions, respectively.
The design principle of the objective function can be as follows: as the layout variables to be optimized of the tag elements are developed toward conforming to the layout expectations, the values of the objective functions become smaller. The design of the objective function may take into account several dimensions in total, the final objective function being a combination of sub-objective weighted forms of the several dimensions. And setting a plurality of sub-targets and a plurality of sub-constraint conditions, describing the conditions required to be met by the layout variables to be optimized of the tag elements from the layout effects of the tag elements in a plurality of dimensions, so that the finally solved layout scheme is optimal under the objective function and the sub-constraint conditions.
The design of the objective function can be referred to these requirements: 1. the value of the objective function is typically a scalar, but may also be a vector or a matrix; 2, the objective function requirement is continuous; 3, the objective function does not require being bootable, but more optimizers can be used in case of being bootable; to limit the growth of certain variables or parameters, a canonical approach may be chosen, which may include, but is not limited to: LP norms, dropout then discard some factors or adjust the weights of the factors, etc.; 5, in some cases, normalization processing can be selected for width, height, coordinates, and the like.
In one embodiment, the sub-target includes a first sub-target y 1 Second sub-object y 2 Third sub-object y 3 Fourth sub-object y 4 Fifth sub-object y 5 Any one or any combination of the above.
The first sub-object y 1 Is a function of measuring the degree of overlap between the tag elements. In particular, y can be 1 The area of overlap between all elements may be set.
Wherein N is the number of elements, i is not less than 1 and not more than N, j is not less than 1 and not more than N, and area is the number of elements i,j Is the area of the overlap region between elements i, j.
The second sub-object y 2 Is a function of measuring the degree of alignment between the tag elements. Taking "element left aligned" as an example, the second sub-object y may be 2 The difference in the lower left corner x values of the rectangular box set to all elements.
Wherein, the liquid crystal display device comprises a liquid crystal display device,x-coordinate of the top left corner vertex of the ith element, +.>Is the x-coordinate of the top left corner vertex of the j-th element.
The third sub-object y 3 Is a function of a measure of the degree of whiteness between the label elements. The third sub-object y may be 3 Is set to a linear function that grows with the distance between the elements.
Wherein the method comprises the steps ofIs the minimum of the edge distances of element i and element j. And 0 when the two overlap.
The fourth sub-object y 4 Is a function of measuring how centered the label element is on the virtual palette. In one embodiment, the fourth sub-object y may be designed such that 4
If the drawing board contains an element thereon,
y 4 =d left *d right
wherein d is left Representative element is far from left of drawing boardDistance of frame d right Is the distance between the element and the right frame of the drawing board. From the constraint conditions described above, it can be seen that c width =d left +d right ,c width The width of the drawing board is a constant. The centering factor is reduced to a unitary quadratic equation when When this factor takes an extreme value.
If the drawing board contains N elements,
wherein the method comprises the steps ofRepresenting the distance of element i from the left frame of the drawing board, < >>The distance from the element i to the right frame of the drawing board.
The fifth sub-object y 5 Is a function of measuring a distance between the label element and the virtual palette frame.
Wherein, the liquid crystal display device comprises a liquid crystal display device,x-coordinate representing the right lower corner vertex of the ith element,/->A y-coordinate representing the lower right corner vertex of the i-th element; />X-coordinate representing the top left corner vertex of a virtual drawing board,/->Y-coordinate representing the top left corner vertex of a virtual drawing board,/->X-coordinate representing the right lower corner vertex of the virtual drawing board,/->Representing the y-coordinate of the right lower corner vertex of the virtual palette.
In one embodiment, the objective function is denoted as y.
Wherein constraint (2) represents the element width at the time of optimization being constant, width i Is the width of the ith element;
constraint (3) represents the invariant height of the element at the time of optimization, height i Is the height of the i-th element;
constraint (4) indicates that the element does not exceed the background box in the x direction at the time of optimization;
constraint (5) indicates that the element does not exceed the background box in the y direction at the time of optimization;
constraint (6) indicates the size, width, height of a known virtual palette.
The weights a, b, c, d, e may be set manually based on experience or by the user as desired. A preferred method is to use a machine learning method to determine the weights of the sub-targets.
Constraints are also to be defined, and the constraints may be predefined or based on tag element attribute information entered by the user.
Constraints may include equality constraints and inequality constraints. The equality constraints can be described in terms of equations that define the equality relationships of the layout variables to be optimized. Inequality constraints are used to define the range of values of the layout variables to be optimized.
In one embodiment, the constraint includes a first sub-constraint that is an equality constraint based on a constant of the tag element attribute information. For example, the width and height of the tag element of the constraint layout need to be the same as the width and height of the element input by the user, and suitable scenarios are, for example: a text box of a piece of text entered by a user does not want an algorithm to modify the size of the piece of text, but rather only the algorithm to modify the location of the text box. For example, the wide-to-high dimension ratio that constrains some elements remains unchanged, and applicable scenarios are, for example: the user wants the picture element aspect ratio to remain unchanged, but the picture can be scaled down or scaled up in equal aspect ratio embodiments.
In one embodiment, the constraints include a second sub-constraint that is an inequality constraint describing that all of the tag elements are located within the virtual palette frame. I.e., the x values of all elements should be between 0 and the width of the drawing board, and the y values of all elements should be between 0 and the height of the drawing board.
In one embodiment, the constraints include a third sub-constraint that is an inequality constraint describing the relative positions between the tag elements. For some specific types of elements, it may be required to be located in a specific location. For example: requiring bar codes and two-dimensional code elements to be positioned below text elements; the text element of the title, name type is required to be located above the text element of the price type.
In one embodiment, if the tag element includes a picture element, identifying a non-blank area in the picture element, the constraint includes a fourth sub-constraint that describes that the tag element other than the picture element cannot be stacked on the non-blank area in the picture element, i.e., that other tag elements can be stacked on the blank area of the picture element.
In one embodiment, if the tag element includes a picture element and a text element, identifying the content of the picture element, and determining, according to the content identification result of the picture element, a constraint condition of a relative position between the picture element and the text element as the third sub-constraint condition. Such a scene is suitable for a scene where there is some correlation between picture elements and text elements.
The constraint is flexibly adjustable, for example, it is also possible to constrain the range of wide and high dimensions for some tag elements, allowing the tag elements to be enlarged or reduced within a certain range.
Further, the solving the equation set includes the steps of:
and determining an optimization algorithm according to the objective function and the constraint condition, and adopting the optimization algorithm to carry out iterative optimization on the layout variable to be optimized until the objective function is converged, and taking the value of the layout variable to be optimized as the layout scheme when the objective function is converged. At this time, the optimal layout scheme calculated by the system is provided to the user. Alternatively, the system may calculate multiple layout schemes, supporting the user to switch between several layout schemes and preview effects, from which the user selects to determine the final layout scheme.
In particular, the corresponding optimization algorithm may be selected or designed depending on whether the objective function is linear or non-linear, constrained or unconstrained, equality constraint or inequality constraint, single-objective or multi-objective optimization, convex or non-convex optimization, discrete or continuous values, etc. Taking the problem of "multivariate optimization based on both equality constraints and inequality constraints" as an example, the use of sequential quadratic programming (Sequential quadratic programming) is one of the possible optimization algorithms.
And S103, solving the equation set, determining the layout scheme, and displaying the label element on the virtual drawing board based on the layout scheme. I.e. the effect of the layout scheme is presented on the virtual drawing board.
Fig. 2 is a schematic diagram of a user-entered tab element prior to automatic layout. The three label elements are label element 1, label element 2 and label element 3 respectively, and the label element positions before layout optimization are disordered. Attribute information of each element, such as the type, specific content, size, coordinates, etc., of the element is acquired separately. Based on the size information of the virtual drawing board and the attribute information of the tag element 1, the tag element 2 and the tag element 3, an equation set is generated, the equation set is solved, and the layout scheme of the tag element 1, the tag element 2 and the tag element 3 is determined. Fig. 3 is a schematic diagram after applying the automatic layout method of labels according to the embodiment of the present application. Through the experimental test of the technical scheme, the scheme can be effectively and automatically laid out and beautified. The calculation resource is lower, and the single-core CPU can be completed. And the calculation time consumed is short, typically within 500 ms.
According to a second aspect of the present application, there is provided an automatic layout system for labels, comprising:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring the size information of the virtual drawing board and acquiring tag elements and tag element attribute information input by a user, and the tag element attribute information at least comprises a plurality of constants;
an equation set generating module, configured to generate an equation set for solving a layout scheme of the tag element in the virtual drawing board based on the size information of the virtual drawing board and the attribute information of the tag element, where the equation set includes an objective function and a constraint condition, the layout scheme includes values of a number of layout variables to be optimized of the tag element, the objective function is a function that measures a layout effect of the layout scheme based on the layout variables to be optimized and the constants, and the constraint condition is a mathematical expression that describes a condition required to be satisfied by the layout scheme based on the layout variables to be optimized and the constants;
and the solving module is used for solving the equation set, determining the layout scheme and displaying the label element on the virtual drawing board based on the layout scheme.
The principle and effect of the automatic label typesetting layout system are the same as those of the automatic label typesetting layout method, and are not repeated here.
According to a third aspect of the present application, there is provided an electronic device comprising at least one processing unit, and at least one storage unit, wherein the storage unit stores a computer program which, when executed by the processing unit, causes the processing unit to perform the steps of any of the above-described automatic layout method of labels. The electronic device may be a portable electronic device such as a cell phone, tablet computer, personal digital assistant, wearable device, laptop computer, or the like. The processing unit may in some embodiments be a central processing unit, microprocessor or other data processing chip for executing program code or processing data stored in the memory unit. The storage unit may in some embodiments be an internal storage unit of the electronic device, such as a hard disk or a memory of the electronic device. The storage unit may in other embodiments also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card or the like provided on the electronic device.
According to a fourth aspect of the present application, there is provided a storage medium storing a computer program executable by an access authentication apparatus, the computer program, when run on the access authentication apparatus, causing the access authentication apparatus to perform the steps of any one of the above-described automatic tag layout methods. The storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, or the like, and implementing all or part of the flow of the embodiment of the method for editing the visual tag may be implemented by instructing related hardware by a computer program, and the program may be stored in the storage medium.
It will be readily appreciated by those skilled in the art that the foregoing description is merely a preferred embodiment of the application and is not intended to limit the application, but any modifications, equivalents, improvements or alternatives falling within the spirit and principles of the application are intended to be included within the scope of the application.

Claims (17)

1. An automatic typesetting layout method for labels is characterized by comprising the following steps:
obtaining the size information of a virtual drawing board, and obtaining tag elements and tag element attribute information input by a user, wherein the tag element attribute information at least comprises a plurality of constants;
generating an equation set for solving a layout scheme of the tag element in the virtual drawing board based on the size information of the virtual drawing board and the attribute information of the tag element, wherein the equation set comprises an objective function and constraint conditions, the layout scheme comprises values of a plurality of layout variables to be optimized of the tag element, the objective function is a function for measuring the layout effect of the layout scheme based on the layout variables to be optimized and the constants, and the constraint conditions are mathematical expressions for describing the conditions required to be met by the layout scheme based on the layout variables to be optimized and the constants;
and solving the equation set, determining the layout scheme, and displaying the label element on the virtual drawing board based on the layout scheme.
2. The automatic typesetting layout method of labels according to claim 1, wherein the label elements comprise any one or any combination of text elements, picture elements, table elements, two-dimensional code elements, bar code elements, one-dimensional code elements and geometric figure elements, the constants comprise information of width and height dimensions of the label elements, and the layout variables to be optimized comprise coordinate information of the label elements on the virtual drawing board.
3. The automatic layout method of labels typesetting according to claim 1, wherein the label elements comprise text elements, the constant comprises a total number of words of the text elements, and the layout variables to be optimized comprise width-height size information of the text elements and coordinate information of the text elements on the virtual drawing board.
4. The automatic layout method of labels typesetting according to claim 1, wherein the label elements comprise picture elements, the constants comprise aspect ratio information of the picture elements, and the layout variables to be optimized comprise width-height information of the picture elements and coordinate information of the picture elements on the virtual drawing board.
5. The automatic layout method according to claim 1, wherein the objective function is a function weighted by a plurality of sub-objectives, the plurality of sub-objectives measure layout effects of the layout scheme from a plurality of dimensions, respectively, the constraint condition includes a plurality of sub-constraint conditions, and the plurality of sub-constraint conditions describe conditions to be satisfied by the layout scheme from a plurality of dimensions, respectively.
6. The automatic layout method according to claim 5, wherein the plurality of sub-objects measure the layout effect of the layout scheme from a first relationship and/or a second relationship, respectively, the first relationship being a relationship between the tag elements and the second relationship being a relationship between the tag elements and the virtual drawing board relationship.
7. The automatic layout method of labels according to claim 5, wherein the sub-targets comprise any one or any combination of a first sub-target, a second sub-target, a third sub-target, a fourth sub-target, and a fifth sub-target, the first sub-target being a function of measuring a degree of overlap between the label elements, the second sub-target being a function of measuring a degree of alignment between the label elements, the third sub-target being a function of measuring a degree of white space between the label elements, the fourth sub-target being a function of measuring a degree of centering of the label elements on the virtual palette, the fifth sub-target being a function of measuring a distance between the label elements and the virtual palette.
8. The automatic layout method of labels according to claim 5, wherein the weights of the sub-targets are determined using a machine learning method.
9. The automatic layout method of tags according to claim 5, wherein the constraint includes a first sub-constraint which is an equality constraint based on constants of the tag element attribute information.
10. The automatic layout method of labels according to claim 5, wherein the constraint includes a second sub-constraint that is an inequality constraint describing that all of the label elements are within the virtual palette frame.
11. The automatic layout method of labels according to claim 5, wherein the constraint includes a third sub-constraint, the third sub-constraint being an inequality constraint describing the relative positions between the label elements.
12. The automatic layout method of tags according to claim 5, wherein if the tag element includes a picture element, non-blank areas in the picture element are identified, the constraint includes a fourth sub-constraint that describes non-blank areas in which the tag element other than the picture element cannot be stacked in the picture element.
13. The automatic layout method according to claim 11, wherein if the tag element includes a picture element and a text element, the content of the picture element is identified, and a constraint condition of a relative position between the picture element and the text element is determined as the third sub-constraint condition according to the content identification result of the picture element.
14. The automatic layout method of labels according to claim 1, wherein the solving the system of equations includes the steps of:
and determining an optimization algorithm according to the objective function and the constraint condition, and adopting the optimization algorithm to carry out iterative optimization on the layout variable to be optimized until the objective function is converged, and taking the value of the layout variable to be optimized as the layout scheme when the objective function is converged.
15. An automatic typesetting layout system for labels, comprising:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring the size information of the virtual drawing board and acquiring tag elements and tag element attribute information input by a user, and the tag element attribute information at least comprises a plurality of constants;
an equation set generating module, configured to generate an equation set for solving a layout scheme of the tag element in the virtual drawing board based on the size information of the virtual drawing board and the attribute information of the tag element, where the equation set includes an objective function and a constraint condition, the layout scheme includes values of a number of layout variables to be optimized of the tag element, the objective function is a function that measures a layout effect of the layout scheme based on the layout variables to be optimized and the constants, and the constraint condition is a mathematical expression that describes a condition required to be satisfied by the layout scheme based on the layout variables to be optimized and the constants;
and the solving module is used for solving the equation set, determining the layout scheme and displaying the label element on the virtual drawing board based on the layout scheme.
16. An electronic device comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program which, when executed by the processing unit, causes the processing unit to perform the steps of the automatic layout method of labels according to any one of claims 1 to 14.
17. A storage medium storing a computer program executable by an access authentication apparatus, the computer program causing the access authentication apparatus to perform the steps of the automatic layout method of labels according to any one of claims 1 to 14 when the computer program is run on the access authentication apparatus.
CN202310535920.2A 2023-05-12 2023-05-12 Automatic typesetting layout method and system for labels, electronic equipment and storage medium Pending CN116663088A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310535920.2A CN116663088A (en) 2023-05-12 2023-05-12 Automatic typesetting layout method and system for labels, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310535920.2A CN116663088A (en) 2023-05-12 2023-05-12 Automatic typesetting layout method and system for labels, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116663088A true CN116663088A (en) 2023-08-29

Family

ID=87714472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310535920.2A Pending CN116663088A (en) 2023-05-12 2023-05-12 Automatic typesetting layout method and system for labels, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116663088A (en)

Similar Documents

Publication Publication Date Title
CN1763743B (en) System and method for automatic label placement on charts
JP4572669B2 (en) Layout rule generation system, layout system, layout rule generation method, and layout rule generation program
CN111428457B (en) Automatic formatting of data tables
US10169549B2 (en) Digital image processing including refinement layer, search context data, or DRM
US20160019243A1 (en) Template metadata
US10600223B2 (en) Methods and systems for determining the structure of a sorted collection list of layouts
CN111433762A (en) Graphically organizing content in a user interface of a software application
US7831907B2 (en) Grouping of information items on a page
US11144717B2 (en) Automatic generation of document layouts
EP2633428A1 (en) Optimizing hyper parameters of probabilistic model for mixed text-and-graphics layout template
US10825214B2 (en) Priority based automatic placement of labels on charts
CN116663088A (en) Automatic typesetting layout method and system for labels, electronic equipment and storage medium
US8326812B2 (en) Data search device, data search method, and recording medium
US8594459B2 (en) Arranging secondary images adjacent to a primary image
US10482173B2 (en) Quality distributions for automated document
US20230222716A1 (en) Method and apparatus for automatically generating banner image, and computer-readable storage medium
US11538210B1 (en) Text importance spatial layout
CN111553136A (en) Method and device for generating demonstration document template and electronic equipment
US20180365245A1 (en) Method and apparatus for recognizing slide
WO2009087815A1 (en) Similar document retrieval system, similar document retrieval method and recording medium
CN116403203B (en) Label generation method, system, electronic equipment and storage medium
Zhang et al. Creating Word Paintings Jointly Considering Semantics, Attention, and Aesthetics
CN113298599B (en) Object display method, device and equipment
Faria et al. Measuring aesthetic distance between document templates and instances
US20040122824A1 (en) Apparatus and method for market-based document content selection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination