Label typesetting method and device, equipment and storage medium
By constructing an objective function in the home decoration design software to optimize the position of the annotation area, the overlapping problem when automatically generating annotation is solved, and the reasonable layout of the annotation area and the correct display of the design drawing are achieved.
Patent Information
- Application Number
- CN202310891499.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-19
- Publication Date
- 2025-01-21
AI Technical Summary
In home decoration design software, automatically generated annotations are prone to overlapping problems in design drawings, resulting in users needing manual adjustments to avoid errors during delivery.
By determining the position coordinates of the display area, obstacle area and annotation area in the target design drawing, an objective function is constructed to optimize the layout position of the annotation area and ensure the best relationship between the annotation area, obstacles and display area.
It effectively avoids the overlap problem between the marked area and the obstacle area, and ensures that the marked area is within the corresponding display area within the scene range of the design drawing, making the location of the marked area more reasonable.
Smart Images

Figure CN119338946A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet information processing technology, and in particular to a marking and typesetting method, device and storage medium. Background Art
[0002] In home decoration design software, when generating a floor plan or elevation, due to the small internal space of the drawing, the corresponding annotation content is large. When automatically generating non-dimensional annotations, these annotations will overlap a lot. The design user will need to manually adjust these overlapping annotation information before it can be officially delivered for use. Therefore, how to provide a method for annotation typesetting to solve the problem of annotation overlap when automatically generating annotations on design drawings in the prior art. Summary of the invention
[0003] Multiple aspects of the present application provide a method, device and storage medium for typesetting annotations, which are used to solve the problem of annotation overlap when annotations are automatically generated on design drawings in the prior art.
[0004] The embodiment of the present application also provides a method for typesetting annotations, including: determining the position coordinates of the display areas of multiple target objects to be typeset and the position coordinates of multiple obstacle areas in a target design drawing, and determining the position coordinates of the annotation areas of the multiple target objects as independent variable parameters; determining the overlapping areas between the annotation areas of the multiple target objects and the multiple obstacles, the overlapping areas between the annotation areas of the multiple target objects and the display areas of the corresponding target objects, and the relationship between the annotation areas of the multiple target objects and the scene range of the target design drawing based on the position coordinates of the display areas of the multiple target objects and the position coordinates of the obstacle areas, and the position coordinates of the annotation areas of the multiple target objects represented by the independent variable parameters; constructing an objective function based on the overlapping areas between the annotation areas of the multiple target objects and the multiple obstacles, the overlapping areas between the annotation areas of the multiple target objects and the display areas of the corresponding target objects, and the relationship between the annotation areas of the multiple target objects and the scene range of the target design drawing; when the value of the objective function reaches a specified limit value, determining the position coordinates of the annotation areas of the multiple target objects, and typeset the annotation areas of the multiple target objects based on the position coordinates of the annotation areas of the multiple target objects.
[0005] The embodiment of the present application also provides a marking typesetting device, comprising: a first determining module, used to determine the position coordinates of the display areas of multiple target objects to be typeset and the position coordinates of multiple obstacle areas in the target design drawing, and to determine the position coordinates of the marking areas of the multiple target objects as independent variable parameters; a second determining module, used to determine the overlapping areas between the marking areas of the multiple target objects and the multiple obstacles, and the overlapping areas between the marking areas of the multiple target objects and the corresponding display areas of the target objects based on the position coordinates of the display areas of the multiple target objects and the position coordinates of the multiple obstacle areas, and the position coordinates of the marking areas of the multiple target objects represented by the independent variable parameters. a function construction module for constructing an objective function based on the overlapping areas between the labeled areas of the multiple target objects and the multiple obstacles, the overlapping areas between the labeled areas of the multiple target objects and the corresponding display areas of the target objects, and the relationship between the labeled areas of the multiple target objects and the scene range of the target design drawing; and a labeling layout module for determining the position coordinates of the labeled areas of the multiple target objects when the value of the objective function reaches a specified limit value, and layout the labeled areas of the multiple target objects based on the position coordinates of the labeled areas of the multiple target objects.
[0006] The embodiment of the present application also provides an electronic device, comprising: a memory and a processor; the memory is used to store a computer program; the processor is coupled to the memory and is used to execute the computer program, so as to: determine the position coordinates of the display areas of multiple target objects to be typeset in the target design drawing and the position coordinates of multiple obstacle areas, and determine the position coordinates of the marked areas of the multiple target objects as independent variable parameters; based on the position coordinates of the display areas of the multiple target objects and the position coordinates of the multiple obstacle areas, and the position coordinates of the marked areas of the multiple target objects represented by the independent variable parameters, determine the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, and the overlapping areas between the marked areas of the multiple target objects. The objective function is constructed based on the overlapping areas between the annotated areas of the target objects and the overlapping areas between the annotated areas of the target objects and the corresponding display areas of the target objects, and the relationship between the annotated areas of the target objects and the scene range of the target design drawing; when the value of the objective function reaches a specified limit value, the position coordinates of the annotated areas of the target objects are determined, and the annotated areas of the target objects are typeset based on the position coordinates of the annotated areas of the target objects.
[0007] The embodiment of the present application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor is caused to implement the steps in the annotation typesetting method provided in the embodiment of the present application.
[0008] In an embodiment of the present application, when typeset annotations in a target design drawing, the position coordinates of the display areas of multiple target objects to be typeset in the target design drawing and the position coordinates of multiple obstacle areas can be determined, and the position coordinates of the annotation areas of multiple target objects can be determined as independent variable parameters. Based on the position coordinates of the display areas of the multiple target objects and the position coordinates of the multiple obstacle areas, as well as the position coordinates of the marked areas of the multiple target objects represented by the independent variable parameters, the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the display areas of the corresponding target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing are determined, and this is used as the constraint condition for constructing the objective function, that is, when constructing the objective function, the overlap between the marked areas of the multiple target objects to be typeset and the obstacles, the overlap between the marked areas of the multiple target objects and the display areas of the target objects, and whether the marked areas of the multiple target objects are within the scene range of the target design drawing are taken into account at the same time. In this way, when the position coordinates of the marked areas of the multiple target objects determined according to the value of the objective function reaching the specified limit value and the marked areas of the multiple target objects are typeset based on the position coordinates of the marked areas of the multiple target objects, the overlapping problem of the marked areas and the obstacle areas can be effectively avoided, and the marked areas can be kept in the display area of the corresponding target object in the scene range of the target design drawing, so that the position of the determined marked areas is more reasonable. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0010] Figure 1 A schematic diagram of an implementation flow of a method for marking and typesetting provided for an exemplary embodiment of the present application;
[0011] Figure 2 A schematic diagram of converting annotation data into standard geometric data in the annotation typesetting method provided by an exemplary embodiment of the present application;
[0012] Figure 3 The annotation typesetting method provided for the exemplary embodiment of the present application is applied to a flow chart in an actual scenario;
[0013] Figure 4A schematic diagram of the structure of a marking typesetting device provided for an exemplary embodiment of the present application;
[0014] Figure 5 A schematic structural diagram of an electronic device provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0015] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0016] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0017] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0018] First, the terms involved in one or more embodiments of the present application are explained.
[0019] Annotation: In the CAD field, annotation is used to express additional information, such as dimension annotation, text annotation, special icons, or a combination of geometric figures and text. The annotation should be of moderate font size and clear.
[0020] Elevation drawing: The orthographic projection drawing of a house made on a projection plane parallel to the house facade is called the building elevation drawing, or elevation drawing for short. Whether a building is beautiful depends largely on its artistic treatment on the main facade, including its beautiful shape and decoration; in the design stage, the elevation drawing is mainly used to study this artistic treatment, and in the construction drawing, it mainly reflects the appearance of the house and the method of facade decoration.
[0021] Since the internal space of the drawing is small, but the corresponding annotation content is large, in some home decoration design software, after the elevation or plane annotation is automatically generated, the annotation overlap problem will occur. In response to this, the existing technology uses a greedy algorithm to determine a better position for each overlapping annotation in other areas outside the obstacles and the annotation area with a determined position to place the annotation, so as to solve the problem of overlapping annotations. However, this method only considers one annotation at a time, and cannot provide an avoidance plan for the positions of other subsequent annotations, lacking global consideration.
[0022] To this end, an embodiment of the present application provides a method for typesetting annotations, which, when typeset annotations in a target design drawing, can determine the position coordinates of display areas of multiple target objects to be typeset in the target design drawing and the position coordinates of multiple obstacle areas, and determine the position coordinates of the annotation areas of multiple target objects as independent variable parameters. Based on the position coordinates of the display areas of the multiple target objects and the position coordinates of the multiple obstacle areas, as well as the position coordinates of the marked areas of the multiple target objects represented by the independent variable parameters, the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the display areas of the corresponding target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing are determined, and this is used as the constraint condition for constructing the objective function, that is, when constructing the objective function, the overlap between the marked areas of the multiple target objects to be typeset and the obstacles, the overlap between the marked areas of the multiple target objects and the display areas of the target objects, and whether the marked areas of the multiple target objects are within the scene range of the target design drawing are taken into account at the same time. In this way, when the position coordinates of the marked areas of the multiple target objects determined according to the value of the objective function reaching the specified limit value and the marked areas of the multiple target objects are typeset based on the position coordinates of the marked areas of the multiple target objects, the overlapping problem of the marked areas and the obstacle areas can be effectively avoided, and the marked areas can be kept in the display area of the corresponding target object in the scene range of the target design drawing, so that the position of the determined marked areas is more reasonable. Specifically, in the present application, a method for marking and typesetting is provided. The present application also relates to a marking and typesetting device, an electronic device and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0023] Figure 1 The following is a flow chart of a method for marking and typesetting provided by an exemplary embodiment of the present application. Figure 1 As shown, the method includes:
[0024] Step 110, determining the position coordinates of the display areas of the multiple target objects to be typeset in the target design drawing and the position coordinates of the multiple obstacle areas, and determining the position coordinates of the marked areas of the multiple target objects as independent variable parameters.
[0025] The target design drawing may be a home decoration elevation drawing or a customized elevation drawing generated by home decoration software, or may be a home decoration floor plan or a customized floor plan. The target object may be an object that needs to be annotated in the target design drawing. The name of each target object may be represented by text annotation, geometric figure annotation, or a combination of text and geometric figure annotation. The area occupied by the annotation of each target object may be abstracted as a rectangular frame, and the rectangular frame where the annotation is located may be called the annotation area.
[0026] Among them, obstacles can be defined as annotations that are not necessary to participate in the layout of the target design drawing and some elements filled with dark colors. Among them, annotations that are not necessary to participate in the layout can be defined as annotations whose positions have been calculated when drawing the target design drawing. For example, annotations such as room names have been calculated and placed in the center of the room. This annotation usually does not overlap with other annotations. This type of annotation can be defined as an annotation that is not necessary to participate in the layout. The target design drawing can be composed of a series of blocks and line geometric fills. Some elements in the drawing may be filled with dark colors. If the annotations are directly covered on such elements, it will make it impossible to see the annotation content. For example, demolished walls are usually filled with darker colors, and these elements are defined as a type of obstacle. In some exemplary embodiments, determining the position coordinates of multiple obstacle areas in the target design drawing includes:
[0027] Determine from the target design drawing an area filled with a color block of a specified color and an annotated area that satisfies a preset annotation condition, wherein the preset annotation condition is used to indicate an annotated area with a fixed position coordinate in the target design drawing;
[0028] Based on the areas filled with blocks of specified colors and the marked areas satisfying preset marking conditions, the position coordinates of the plurality of obstacle areas are determined.
[0029] Among them, the areas filled with blocks of specified color may be some areas filled with blocks of dark color. When annotations are placed on such areas, they may not be clearly visible, so such areas can be defined as obstacle areas. The preset annotation conditions can be the annotations that are not necessary to participate in typesetting as mentioned above. Since the annotation positions of such annotations have been pre-calculated, there is no need to perform typeset operations on them. The embodiment of the present application takes into account that typesetting of annotations is usually more performance-consuming. Therefore, when determining the annotation areas of multiple target objects to be typeset in the target design drawing, such annotation areas can also be defined as obstacle areas, that is, it is only necessary to consider whether they will overlap with the annotation areas participating in typesetting, and there is no need to perform typeset operations on them. Specifically, determining the position coordinates of the display areas of multiple target objects to be typeset in the target design drawing includes:
[0030] The marked areas that meet the preset marking conditions are filtered from the target design drawing to obtain the position coordinates of the display areas of the multiple target objects to be typeset. The preset marking conditions can be set according to actual needs, and the embodiment of the present application does not limit this.
[0031] Optionally, after filtering the annotation areas that meet the preset annotation conditions from the target design drawing and obtaining the position coordinates of the display areas of the multiple target objects to be typeset, in order to facilitate determining the overlapping area between the annotation areas of the multiple target objects to be typeset and the display areas of the multiple target objects, and to utilize the overlapping area to limit the annotation areas of the multiple target objects to be as much as possible within the display areas of the corresponding target objects, an association relationship between the annotation areas of the multiple target objects to be typeset and the display areas of the corresponding target objects can be established. Specifically, to establish an association relationship between the annotation areas of the multiple target objects to be typeset and the display areas of the corresponding target objects, the identifier of the display area of the corresponding target object can be added to the annotation areas of each target object, or the polygon attributes of the display area of the corresponding target object can be directly added to the annotation areas of each target object.
[0032] It should be understood that, in order to facilitate the construction and solution of the objective function, the position coordinates of the display areas of multiple target objects in the target design drawing, the position coordinates of multiple obstacle areas, and the position coordinates of the marked areas of multiple target objects can be uniformly expressed using standard geometric data. Specifically, the display areas of multiple target objects and multiple obstacle areas can be abstracted as maximum boundary rectangular areas or polygonal areas, and the abstracted rectangular areas or polygonal areas are converted to the global coordinate system of the target design drawing to obtain the position coordinates of the display areas and obstacle areas of multiple target objects. At the same time, the marked areas of multiple target objects are abstracted as movable and rotatable rectangular frames, and the position coordinates of each rectangular frame in the global coordinate system of the target design drawing are represented in the form of independent variables. Among them, the position coordinates of the display areas of multiple target objects and multiple obstacle areas can be represented by the vertex coordinates included in the corresponding polygons or rectangular frames, and the position coordinates of the marked areas of the target objects represented in the form of independent variables can also be represented by the vertex coordinates included in the corresponding rectangular frames.
[0033] Figure 2 A schematic diagram of converting annotation data into standard geometric data in the annotation typesetting method provided in the exemplary embodiment of the present application. The position coordinates of the obstacle area in the target design drawing can be converted into Figure 2 The expression of LLBlock shown in FIG. 1 includes ID, border array, position coordinates, rotation angle and display area of the associated target object. The position coordinates of the display area and the annotation area of multiple target objects in the target design diagram can be converted into Figure 2The expression of LLAnnotation shown includes ID, bounding box array and obstacle avoidance weight.
[0034] Step 120, based on the position coordinates of the display areas of the multiple target objects and the position coordinates of the multiple obstacle areas, as well as the position coordinates of the marked areas of the multiple target objects represented by the independent variable parameters, determines the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the display areas of the corresponding target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing.
[0035] Among them, the overlapping area between the marked areas of multiple target objects and multiple obstacles, the overlapping area between the marked areas of multiple target objects and the display areas of corresponding target objects, and the relationship between the marked areas of multiple target objects and the scene range of the target design drawing can be used as constraints for constructing the objective function.
[0036] In some exemplary embodiments, due to the different filling colors of obstacles, the overlapping effects on annotations are also different. For example, for obstacles with dark filling colors, when annotations cover such obstacles, the content of the annotations may not be clearly visible. However, some obstacle areas are text areas. Although the text areas are covered by other annotation areas, the content in other annotation areas can still be distinguished. In view of this, the embodiments of the present application can set corresponding obstacle avoidance weights for different types of obstacles according to actual needs. Based on the obstacle avoidance weights, the sum of the weighted overlapping areas between the annotation areas of multiple target objects and multiple obstacles is determined, and this is used as one of the constraints of the objective function. Specifically, determining the overlapping areas between the annotation areas of multiple target objects and multiple obstacles includes:
[0037] Determine obstacle avoidance weights for multiple obstacle areas;
[0038] Based on the position coordinates of the display areas of the multiple target objects, the position coordinates of the multiple obstacle areas, the obstacle avoidance weights of the multiple obstacle areas, and the position coordinates of the labeled areas of the multiple target objects represented by the independent variable parameters, the sum of the weighted overlapping areas between the labeled areas of the multiple target objects and the multiple obstacle areas is determined.
[0039] The calculation formula for the sum of the weighted overlapping areas between the annotated areas of multiple target objects and multiple obstacles is: The sum of the weighted overlapping areas of the annotated area of the i-th target object and multiple obstacle areas is: λ j is the obstacle avoidance weight of the j-th obstacle area, λ j ∈[0,1],Area j(position(i)) is the overlapping area between the labeled area of the i-th target object and the j-th obstacle area, λ j Are a j(position(i)) is the weighted overlapping area between the labeled area of the i-th target object and the j-th obstacle area, n is the number of multiple target objects, and m is the number of multiple obstacle areas. The maximum value of the sum of the weighted overlapping areas between the labeled areas of multiple target objects and multiple obstacle areas is arec(i) is the area of the labeled area of the i-th target object, that is, the labeled areas of multiple target objects completely overlap with the multiple obstacle areas. The minimum value of the sum of the weighted overlapping areas between the labeled areas of multiple target objects and the multiple obstacle areas is objBlockArea min =0, that is, at this time, the labeled areas of the multiple target objects do not overlap with the multiple obstacle areas at all.
[0040] For example, the demolished walls in the target design drawing are filled with black blocks. If this type of obstacle area is covered by other annotations, the other annotations cannot be distinguished. At this time, the obstacle avoidance weight of this type of obstacle area can be set to 1. Although the text area in the target design drawing is covered by other annotation areas, the content in other annotation areas can also be partially distinguished. The proportion weight of this type of obstacle area can be set to 0.8.
[0041] The overlapping area of the annotated areas of multiple target objects and the display areas of the corresponding target objects is refArea(position(i)) is the overlapping area between the labeled area of the i-th target object and the display area of the i-th target object. Since the objective function finally constructed takes position(i) as the optimal solution when the function value is the minimum, the sum of the overlapping areas of the labeled areas of multiple target objects and the corresponding display areas of the target objects can be inverted to obtain As one of the constraints of the objective function. The maximum value of objRefPolygonArea is objRefPolygonArea max = 0, in this case, there is no overlap between the marked areas of multiple target objects and the display areas of the corresponding target objects. The minimum value of objRefPolygonArea is At this time, the marked areas of the multiple target objects completely overlap with the display areas of the corresponding target objects.
[0042] The relationship between the marked areas of the multiple target objects and the scene range of the target design drawing may include: the marked areas of the multiple target objects are within the scene range of the target design drawing, and the marked areas of the multiple target objects are not within the scene range of the target design drawing. The scene range of the target design drawing can be characterized by the range of the largest rectangular frame area containing the design content in the target design drawing. The relationship between the marked areas of the multiple target objects and the scene range of the target design drawing can be used as one of the constraints for constructing the objective function to limit the marked areas of the multiple target objects to within the scene range of the target design drawing.
[0043] Step 130, constructing an objective function based on the overlapping areas between the annotated areas of multiple target objects and multiple obstacles, the overlapping areas between the annotated areas of multiple target objects and the display areas of corresponding target objects, and the relationship between the annotated areas of multiple target objects and the scene range of the target design drawing.
[0044] In some exemplary embodiments, in order to ensure that the annotated areas of multiple target objects are within the scene range of the target design drawing, the relationship between the annotated areas of the multiple target objects and the scene range of the target design drawing can be characterized by the size of the penalty value. A larger penalty value indicates that the annotated areas of the target objects are outside the scene range of the target design drawing, while a smaller penalty value indicates that the annotated areas of the target objects are within the scene range of the target design drawing. Specifically, based on the overlapping areas between the annotated areas of the multiple target objects and the multiple obstacles, the overlapping areas between the annotated areas of the multiple target objects and the display areas of the corresponding target objects, and the relationship between the annotated areas of the multiple target objects and the scene range of the target design drawing, an objective function is constructed, including:
[0045] Determining penalty values of the marked areas of the multiple target objects based on a relationship between the marked areas of the multiple target objects and the scene range of the target design drawing, wherein the penalty values of the marked areas of the multiple target objects are used to indicate whether the marked areas of the multiple target objects are within the scene range of the target design drawing;
[0046] An objective function is constructed based on overlapping areas between the labeled areas of the target objects and the obstacles, overlapping areas between the labeled areas of the target objects and the display areas of the corresponding target objects, and penalty values of the labeled areas of the target objects.
[0047] As an example, the relationship between the annotated areas of multiple target objects and the scene range of the target design diagram can be expressed by the formula To characterize, wherein penalty(position(i)) is used to characterize whether the annotated area of the i-th target object is within the scene range of the target design drawing. If the annotated area of the i-th target object is outside the scene range of the target design drawing, penalty(position(i)) can be set to a larger constant, such as penalty(position(i)) = 10000, and if the annotated area of the i-th target object is within the scene range of the target design drawing, penalty(position(i)) can be set to a smaller constant, such as penalty(position(i)) = 0. At this time, based on the overlapping areas between the annotated areas of multiple target objects and multiple obstacles, the overlapping areas between the annotated areas of multiple target objects and the display areas of the corresponding target objects, and the penalty values of the annotated areas of multiple target objects, the formula of the constructed target function f is:
[0048]
[0049] Wherein, objBlockArea is the sum of weighted overlapping areas between the annotated areas of multiple target objects and multiple obstacles.
[0050] In some exemplary embodiments, the corresponding positions of the annotated areas of some target objects may have been calculated by the designer when the design drawing was made. There will be a preset annotated area for such annotated area. In order to reduce the offset between such annotated area and the preset annotated area, the offset between the annotated area of the target object and the preset annotated area can be determined, and used as one of the constraints for constructing the objective function. Specifically, based on the overlapping areas between the annotated areas of multiple target objects and multiple obstacles, the overlapping areas between the annotated areas of multiple target objects and the display areas of the corresponding target objects, and the relationship between the annotated areas of multiple target objects and the scene range of the target design drawing, the objective function is constructed, including:
[0051] Determine whether there are preset marked areas for multiple target objects;
[0052] If there are preset marked areas for the multiple target objects, determining the offset between the marked areas of the multiple target objects and the preset marked areas;
[0053] An objective function is constructed based on the overlapping area between the marked areas of multiple target objects and multiple obstacles, the overlapping area between the marked areas of multiple target objects and the display areas of corresponding target objects, the relationship between the marked areas of multiple target objects and the scene range of the target design drawing, and the offset between the marked areas of multiple target objects and the preset marked areas.
[0054] When the marked areas of multiple target objects all have corresponding preset marked areas, the sum of the offsets between the marked areas of the multiple target objects and the preset marked areas can be calculated by the formula: dist(position(i)) is the offset between the labeled area of the i-th target object and its corresponding preset labeled area. The maximum value of the sum of the offsets between the labeled areas of multiple target objects and the preset labeled areas is objDist max = n * scene radius, the scene radius is half the length of the diagonal of the largest rectangular box containing the design content in the target design drawing, that is, the maximum value of the offset of the annotation area of each target object within the scene range of the target design drawing is the scene radius. The minimum value of the sum of the offsets between the annotation areas of multiple target objects and the preset annotation areas is objDist min =0, that is, there is no offset between the marked areas of the multiple target objects and the preset marked areas.
[0055] At this time, based on the overlapping areas between the marked areas of multiple target objects and multiple obstacles, the overlapping areas between the marked areas of multiple target objects and the display areas of corresponding target objects, the relationship between the marked areas of multiple target objects and the scene range of the target design drawing, and the offset between the marked areas of multiple target objects and the preset marked areas, the formula of the constructed target function f is:
[0056]
[0057] Wherein, objBlockArea is the sum of weighted overlapping areas between the annotated areas of multiple target objects and multiple obstacles.
[0058] In some exemplary embodiments, weights may be added to the constraints of the objective function according to the importance of each constraint, and the objective function may be constructed based on the overlapping areas between the annotated areas of the multiple target objects and the multiple obstacles, the overlapping areas between the annotated areas of the multiple target objects and the display areas of the corresponding target objects, the relationship between the annotated areas of the multiple target objects and the scene range of the target design drawing, and the offset between the annotated areas of the multiple target objects and the preset annotated areas, including:
[0059] Determine a first weight corresponding to an overlapping area between the annotated areas of the plurality of target objects and the plurality of obstacles, a second weight corresponding to an overlapping area between the annotated areas of the plurality of target objects and the display areas of the corresponding target objects, and a third weight corresponding to an offset between the annotated areas of the plurality of target objects and a preset annotated area;
[0060] An objective function is constructed based on the overlapping area between the marked areas of multiple target objects and multiple obstacles, the overlapping area between the marked areas of multiple target objects and the display areas of corresponding target objects, the relationship between the marked areas of multiple target objects and the scene range of the target design drawing, the offset between the marked areas of multiple target objects and the preset marked areas, as well as the first weight, the second weight and the third weight.
[0061] At this time, based on the overlapping areas between the annotated areas of the multiple target objects and the multiple obstacles, the overlapping areas between the annotated areas of the multiple target objects and the display areas of the corresponding target objects, the relationship between the annotated areas of the multiple target objects and the scene range of the target design drawing, the offset between the annotated areas of the multiple target objects and the preset annotated areas, and the first weight, the second weight and the third weight, the formula of the constructed objective function f is:
[0062]
[0063] Among them, w1 is the first weight, w2 is the second weight, and w3 is the third weight. w1, w2, and w3 can be adjusted according to actual results and the priority of each constraint condition.
[0064] Step 140 , when the value of the objective function reaches a specified limit value, determining position coordinates of the marked areas of the plurality of target objects, and typeset the marked areas of the plurality of target objects based on the position coordinates of the marked areas of the plurality of target objects.
[0065] In some exemplary embodiments, multiple groups of position coordinates of the annotated areas of multiple target objects may be randomly generated according to the rules of a preset optimization algorithm, and the result of the objective function f may be solved according to each group of position coordinates, and the result of the objective function f may be gradually converged to a specified limit value through iterative comparison, and when the result of the objective function f converges to the specified limit value, the position coordinates of the annotated areas of the corresponding multiple target objects may be determined. Specifically, when the value of the objective function reaches the specified limit value, the position coordinates of the annotated areas of the multiple target objects may be determined, including:
[0066] According to a preset optimization algorithm, a plurality of sets of position coordinates of the marked areas of the plurality of target objects are generated, wherein a set of position coordinates includes the position coordinates of the marked areas of the plurality of target objects;
[0067] Determining multiple values of the objective function based on multiple sets of position coordinates;
[0068] When it is determined based on the multiple values of the objective function that the value of the objective function reaches a specified limit value, position coordinates of the marked areas of the multiple target objects are determined.
[0069] Among them, according to the preset optimization algorithm, multiple groups of position coordinates of the marked areas of multiple target objects are generated. Specifically, according to the preset data generation rules of the optimization algorithm, multiple groups of position coordinates of the marked areas of multiple target objects can be generated, that is, the spacing between two adjacent groups of position coordinates generated must comply with the preset data generation rules of the optimization algorithm. As an example, when the value of the objective function is determined to converge to the minimum value based on multiple values of the objective function, that is, the limit value is specified as the minimum value at this time, the position coordinates of the marked areas of multiple target objects in the target design drawing are determined. Among them, the position coordinates of the marked areas of multiple target objects can be represented by the coordinates of the vertices of the rectangular boxes of the marked areas of the multiple target objects or the coordinates of the center points of the rectangular boxes.
[0070] In some exemplary embodiments, the preset optimization algorithm includes at least one of the following:
[0071] Simulated annealing algorithm;
[0072] Genetic Algorithms;
[0073] Ant colony algorithm.
[0074] Among them, the simulated annealing algorithm (SA) is a random optimization algorithm based on the Monte-Carlo iterative solution strategy. Its starting point is based on the similarity between the annealing process of solid materials in physics and the general combinatorial optimization problem. Starting from a relatively high initial temperature, the simulated annealing algorithm combines the probability jump characteristics to randomly search for the global optimal solution of the objective function in the solution space with the continuous decrease of the temperature parameter, that is, the local optimal solution can probabilistically jump out and eventually tend to the global optimal. The first step is to generate a new solution in the solution space from the current solution by a generating function; in order to facilitate subsequent calculations and acceptance and reduce algorithm time consumption, a method is usually selected in which the current new solution can be generated by a simple transformation, such as replacing or exchanging all or part of the elements constituting the new solution. Note that the transformation method for generating the new solution determines the neighborhood structure of the current new solution, and thus has a certain influence on the selection of the cooling schedule. The second step is to calculate the objective function difference corresponding to the new solution. Because the objective function difference is only generated by the transformation part, the calculation of the objective function difference is best calculated by increment. It turns out that for most applications, this is the fastest way to calculate the objective function difference. The third step is to determine whether the new solution is accepted. The basis for the judgment is an acceptance criterion. The most commonly used acceptance criterion is the Metropolis criterion: if ΔT<0, accept S′ as the new current solution S, otherwise accept S′ as the new current solution S with probability exp(-ΔT / T). The fourth step is to replace the current solution with the new solution when the new solution is determined to be accepted. This only requires the transformation part of the current solution corresponding to the generation of the new solution to be implemented, and the objective function value to be corrected at the same time. At this point, the current solution has achieved one iteration. The next round of experiments can be started on this basis. When the new solution is determined to be discarded, the next round of experiments will continue based on the original current solution.
[0075] Genetic algorithm is a computational model of biological evolution that simulates the natural selection and genetic mechanism of Darwin's theory of biological evolution. It is a method of searching for the optimal solution by simulating the natural evolution process. The algorithm uses mathematical methods and computer simulation operations to convert the problem-solving process into a process similar to the crossover and mutation of chromosome genes in biological evolution. When solving more complex combinatorial optimization problems, it can usually obtain better optimization results faster than some conventional optimization algorithms. The basic operation process of genetic algorithm is as follows: (1) Initialization: Set the evolution generation counter t = 0, set the maximum evolution generation T, and randomly generate M individuals as the initial population P(0). (2) Individual evaluation: Calculate the fitness of each individual in the population P(t). (3) Selection operation: Apply the selection operator to the population. The purpose of selection is to directly inherit the optimized individuals to the next generation or to generate new individuals through pairing and crossover and then inherit them to the next generation. The selection operation is based on the fitness evaluation of individuals in the population. (4) Crossover operation: Apply the crossover operator to the population. The core role of genetic algorithm is the crossover operator. (5) Mutation operation: Apply the mutation operator to the population. That is, change the gene values at certain loci of the individual strings in the population. After the population P(t) undergoes selection, crossover, and mutation operations, the next generation population P(t+1) is obtained. (6) Termination condition judgment: If t=T, the individual with the maximum fitness obtained during the evolution process is output as the optimal solution and the calculation is terminated.
[0076] The ant colony algorithm is a probabilistic algorithm used to find optimization paths. It was proposed by Marco Dorigo in his doctoral thesis in 1992, and its inspiration comes from the behavior of ants in finding paths while searching for food. The basic idea of applying the ant colony algorithm to solve optimization problems is to use the walking paths of ants to represent feasible solutions to the problem to be optimized, and all paths of the entire ant colony constitute the solution space of the problem to be optimized. Ants with shorter paths release more pheromones. As time goes by, the accumulated pheromone concentration on the shorter path gradually increases, and the number of ants choosing this path also increases. Eventually, all the ants will converge on the best path under the action of positive feedback, which corresponds to the optimal solution to the problem to be optimized. The ant colony algorithm (1) adopts a positive feedback mechanism to make the search process converge continuously and eventually approach the optimal solution. (2) Each individual can change the surrounding environment by releasing pheromones, and each individual can perceive the real-time changes in the surrounding environment, and individuals communicate indirectly through the environment. (3) The search process adopts a distributed computing method, and multiple individuals perform parallel computing at the same time, which greatly improves the computing power and operation efficiency of the algorithm. (4) The heuristic probabilistic search method is not prone to falling into local optimality and is easy to find the global optimal solution.
[0077] Figure 3The annotation typesetting method provided for the exemplary embodiment of the present application is applied to a flow chart in an actual scenario. Figure 3 The illustrated annotation layout method may include:
[0078] S31, filtering the marked areas satisfying the preset marking conditions from the target design drawing to obtain the position coordinates of the display areas of the multiple target objects to be typeset.
[0079] Among them, the preset annotation conditions are used to indicate the annotation areas with fixed position coordinates in the target design drawing. This type of annotation area is a annotation area that is not necessary to participate in typesetting.
[0080] S32, establishing an association relationship between the marked areas of the plurality of target objects to be typeset and the corresponding display areas of the target objects.
[0081] For example, the identification of the display area of the corresponding target object may be added to the marked area of each target object, or the polygonal attributes of the display area of the corresponding target object may be directly added to the marked area of each target object.
[0082] S33, the position coordinates of the display areas of the multiple target objects in the target design drawing, the position coordinates of the multiple obstacle areas, and the position coordinates of the marked areas of the multiple target objects are uniformly expressed using standard geometric data.
[0083] S34, determining whether there is a preset marking area in the marking area of the target object.
[0084] If the marked area of the target object has a preset marked area, then execute S35 ; otherwise, execute S36 .
[0085] S35, determining an offset between the marked area of the target object and a preset marked area.
[0086] S36, determining the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the display areas of the corresponding target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing.
[0087] S37, constructing an objective function based on the overlapping area between the marked areas of multiple target objects and multiple obstacles, the overlapping area between the marked areas of multiple target objects and the display areas of corresponding target objects, the relationship between the marked areas of multiple target objects and the scene range of the target design drawing, and the offset between the marked areas of multiple target objects and the preset marked areas.
[0088] Specifically, the objective function can be constructed based on the overlapping area between the marked areas of multiple target objects and multiple obstacles, the overlapping area between the marked areas of multiple target objects and the display areas of corresponding target objects, the relationship between the marked areas of multiple target objects and the scene range of the target design drawing, the offset between the marked areas of multiple target objects and the preset marked areas, as well as the first weight corresponding to the overlapping area between the marked areas of multiple target objects and multiple obstacles, the second weight corresponding to the overlapping area between the marked areas of multiple target objects and the display areas of corresponding target objects, and the third weight corresponding to the offset between the marked areas of multiple target objects and the preset marked areas.
[0089] S38, iteratively calculating the value of the objective function according to the rules of the simulated annealing algorithm.
[0090] S39, when the value of the objective function converges to a minimum value, determining the position coordinates of the marked areas of the plurality of target objects.
[0091] By adopting the annotation layout method provided in the embodiment of the present application, when layout the annotations in the target design drawing, it is possible to determine the position coordinates of the display areas of multiple target objects to be layouted in the target design drawing and the position coordinates of multiple obstacle areas, and determine the position coordinates of the annotation areas of multiple target objects as independent variable parameters. Based on the position coordinates of the display areas of the multiple target objects and the position coordinates of the multiple obstacle areas, as well as the position coordinates of the marked areas of the multiple target objects represented by the independent variable parameters, the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the display areas of the corresponding target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing are determined, and this is used as the constraint condition for constructing the objective function, that is, when constructing the objective function, the overlap between the marked areas of the multiple target objects to be typeset and the obstacles, the overlap between the marked areas of the multiple target objects and the display areas of the target objects, and whether the marked areas of the multiple target objects are within the scene range of the target design drawing are taken into account at the same time. In this way, when the position coordinates of the marked areas of the multiple target objects determined according to the value of the objective function reaching the specified limit value and the marked areas of the multiple target objects are typeset based on the position coordinates of the marked areas of the multiple target objects, the overlapping problem of the marked areas and the obstacle areas can be effectively avoided, and the marked areas can be kept in the display area of the corresponding target object in the scene range of the target design drawing, so that the position of the determined marked areas is more reasonable.
[0092] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 110 to 140 can be device A; for another example, the execution subject of steps 110 to 130 can be device A, and the execution subject of step 140 can be device B; and so on.
[0093] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the sequence numbers of the operations, such as 110, 120, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.
[0094] Figure 4 FIG. 4 is a schematic diagram of a structure of a marking typesetting device 400 provided in an exemplary embodiment of the present application. Figure 4 As shown, the device 400 includes: a first determination module 401, a second determination module 402, a function construction module 403 and a marking typesetting module 404, wherein:
[0095] The first determination module 401 is used to determine the position coordinates of the display areas of the multiple target objects to be typeset in the target design drawing and the position coordinates of the multiple obstacle areas, and to determine the position coordinates of the marked areas of the multiple target objects as independent variable parameters;
[0096] A second determination module 402 is used to determine the overlapping areas between the annotated areas of the plurality of target objects and the plurality of obstacles, the overlapping areas between the annotated areas of the plurality of target objects and the corresponding display areas of the target objects, and the relationship between the annotated areas of the plurality of target objects and the scene range of the target design drawing based on the position coordinates of the display areas of the plurality of target objects and the position coordinates of the obstacle areas, and the position coordinates of the annotated areas of the plurality of target objects represented by the independent variable parameters;
[0097] A function construction module 403 is used to construct a target function based on the overlapping areas between the marked areas of the target objects and the obstacles, the overlapping areas between the marked areas of the target objects and the corresponding display areas of the target objects, and the relationship between the marked areas of the target objects and the scene range of the target design drawing;
[0098] The annotation layout module 404 is used to determine the position coordinates of the annotation areas of the target objects when the value of the objective function reaches a specified limit value, and layout the annotation areas of the target objects based on the position coordinates of the annotation areas of the target objects.
[0099] Optionally, when the second determining module 402 determines the overlapping areas between the annotated areas of the plurality of target objects and the plurality of obstacles, it is specifically configured to:
[0100] Determining obstacle avoidance weights for a plurality of the obstacle areas;
[0101] Based on the position coordinates of the display areas of the multiple target objects, the position coordinates of the multiple obstacle areas, the obstacle avoidance weights of the multiple obstacle areas, and the position coordinates of the labeled areas of the multiple target objects represented by independent variable parameters, the sum of the weighted overlapping areas between the labeled areas of the multiple target objects and the multiple obstacles is determined.
[0102] Optionally, the function construction module 403 constructs the objective function based on the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the corresponding display areas of the target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing, specifically for:
[0103] Determining penalty values of the marked areas of the target objects based on the relationship between the marked areas of the target objects and the scene range of the target design drawing, wherein the penalty values of the marked areas of the target objects are used to indicate whether the marked areas of the target objects are within the scene range of the target design drawing;
[0104] The objective function is constructed based on the overlapping areas between the labeled areas of the target objects and the obstacles, the overlapping areas between the labeled areas of the target objects and the corresponding display areas of the target objects, and the penalty values of the labeled areas of the target objects.
[0105] Optionally, the function construction module 403 constructs the objective function based on the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the corresponding display areas of the target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing, specifically for:
[0106] Determine whether there is a preset marked area for the plurality of target objects;
[0107] If the preset marked area exists for a plurality of the target objects, determining an offset between the marked areas of the plurality of target objects and the preset marked area;
[0108] The objective function is constructed based on the overlapping area between the marked areas of the multiple target objects and the multiple obstacles, the overlapping area between the marked areas of the multiple target objects and the display areas of the corresponding target objects, the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing, and the offset between the marked areas of the multiple target objects and the preset marked areas.
[0109] Optionally, the function construction module 403 constructs the objective function based on the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the display areas of the corresponding target objects, the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing, and the offset between the marked areas of the multiple target objects and the preset marked areas, and is specifically used to:
[0110] Determine a first weight corresponding to an overlapping area between the annotated areas of the plurality of target objects and the plurality of obstacles, a second weight corresponding to an overlapping area between the annotated areas of the plurality of target objects and a display area of the corresponding target object, and a third weight corresponding to an offset between the annotated areas of the plurality of target objects and the preset annotated area;
[0111] The objective function is constructed based on the overlapping area between the marked areas of the multiple target objects and the multiple obstacles, the overlapping area between the marked areas of the multiple target objects and the display areas of the corresponding target objects, the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing, the offset between the marked areas of the multiple target objects and the preset marked area, and the first weight, the second weight and the third weight.
[0112] Optionally, when the value of the objective function reaches a specified limit value, the annotation layout module 404 determines the position coordinates of the annotation areas of the plurality of target objects, specifically for:
[0113] According to a preset optimization algorithm, a plurality of groups of position coordinates of the marked areas of the target objects are generated, wherein a group of position coordinates includes the position coordinates of the marked areas of the target objects;
[0114] Based on the multiple sets of position coordinates, determining multiple values of the objective function;
[0115] When it is determined based on the multiple values of the objective function that the value of the objective function reaches the specified limit value, the position coordinates of the marked areas of the multiple target objects in the target design drawing are determined.
[0116] Optionally, the preset optimization algorithm includes at least one of the following:
[0117] Simulated annealing algorithm;
[0118] Genetic Algorithms;
[0119] Ant colony algorithm.
[0120] Optionally, when the first determination module 401 determines the position coordinates of multiple obstacle areas in the target design diagram, it is specifically used to:
[0121] Determine from the target design drawing an area filled with a color block of a specified color and an annotated area that satisfies a preset annotation condition, wherein the preset annotation condition is used to indicate an annotated area with a fixed position coordinate in the target design drawing;
[0122] Based on the area filled with the designated color block and the marked area that meets the preset marking condition, the position coordinates of the plurality of obstacle areas are determined.
[0123] The annotation typesetting device 400 can realize Figure 1 to Figure 3 For details, please refer to Figure 1 to Figure 3 The annotation typesetting method of the illustrated embodiment will not be described in detail.
[0124] Figure 5 The following is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present application. Figure 5 As shown, the device includes: a memory 51 and a processor 52.
[0125] The memory 51 is used to store computer programs and can be configured to store various other data to support operations on the computing device. Examples of such data include instructions for any application or method operating on the computing device, contact data, phone book data, messages, pictures, videos, etc.
[0126] The processor 52 is coupled to the memory 51 and is used to execute the computer program in the memory 51, so as to: determine the position coordinates of the display areas of the multiple target objects to be typeset in the target design drawing and the position coordinates of the multiple obstacle areas, and determine the position coordinates of the marked areas of the multiple target objects as independent variable parameters; determine the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the corresponding display areas of the target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing based on the position coordinates of the display areas of the multiple target objects and the position coordinates of the multiple obstacle areas, and the position coordinates of the marked areas of the multiple target objects represented by the independent variable parameters; construct an objective function based on the overlapping areas between the marked areas of the multiple target objects and the multiple obstacles, the overlapping areas between the marked areas of the multiple target objects and the corresponding display areas of the target objects, and the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing; when the value of the objective function reaches a specified limit value, determine the position coordinates of the marked areas of the multiple target objects, and typeset the marked areas of the multiple target objects based on the position coordinates of the marked areas of the multiple target objects.
[0127] Further, if Figure 5 As shown, the electronic device also includes: a communication component 53, a display 54, a power component 55, an audio component 56 and other components. Figure 5 Only some components are shown schematically, which does not mean that the electronic device only includes Figure 5 In addition, depending on the implementation form of the traffic playback device, Figure 5 The components in the dashed box are optional components, not mandatory components. For example, when the electronic device is implemented as a terminal device such as a smartphone, tablet computer or desktop computer, it may include Figure 5 Components in the dashed box; when the electronic device is implemented as a conventional server, cloud server, data center or server array and other server-side devices, it may not include Figure 5 Components within the dashed box.
[0128] Accordingly, an embodiment of the present application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor is enabled to implement the steps in the above-mentioned annotation typesetting method embodiment.
[0129] Above Figure 5The communication component in is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component may also include a near field communication (NFC) module, a radio frequency identification (RFID) technology, an infrared data association (IrDA) technology, an ultra-wideband (UWB) technology, a Bluetooth (BT) technology, etc.
[0130] Above Figure 5 The memory in can be implemented by any type of volatile or non-volatile storage device or a combination of them, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0131] Above Figure 5 The display in the embodiment includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0132] Above Figure 5 The power supply component in the device provides power to various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply component is located.
[0133] Above Figure 5 The audio component in can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal.
[0134] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0135] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0136] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0137] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0139] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0140] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0141] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0142] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0143] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A marking typesetting method, characterized in that: include: Determining the position coordinates of the display areas of the plurality of target objects to be typeset in the target design drawing and the position coordinates of the plurality of obstacle areas, and determining the position coordinates of the marked areas of the plurality of target objects as independent variable parameters; Based on the position coordinates of the display areas of the plurality of target objects and the position coordinates of the plurality of obstacle areas, and the position coordinates of the annotated areas of the plurality of target objects represented by independent variable parameters, determine the overlapping areas between the annotated areas of the plurality of target objects and the plurality of obstacles, the overlapping areas between the annotated areas of the plurality of target objects and the display areas of the corresponding target objects, and the relationship between the annotated areas of the plurality of target objects and the scene range of the target design drawing; Constructing an objective function based on the overlapping areas between the annotated areas of the target objects and the obstacles, the overlapping areas between the annotated areas of the target objects and the corresponding display areas of the target objects, and the relationship between the annotated areas of the target objects and the scene range of the target design drawing; When the value of the objective function reaches a specified limit value, position coordinates of the marked areas of the plurality of target objects are determined, and the marked areas of the plurality of target objects are laid out based on the position coordinates of the marked areas of the plurality of target objects.
2. The method according to claim 1, characterized in that The determining of the overlapping areas between the marked areas of the plurality of target objects and the plurality of obstacles comprises: Determining obstacle avoidance weights for a plurality of the obstacle areas; Based on the position coordinates of the display areas of the multiple target objects, the position coordinates of the multiple obstacle areas, the obstacle avoidance weights of the multiple obstacle areas, and the position coordinates of the labeled areas of the multiple target objects represented by independent variable parameters, the sum of the weighted overlapping areas between the labeled areas of the multiple target objects and the multiple obstacles is determined.
3. The method according to claim 1 or 2, characterized in that The objective function is constructed based on the overlapping areas between the marked areas of the plurality of target objects and the plurality of obstacles, the overlapping areas between the marked areas of the plurality of target objects and the corresponding display areas of the target objects, and the relationship between the marked areas of the plurality of target objects and the scene range of the target design drawing, including: Determining penalty values of the marked areas of the target objects based on the relationship between the marked areas of the target objects and the scene range of the target design drawing, wherein the penalty values of the marked areas of the target objects are used to indicate whether the marked areas of the target objects are within the scene range of the target design drawing; The objective function is constructed based on the overlapping areas between the labeled areas of the target objects and the obstacles, the overlapping areas between the labeled areas of the target objects and the corresponding display areas of the target objects, and the penalty values of the labeled areas of the target objects.
4. The method according to claim 3, characterized in that The objective function is constructed based on the overlapping areas between the marked areas of the plurality of target objects and the plurality of obstacles, the overlapping areas between the marked areas of the plurality of target objects and the corresponding display areas of the target objects, and the relationship between the marked areas of the plurality of target objects and the scene range of the target design drawing, including: Determine whether there is a preset marked area for the plurality of target objects; If the preset marked area exists for a plurality of the target objects, determining an offset between the marked areas of the plurality of target objects and the preset marked area; The objective function is constructed based on the overlapping area between the marked areas of the multiple target objects and the multiple obstacles, the overlapping area between the marked areas of the multiple target objects and the display areas of the corresponding target objects, the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing, and the offset between the marked areas of the multiple target objects and the preset marked areas.
5. The method according to claim 4, characterized in that The objective function is constructed based on the overlapping areas between the marked areas of the plurality of target objects and the plurality of obstacles, the overlapping areas between the marked areas of the plurality of target objects and the display areas of the corresponding target objects, the relationship between the marked areas of the plurality of target objects and the scene range of the target design drawing, and the offset between the marked areas of the plurality of target objects and the preset marked areas, including: Determine a first weight corresponding to an overlapping area between the annotated areas of the plurality of target objects and the plurality of obstacles, a second weight corresponding to an overlapping area between the annotated areas of the plurality of target objects and a display area of the corresponding target object, and a third weight corresponding to an offset between the annotated areas of the plurality of target objects and the preset annotated area; The objective function is constructed based on the overlapping area between the marked areas of the multiple target objects and the multiple obstacles, the overlapping area between the marked areas of the multiple target objects and the display areas of the corresponding target objects, the relationship between the marked areas of the multiple target objects and the scene range of the target design drawing, the offset between the marked areas of the multiple target objects and the preset marked area, and the first weight, the second weight and the third weight.
6. The method according to claim 1, characterized in that When the value of the objective function reaches a specified limit value, determining the position coordinates of the marked areas of the plurality of target objects comprises: According to a preset optimization algorithm, a plurality of groups of position coordinates of the marked areas of the target objects are generated, wherein a group of position coordinates includes the position coordinates of the marked areas of the target objects; Determining a plurality of values of the objective function based on the plurality of sets of position coordinates; When it is determined based on the multiple values of the objective function that the value of the objective function reaches the specified limit value, the position coordinates of the marked areas of the multiple target objects in the target design drawing are determined.
7. The method according to claim 6, characterized in that The preset optimization algorithm includes at least one of the following: Simulated annealing algorithm; Genetic Algorithms; Ant colony algorithm.
8. The method according to claim 1, characterized in that Determining the position coordinates of multiple obstacle areas in the target design diagram includes: Determine from the target design drawing an area filled with a color block of a specified color and an annotated area that satisfies a preset annotation condition, wherein the preset annotation condition is used to indicate an annotated area with a fixed position coordinate in the target design drawing; Based on the area filled with the designated color block and the marked area that meets the preset marking condition, the position coordinates of the plurality of obstacle areas are determined.
9. A labeling processing device, characterized in that: include: A first determination module is used to determine the position coordinates of the display areas of multiple target objects to be typeset in the target design drawing and the position coordinates of multiple obstacle areas, and to determine the position coordinates of the marked areas of the multiple target objects as independent variable parameters; A second determination module is used to determine the overlapping areas between the annotated areas of the plurality of target objects and the plurality of obstacles, the overlapping areas between the annotated areas of the plurality of target objects and the corresponding display areas of the target objects, and the relationship between the annotated areas of the plurality of target objects and the scene range of the target design drawing based on the position coordinates of the display areas of the plurality of target objects and the position coordinates of the obstacle areas, and the position coordinates of the annotated areas of the plurality of target objects represented by the independent variable parameters; A function construction module, for constructing a target function based on the overlapping areas between the marked areas of the target objects and the obstacles, the overlapping areas between the marked areas of the target objects and the corresponding display areas of the target objects, and the relationship between the marked areas of the target objects and the scene range of the target design drawing; The annotation layout module is used to determine the position coordinates of the annotation areas of the target objects when the value of the objective function reaches a specified limit value, and to layout the annotation areas of the target objects based on the position coordinates of the annotation areas of the target objects.
10. An electronic device, characterized in that: include: Memory and processor; The memory is used to store computer programs; The processor, coupled to the memory, is configured to execute the computer program to: Determining the position coordinates of the display areas of the plurality of target objects to be typeset in the target design drawing and the position coordinates of the plurality of obstacle areas, and determining the position coordinates of the marked areas of the plurality of target objects as independent variable parameters; Based on the position coordinates of the display areas of the plurality of target objects and the position coordinates of the plurality of obstacle areas, and the position coordinates of the annotated areas of the plurality of target objects represented by independent variable parameters, determine the overlapping areas between the annotated areas of the plurality of target objects and the plurality of obstacles, the overlapping areas between the annotated areas of the plurality of target objects and the display areas of the corresponding target objects, and the relationship between the annotated areas of the plurality of target objects and the scene range of the target design drawing; Constructing an objective function based on the overlapping areas between the annotated areas of the target objects and the obstacles, the overlapping areas between the annotated areas of the target objects and the corresponding display areas of the target objects, and the relationship between the annotated areas of the target objects and the scene range of the target design drawing; When the value of the objective function reaches a specified limit value, position coordinates of the marked areas of the plurality of target objects are determined, and the marked areas of the plurality of target objects are laid out based on the position coordinates of the marked areas of the plurality of target objects.
11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor is caused to implement the steps of the annotation typesetting method according to any one of claims 1 to 8.