A marking method and device
By dividing the view into partitions based on optional annotation directions in the home decoration design software, the annotation direction characteristics of the graphics to be annotated are determined, which solves the problem of unclear and untidy automatic annotation results, improves the neatness and accuracy of the annotation results, and improves efficiency.
Patent Information
- Application Number
- CN202410789987.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-19
AI Technical Summary
In complex drawings, the results based on automatic annotation are often unclear and untidy, making it difficult to meet the user's design requirements. How to improve the neatness and accuracy of the annotation results.
By dividing the view range into view partitions based on the optional annotation direction, the annotation direction characteristics of the graphics to be annotated are determined, and the annotation results are generated to ensure that the annotation results match the partition position of the graphics in the view.
It improves the neatness and accuracy of the annotation results, avoids unclear and untidy results caused by automatic arrangement of annotations, improves efficiency, and reduces the need for manual annotation by users.
Smart Images

Figure CN118365754B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a marking method and device. Background Art
[0002] In home decoration design software, automatic annotation can quickly generate annotation results. However, in complex drawings, automatic layout annotation often results in unclear and untidy annotation results, which is difficult to meet the user's design requirements. Therefore, how to improve the neatness and accuracy of annotation results has become a problem that needs to be solved. Summary of the invention
[0003] The present disclosure provides a marking method and device.
[0004] In a first aspect, the present disclosure provides a marking method, comprising:
[0005] Based on one or more optional annotation directions, the view range is divided into one or more view partitions, wherein the view range is used to display one or more graphics to be annotated, and different view partitions in the one or more view partitions correspond to different optional annotation directions;
[0006] Determining a labeling direction feature of each of the one or more graphics to be labeled based on each of the one or more graphics to be labeled and the one or more view partitions;
[0007] Based on the annotation direction feature of each to-be-annotated figure, generating an annotation result corresponding to each to-be-annotated figure;
[0008] The step of determining the annotation direction feature of each of the one or more graphics to be annotated and the one or more view partitions includes:
[0009] Obtaining the area of each overlapping portion of the i-th figure to be annotated and one or more overlapping portions of the one or more view partitions, wherein i is an integer greater than or equal to 1, and the i-th figure to be annotated is one of the one or more figures to be annotated;
[0010] Calculating an area weighted value corresponding to each overlapping portion based on the area of each overlapping portion and a weight value of a view partition where each overlapping portion is located;
[0011] A target overlapping portion with a maximum area weighted value is determined from the one or more overlapping portions, and an optional annotation direction corresponding to the view partition where the target overlapping portion is located is used as an annotation direction feature of the i-th graphic to be annotated.
[0012] In a second aspect, the present disclosure provides a labeling device, including:
[0013] A view partition determination module, configured to divide a view range into one or more view partitions based on one or more optional annotation directions, wherein the view range is used to display one or more graphics to be annotated, and different view partitions in the one or more view partitions correspond to different optional annotation directions;
[0014] A labeling direction feature determination module, configured to determine a labeling direction feature of each of the one or more graphics to be labeled based on each of the one or more graphics to be labeled and the one or more view partitions;
[0015] A labeling module, used for generating a labeling result corresponding to each of the graphics to be labeled based on the labeling direction characteristics of each of the graphics to be labeled;
[0016] Among them, the annotation direction feature determination module is specifically used to obtain the area of each overlapping part of the i-th figure to be annotated and one or more overlapping parts of the one or more view partitions, wherein i is an integer greater than or equal to 1, and the i-th figure to be annotated is one of the one or more figures to be annotated; based on the area of each overlapping part and the weight value of the view partition where each overlapping part is located, calculate the area weighted value corresponding to each overlapping part; determine the target overlapping part with the maximum area weighted value from the one or more overlapping parts, and use the optional annotation direction corresponding to the view partition where the target overlapping part is located as the annotation direction feature of the i-th figure to be annotated.
[0017] In a third aspect, an electronic device is provided, including:
[0018] at least one processor; and
[0019] a memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any embodiment of the present disclosure.
[0021] In a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute a method according to any embodiment of the present disclosure.
[0022] By using this method, the view range can be partitioned based on the optional annotation direction, and then the annotation direction characteristics of the graphics to be annotated can be determined based on the view partitions, and finally the annotation results of the graphics to be annotated can be directly generated based on the annotation direction characteristics of the graphics to be annotated. In this way, since the annotation results are generated by combining the view partitions obtained by the optional annotation direction, it can be ensured that the annotation results finally generated are more matched with the partition positions of the graphics to be annotated in the view, which improves the neatness and accuracy of the annotation results and avoids the problems of unclear and untidy results caused by automatic arrangement of annotations in related technologies.
[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0025] Figure 1 is a flow chart of a marking method according to an embodiment of the present disclosure;
[0026] Figure 2 A schematic flowchart of a process of obtaining constraints and / or rules required for generating annotation results according to an analysis of an embodiment of the present disclosure;
[0027] Figure 3 is a schematic diagram of a scenario for dividing a view into partitions according to an embodiment of the present disclosure;
[0028] Figure 4 is an exemplary flow chart of a marking method according to an embodiment of the present disclosure;
[0029] Figure 5 is an exemplary flow chart of a method for processing horizontal annotation according to an embodiment of the present disclosure;
[0030] Figure 6 is a schematic diagram of a scene with horizontal and vertical annotations according to an embodiment of the present disclosure;
[0031] Figure 7 is an exemplary flow chart of a vertical marking method according to an embodiment of the present disclosure;
[0032] Figure 8 is a diagram showing an example of a structure of a marking device according to an embodiment of the present disclosure;
[0033] Fig. 9 It is a block diagram of an electronic device used to implement the marking method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] The present disclosure will be further described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0035] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present disclosure.
[0036] Figure 1 A schematic flow chart of a marking method provided in an embodiment of the present disclosure includes:
[0037] S101, dividing a view range into one or more view partitions based on one or more optional annotation directions, wherein the view range is used to display one or more graphics to be annotated, and different view partitions in the one or more view partitions correspond to different optional annotation directions;
[0038] S102, determining a labeling direction feature of each of the one or more graphics to be labeled based on each of the one or more graphics to be labeled and the one or more view partitions;
[0039] S103, generating a labeling result corresponding to each of the graphics to be labeled based on the labeling direction feature of each of the graphics to be labeled;
[0040] The step of determining the annotation direction feature of each of the one or more graphics to be annotated and the one or more view partitions includes:
[0041] Obtaining the area of each overlapping portion of the i-th figure to be annotated and one or more overlapping portions of the one or more view partitions, wherein i is an integer greater than or equal to 1, and the i-th figure to be annotated is one of the one or more figures to be annotated;
[0042] Calculating an area weighted value corresponding to each overlapping portion based on the area of each overlapping portion and a weight value of a view partition where each overlapping portion is located;
[0043] A target overlapping portion with a maximum area weighted value is determined from the one or more overlapping portions, and an optional annotation direction corresponding to the view partition where the target overlapping portion is located is used as an annotation direction feature of the i-th graphic to be annotated.
[0044] The marking method provided in this embodiment is particularly applicable to the field of home decoration design. The marking method can be implemented by an electronic device with processing and / or computing and / or image display and / or networking capabilities. Exemplarily, the electronic device can be any one of the following: a laptop, a personal computer, a server in a server cluster with a user operation interface, etc.
[0045] By adopting the solution provided by the present application, the view range can be partitioned based on the optional annotation direction, and then the annotation direction characteristics of the graphics to be annotated can be determined based on the view partitions, and finally the annotation results of the graphics to be annotated can be directly generated based on the annotation direction characteristics of the graphics to be annotated. In this way, since the annotation results are generated by combining the view partitions obtained by the optional annotation direction, it can be ensured that the annotation results finally generated are more matched with the partition positions of the graphics to be annotated in the view, which improves the neatness and accuracy of the annotation results, and avoids the problems of unclear and untidy results caused by the automatic arrangement of annotations in related technologies. In addition, since the annotation results corresponding to the graphics to be annotated are automatically generated, it can also avoid the problems of low efficiency and arbitrary results caused by the user's manual annotation of objects in the view.
[0046] In some possible implementations, the annotation method provided in the embodiment of the present application first parses the relevant constraints, and then performs processing to generate corresponding annotation results for the graphics to be annotated. Specifically, before dividing the view range into one or more view partitions based on one or more optional annotation directions, the following may also be performed: Figure 2 The parsing shown results in the processing of constraints and / or rules that need to be used to generate the annotation results:
[0047] S201, parsing the set corresponding to each target object to obtain each graphic to be annotated;
[0048] S202, parsing the display style data to obtain relevant information of the annotated text;
[0049] S203, analyzing the constraint rules to obtain the lead point constraint rules and the lead line constraint rules;
[0050] S204, determining the area corresponding to the view range where the lead line cannot pass through.
[0051] The above S201 - S204 may be executed in any order, and may be executed in parallel, or may be executed in other orders. This embodiment does not limit or exhaustively list the execution order.
[0052] The set corresponding to each target object may be pre-configured by the user in the operation interface of the relevant application. The set corresponding to any target object may include one or more sub-objects in the target space. The target space may be determined according to user needs, such as a room, or multiple rooms, etc., which is not limited in this embodiment. The types of one or more sub-objects may be the same, for example, one or more sub-objects are tiles of the same size, and accordingly, the set corresponding to the target object contains the one or more tiles of the same size, and the target object may refer to a wall composed of one or more tiles. It should be noted that the type of any target object may include any one of furniture, doors and windows, floors, walls, etc., and this embodiment does not limit or enumerate the types of target objects.
[0053] Parsing the set corresponding to each target object to obtain each to-be-annotated graphic may refer to: parsing one or more sub-objects in the target space contained in the set corresponding to any target object to obtain the target object; when the target object is not an object of a specified type, obtaining the to-be-annotated graphic within the viewing range corresponding to the target object. In addition, it may also include: when any target object is an object of a specified type, obtaining the non-annotated graphic within the viewing range corresponding to the target object. In this way, the same processing is performed on the set corresponding to each target object, and finally all the to-be-annotated graphics within the viewing range (and all the non-annotated graphics within the viewing range may be obtained). Among them, the object of the specified type may refer to an object that is not set to be annotated, and does not allow or expect a lead to pass through or pass through. For example, the object of the specified type may include at least one of a solid wall, furniture, sanitary ware, etc., and the objects of the specified type are not limited or enumerated here.
[0054] The display style data may be configured by the user in advance in the operation interface of the relevant application, and the display style data may include at least one of the following: display attributes of the annotation text, and the annotation text content corresponding to each target object in one or more target objects. The display attributes of the annotation text may include at least one of the size, font, line break, display color, etc. of the annotation text.
[0055] Parsing the display style data to obtain relevant information of the annotation text may include: parsing the display style data to obtain at least one of the following: display attributes of the annotation text, and annotation text content corresponding to each of the one or more graphics to be annotated.
[0056] The guide point constraint rule may include: the user wishes or expects to display or set the position of the guide point in each figure to be annotated. For example, the user wishes or expects to set the position of the guide point in each figure to be annotated to be on the vertical center line of the figure to be annotated and / or the horizontal center line of the figure to be annotated.
[0057] The lead constraint rule may include one or more optional annotation directions that the user expects or allows any figure to be annotated to be able to pull the lead. Preferably, the number of optional annotation directions may be greater than or equal to 1 and less than or equal to 4. Exemplarily, the one or more optional annotation directions may include any one or more of top, bottom, left, and right. For example, if the one or more optional annotation directions pre-set by the user include top, left, and right, it means that the user expects or allows the annotation result of any figure to be annotated to appear on the left, right, or top.
[0058] Furthermore, the lead constraint rule may also include at least one of the following: the user hopes or expects that the lead of each figure to be annotated does not pass through or avoid other annotated texts, the user hopes or expects that the lead of each figure to be annotated does not pass through or avoid other leads, the user hopes or expects that the lead of each figure to be annotated does not pass through the area that cannot pass through the lead corresponding to the view range, the user hopes or expects that the distance between the lead of each figure to be annotated and other leads is greater than the first specified distance, and the user hopes or expects that the distance between the lead of each figure to be annotated and the annotated text is not less than the second specified distance. The first specified distance and the second specified distance can be configured according to actual conditions, and this application does not limit them.
[0059] Determining the area where the lead cannot be passed through that corresponds to the viewing range may include: determining the area where the lead cannot be passed through based on the area where the lead can be pulled, and occluding and clipping the area where the lead cannot be passed through to obtain the area where the lead cannot be passed through that corresponds to the viewing range; or, occluding and clipping the area where the object of the specified type is located to obtain the area where the lead cannot be passed through that corresponds to the viewing range. Among them, the area where the lead can be pulled may include other areas except the area where the object of the specified type is located. The relevant description of the object of the specified type is the same as the aforementioned embodiment and is not repeated. The number of areas where the lead cannot be passed through that correspond to the viewing range may be one or more, and this embodiment does not limit it.
[0060] In general, when generating annotation results for an annotated graphic, constraints need to be obtained in advance, and these constraints may include constraints generated by users based on their own business needs. For example, the user wants the lead point to be marked at the center of the annotated object (i.e., the graphic to be annotated); the annotated text may want to be a certain distance away from the lead line; the lead line may want to be as clear and visible as possible and not pass through other annotated text, etc. Therefore, in order to meet the needs of different users, the solution provided in this application can pre-parse these user needs so that the subsequent annotation results can meet the user needs.
[0061] In some possible embodiments, the view range is divided into one or more view partitions based on one or more optional annotation directions, which may include one of the following: when the optional annotation direction includes one, the view range is divided into one view partition; when the optional annotation directions include two, the view range is divided into two equal parts based on the two optional annotation directions, to obtain two view partitions corresponding to the two optional annotation directions; when the optional annotation directions include three, a first division method is determined based on the three optional annotation directions, and the view range is divided based on the first division method to obtain three view partitions corresponding to the three optional annotation directions; when the optional annotation directions include four, the view range is divided based on the second division method to obtain four view partitions corresponding to the four optional annotation directions.
[0062] Combination Figure 3 , the method of dividing the view range into one or more view partitions based on one or more optional annotation directions provided in this embodiment is exemplarily described as follows:
[0063] The optional annotation direction preconfigured by the user is only one direction, such as Figure 3 In any of the above, below, left and right cases shown, the viewing range may be regarded as a viewing partition 301 .
[0064] The optional annotation directions pre-configured by the user are two directions, such as Figure 3 In the case of the upper and lower directions shown in FIG. 1 , the view range can be equally divided up and down to obtain two view partitions 311 corresponding to the upper and lower optional marked directions; for example, the two directions are Figure 3 In the case of the left and right directions shown in FIG. 1 , the view range can be equally divided into left and right to obtain two view partitions 312 corresponding to the left and right optional marked directions; for example, the two directions are Figure 3 In the case of the upper and right directions, or the left and lower directions shown in FIG. 1 , the view range can be equally divided from the upper left corner to the lower right corner to obtain two view partitions 313 corresponding to the upper right or lower left two optional marked directions; for example, the two directions are Figure 3 In the case of the upper and left directions, or the right and lower directions shown, the view range can be equally divided from the upper right corner to the lower left corner to obtain two view partitions 314 corresponding to the two optional annotation directions of upper left or lower right.
[0065] The first division method is related to the three optional marking directions, still combined with Figure 2 For example:
[0066] For example, the optional annotation directions preconfigured by the user are three directions: Figure 2In the case of top, left, and right as shown, the first division method is: divide the view range into two candidate view partitions in left and right equal parts, divide the left candidate view partition from the upper left corner to the right midpoint to obtain a left view partition and a partition to be merged on the upper right side, divide the right candidate view partition from the upper right corner to the left midpoint to obtain a right view partition and a partition to be merged on the upper left side, merge the partition to be merged on the upper right side and the partition to be merged on the upper left side to obtain an upper (or upper) view partition; based on the first division method, the view range is obtained as follows Figure 3 The three optional annotation directions of top, left and right correspond to three view partitions 321 respectively.
[0067] For example, the optional annotation directions preconfigured by the user are three directions: Figure 3 In the case of the upper, lower, and left shown in the figure, the first division method is: divide the view range into two candidate view partitions by dividing the upper candidate view partition from the upper left corner to the lower midpoint to obtain the upper view partition on the right and the partition to be merged on the lower left, divide the lower candidate view partition from the lower left corner to the upper midpoint to obtain the lower view partition and the partition to be merged on the upper left, merge the partition to be merged on the lower left and the partition to be merged on the upper left to obtain the left view partition; finally, based on the first division method, the view range is obtained as follows Figure 3 The three optional annotation directions of top, bottom and left correspond to three view partitions 322 respectively.
[0068] For example, the optional annotation directions preconfigured by the user are three directions: Figure 2 In the case of the bottom, left, and right shown in the figure, the first division method is: divide the view range into two candidate view partitions in left and right equal parts, divide the left candidate view partition from the lower left corner to the right midpoint to obtain the left view partition and the partition to be merged on the lower right side, divide the right candidate view partition from the lower right corner to the left midpoint to obtain the right view partition and the partition to be merged on the lower left side, merge the partition to be merged on the lower right side and the partition to be merged on the lower left side to obtain the lower view partition; finally, based on the first division method, the view range is obtained as follows Figure 3 The three optional annotation directions of bottom, left and right correspond to three view partitions 323 respectively.
[0069] For example, the optional annotation directions preconfigured by the user are three directions: Figure 2In the case of the upper, lower, and right shown in the figure, the first division method is: divide the view range into two candidate view partitions in equal parts, divide the upper candidate view partition from the upper right corner to the lower midpoint to obtain an upper view partition and a partition to be merged on the lower right side, divide the lower candidate view partition from the lower right corner to the upper midpoint to obtain a lower view partition and a partition to be merged on the upper right side, merge the partition to be merged on the lower right side and the partition to be merged on the upper right side to obtain a right view partition; finally, the view range is divided into the following based on the first division method: Figure 3 The three optional annotation directions of top, bottom and right correspond to three view partitions 324 respectively.
[0070] The second division method can be pre-configured according to actual conditions. For example, the second division method can be: divide the view range equally from left to right to obtain two candidate view partitions; divide the left candidate view partition equally from top to bottom to obtain two upper and lower candidate view partitions on the left; divide the upper left candidate view partition from the upper left corner to the right midpoint to obtain the upper right first view partition to be merged and the lower left first partition to be merged; divide the lower left candidate view partition from the lower left corner to the right midpoint to obtain the upper left first view partition to be merged and the lower right first partition to be merged; merge the upper left first view partition to be merged and the lower left first view partition to be merged to obtain the left view partition; divide the right candidate view partition Divide the upper and lower candidate view partitions into equal parts to obtain the upper and lower right candidate view partitions. Divide the upper right candidate view partition from the upper right corner to the left midpoint to obtain the lower right second view partition to be merged and the upper left second partition to be merged. Divide the lower right candidate view partition from the lower right corner to the left midpoint to obtain the upper right second view partition to be merged and the lower left second partition to be merged. Merge the upper right second view partition to be merged and the lower right second view partition to be merged to obtain the right view partition; merge the upper right first view partition to be merged and the upper left second partition to be merged to obtain the upper view partition; merge the lower right first partition to be merged and the lower left second partition to be merged to obtain the lower view partition. Combine. Figure 3 For example, in the optional annotation direction preconfigured by the user Figure 3 In the case of the four directions of up, down, left and right shown in the figure, the view range can be divided into the following Figure 3 The four optional marking directions of up, down, left and right shown correspond to four view partitions 331 respectively.
[0071] In some possible embodiments, obtaining the area of each overlapping portion of the i-th graphic to be annotated and one or more overlapping portions of the one or more view partitions may be as follows: detecting whether the bounding box of the i-th graphic to be annotated overlaps with the a-th view partition of the one or more view partitions, where a is an integer greater than or equal to 1, and the a-th view partition is any view partition; when the i-th graphic to be annotated overlaps with the a-th view partition, obtaining the area of the a-th overlapping portion of the bounding box of the i-th graphic to be annotated and the a-th view partition. This process is repeated in this way until the area of the overlapping portion of each view partition where the bounding box of the i-th graphic to be annotated overlaps is obtained. Since the processing performed on each view partition is the same, it is not described one by one.
[0072] The bounding box of the i-th figure to be labeled may refer to a closed shape formed by the outer contour of the i-th figure to be labeled.
[0073] Calculating the area weighted value corresponding to each overlapping portion based on the area of each overlapping portion and the weight value of the view partition where each overlapping portion is located may include: multiplying the area of the a-th overlapping portion by the weight value of the a-th view partition where the a-th overlapping portion is located, to obtain the area weighted value corresponding to the a-th overlapping portion. Since the same processing as that of the a-th overlapping portion is performed on each overlapping portion, detailed descriptions thereof will not be given one by one.
[0074] The weight value of each view partition in the aforementioned one or more view partitions may be determined based on the preferred annotation direction. Taking the ath view partition as any view partition as an example, the method for determining the weight value of the ath view partition may specifically be: when the optional annotation direction corresponding to the ath view partition is the preferred annotation direction, the weight value of the ath view partition is determined to be the first weight value; when the optional annotation direction corresponding to the ath view partition is not the preferred annotation direction, the weight value of the ath view partition is determined to be the second weight value. Among them, the first weight value is greater than the second weight value, and the specific values of the first weight value and the second weight value may be pre-configured, and as long as the first weight value is greater than the second weight value, it is within the protection scope of this embodiment.
[0075] The number of preferred annotation directions may be one or more; one or more preferred annotation directions may be predetermined or selected by the user from one or more optional annotation directions, for example, they may be included in the leader constraint rule. For example, based on the user presetting the top, left, and right directions as optional annotation directions, the user may select right as a preferred annotation direction from the top, left, and right directions. It should be understood that this is only an exemplary description, and all possible situations are not limited or exhaustive.
[0076] For example, assuming that the user presets the top, left, and right directions as optional annotation directions, three view partitions corresponding to the top, left, and right optional annotation directions can be obtained (respectively called the left view partition, the right view partition, and the upper view partition); assuming that the right is the preferred annotation direction, the weight value of the right view partition is equal to the first weight value, and the weight values of other view partitions are equal to the second weight value. If the bounding box of the i-th figure to be annotated overlaps with both the right view partition and the left view partition, the area of the left overlap of the bounding box of the i-th figure to be annotated and the right view partition is expressed as polygon area A, and the area of the right overlap of the bounding box of the i-th figure to be annotated and the left view partition is expressed as polygon area B, then the area weighted value corresponding to the left overlap can be expressed as "polygon area A×first weight value", and the area weighted value corresponding to the right overlap can be expressed as "polygon area B×second weight value", where the first weight value can be equal to 2 and the second weight value can be equal to 1.
[0077] In one example, a target overlapping part with a maximum area weighted value is determined from the one or more overlapping parts, and an optional annotation direction corresponding to the view partition where the target overlapping part is located is used as the annotation direction feature of the i-th figure to be annotated. It can be as follows: when there is a maximum area weighted value among the area weighted values corresponding to each overlapping part in the one or more overlapping parts, the overlapping part with the maximum area weighted value is used as the target overlapping part, and based on the optional annotation direction corresponding to the view partition where the target overlapping part is located, the annotation direction feature of the i-th figure to be annotated is determined.
[0078] In one example, a target overlapping part with a maximum area weighted value is determined from the one or more overlapping parts, and an optional annotation direction corresponding to the view partition where the target overlapping part is located is used as the annotation direction feature of the i-th figure to be annotated. It can be as follows: when there are multiple identical maximum area weighted values for the area weighted values corresponding to each overlapping part in the one or more overlapping parts, any one of the multiple overlapping parts corresponding to the multiple identical maximum area weightings is used as the target overlapping part, and based on the optional annotation direction corresponding to the view partition where the target overlapping part is located, the annotation direction feature of the i-th figure to be annotated is determined.
[0079] The determining of the annotation direction feature of the i-th graphic to be annotated based on the optional annotation direction corresponding to the view partition where the target overlaps may include one of the following: when the optional annotation direction corresponding to the view partition where the target overlaps is left or right, determining the annotation direction feature of the i-th graphic to be annotated to be horizontal; when the optional annotation direction corresponding to the view partition where the target overlaps is up or down, determining the annotation direction feature of the i-th graphic to be annotated to be vertical.
[0080] Optionally, when the optional annotation direction corresponding to the view partition where the target overlaps is located is left or right, determining the annotation direction characteristic of the i-th graphic to be annotated is horizontal, which may include one of the following: when the optional annotation direction corresponding to the view partition where the target overlaps is located is left, determining the annotation direction characteristic of the i-th graphic to be annotated is horizontal to the left; when the optional annotation direction corresponding to the view partition where the target overlaps is located is right, determining the annotation direction characteristic of the i-th graphic to be annotated is horizontal to the right.
[0081] Optionally, when the optional annotation direction corresponding to the view partition where the target overlaps is located is up or down, determining the annotation direction feature of the i-th graphic to be annotated as a vertical direction may include one of the following: when the optional annotation direction corresponding to the view partition where the target overlaps is located is up, determining the annotation direction feature of the i-th graphic to be annotated as vertically upward; when the optional annotation direction corresponding to the view partition where the target overlaps is located is down, determining the annotation direction feature of the i-th graphic to be annotated as vertically downward.
[0082] Optionally, while determining the annotation direction characteristics of the i-th graphic to be annotated based on the optional annotation direction corresponding to the view partition where the target overlaps, the method may further include: taking the view partition where the target overlaps as the view partition to which the i-th graphic to be annotated belongs.
[0083] It should be pointed out that the above only takes the i-th image to be labeled as an example for exemplary explanation. In actual processing, since the same processing as the i-th image to be labeled is performed on each image to be labeled, the labeling direction features of each image to be labeled can be obtained in the end, which will not be described one by one here.
[0084] In some possible embodiments, based on the annotation direction characteristics of each graphic to be annotated, an annotation result corresponding to each graphic to be annotated is generated, including at least one of the following: when it is determined based on the annotation direction characteristics of each graphic to be annotated that there are one or more graphics to be annotated horizontally that can pull leads horizontally, a horizontal annotation result corresponding to each of the one or more graphics to be annotated horizontally is generated; when it is determined based on the annotation direction characteristics of each graphic to be annotated that there are one or more graphics to be annotated vertically, a vertical annotation result corresponding to each of the one or more graphics to be annotated vertically is generated.
[0085] In general, based on the annotation direction characteristics of each of the graphics to be annotated, the annotation results corresponding to each of the graphics to be annotated are generated, which may include pulling at least one of the horizontal annotation results and pulling the vertical annotation results. In the embodiment of the present application, horizontal may refer to the horizontal direction in the viewing range, and vertical may refer to the vertical direction in the viewing range.
[0086] In a case where it is determined based on the annotation direction characteristics of each of the graphics to be annotated that there are one or more graphics to be annotated horizontally that can pull a leader horizontally, generating a horizontal annotation result corresponding to each of the one or more graphics to be annotated horizontally can include: in a case where it is determined based on the annotation direction characteristics of each of the graphics to be annotated that there are one or more graphics to be annotated whose annotation direction characteristics are horizontal among the one or more graphics to be annotated, extracting a current graphic to be annotated from the one or more graphics to be annotated whose annotation direction characteristics are horizontal; in a case where it is determined that the current graphic to be annotated is the current graphic to be annotated horizontally that can pull a leader horizontally, generating a horizontal annotation result corresponding to the current graphic to be annotated horizontally.
[0087] Among them, extracting the current figure to be annotated from the one or more figures to be annotated whose annotation direction feature is horizontal may refer to: when there are one or more figures to be annotated with horizontal annotation direction features remaining and not processed among the one or more figures to be annotated with horizontal annotation direction features, arbitrarily extracting one figure to be annotated from the one or more figures to be annotated with horizontal annotation direction features remaining and not processed as the current figure to be annotated. Further, after generating the horizontal annotation result corresponding to the current figure to be horizontally annotated, it may also include: judging whether there are one or more figures to be annotated with horizontal annotation direction features remaining and not processed among the one or more figures to be annotated with horizontal annotation direction features, and if so, continuing to execute the process of arbitrarily extracting one figure to be annotated from the one or more figures to be annotated with horizontal annotation direction features remaining and not processed as the current figure to be annotated.
[0088] The method further includes at least one of the following: when it is determined based on the annotation direction feature of each of the graphics to be annotated that one or more graphics to be annotated have horizontal annotation direction features, extracting the current graphics to be annotated one by one from the one or more graphics to be annotated with horizontal annotation direction features, and when it is determined that the current graphics to be annotated cannot pull a lead line horizontally, using the current graphics to be annotated as a graphic to be annotated vertically; when it is determined based on the annotation direction feature of each of the graphics to be annotated that one or more graphics to be annotated have vertical annotation direction features, using each of the one or more graphics to be annotated with vertical annotation direction features as a graphic to be annotated vertically.
[0089] That is, the source of one or more graphics to be vertically annotated may include at least one of the following: graphics to be annotated whose annotating direction characteristic is vertical, and graphics to be annotated whose annotating direction characteristic is horizontal but incapable of drawing a leader horizontally.
[0090] Since the source of one or more graphics to be annotated vertically may include at least one of the above two parts, the overall processing flow of executing the annotation direction feature of each graphic to be annotated to generate the annotation result corresponding to each graphic to be annotated can be summarized as follows: first, based on the annotation direction feature of each graphic to be annotated, preliminarily divide the one or more graphics to be annotated whose annotation direction feature is horizontal and / or one or more graphics to be annotated whose annotation direction feature is vertical. If there are one or more graphics to be annotated whose annotation direction feature is vertical, the one or more graphics to be annotated whose annotation direction feature is vertical are directly used as one or more graphics to be annotated vertically; if there are one or more graphics to be annotated whose annotation direction feature is horizontal, then for each of the one or more graphics to be annotated whose annotation direction feature is horizontal, it is judged whether a lead line can be drawn horizontally. If the lead line can be drawn horizontally, a horizontal annotation result is generated for it; if the lead line cannot be drawn horizontally, it is used as a graphic to be annotated vertically; after completing the judgment of each of the one or more graphics to be annotated whose annotation direction feature is horizontal, if it is determined that there are one or more graphics to be annotated vertically, a vertical annotation result corresponding to each of the one or more graphics to be annotated vertically is generated.
[0091] Combination Figure 4 , an exemplary description of the marking method provided in this embodiment is given:
[0092] S401: Divide a view range into one or more view partitions based on one or more optional annotation directions.
[0093] S402: Based on each figure to be annotated in the one or more figures to be annotated and the one or more view partitions, determine an annotation direction feature of each figure to be annotated.
[0094] S403, based on the annotation direction characteristics of each of the figures to be annotated, determine whether there are one or more figures to be annotated whose annotation direction characteristics are horizontal, and whether there are one or more figures to be annotated whose annotation direction characteristics are vertical among the one or more figures to be annotated; if there are one or more figures to be annotated whose annotation direction characteristics are vertical, execute S404; and / or, if there are one or more figures to be annotated whose annotation direction characteristics are horizontal, execute S405.
[0095] S404: taking each of the one or more graphics to be annotated whose annotation direction feature is vertical as a graphic to be annotated vertically.
[0096] S405 , determining whether there are any unprocessed one or more graphics to be annotated whose annotation direction feature is horizontal among the one or more graphics to be annotated whose annotation direction feature is horizontal. If so, executing S406 ; if not, executing S409 .
[0097] S406, extract the current figure to be annotated from one or more remaining unprocessed figures to be annotated whose annotation direction feature is horizontal, and determine whether the current figure to be annotated is a current figure to be horizontally annotated that can pull a leader horizontally. If the current figure to be annotated is a current figure to be horizontally annotated that can pull a leader horizontally, execute S407; if the current figure to be annotated cannot pull a leader horizontally, execute S408.
[0098] S407, generating a horizontal annotation result corresponding to the current graphic to be horizontally annotated, and returning to execute S405.
[0099] S408, taking the current figure to be annotated as the figure to be vertically annotated, and returning to execute S405.
[0100] S409, determine whether there are one or more graphics to be vertically annotated, if so, execute S410, otherwise, end the process.
[0101] S410: Generate a vertical annotation result corresponding to each of the one or more graphics to be vertically annotated.
[0102] In one embodiment, when it is determined that the current graphic to be annotated is a current graphic to be annotated that can pull a lead horizontally, generating a horizontal annotation result corresponding to the current graphic to be annotated may include one of the following: when the optimal lead of the current graphic to be annotated can be directly pulled, determining that the current graphic to be annotated is the current graphic to be annotated that can pull a lead horizontally, and generating a horizontal straight line annotation result corresponding to the current graphic to be annotated based on the optimal lead of the current graphic to be annotated; when the optimal lead of the current graphic to be annotated cannot be directly pulled and there is remaining space in the view partition to which the current graphic to be annotated belongs, determining that the current graphic to be annotated is the current graphic to be annotated that can pull a lead horizontally, bending the optimal lead of the current graphic to be annotated, and generating a horizontal broken line annotation result corresponding to the current graphic to be annotated.
[0103] Specifically, when it is determined that the current graphic to be annotated is the current graphic to be annotated horizontally capable of pulling a lead line horizontally, generating a horizontal annotation result corresponding to the current graphic to be annotated horizontally may include: judging whether the optimal lead line of the current graphic to be annotated can be directly pulled; if it can be directly pulled, then determining that the current graphic to be annotated is the current graphic to be annotated horizontally capable of pulling a lead line horizontally, and based on the optimal lead line of the current graphic to be annotated, generating a horizontal straight line annotation result corresponding to the current graphic to be annotated; if it cannot be directly pulled, then judging whether there is current remaining space in the view partition to which the current graphic to be annotated belongs; if there is current remaining space, then determining that the current graphic to be annotated is the current graphic to be annotated horizontally capable of pulling a lead line horizontally, bending the optimal lead line of the current graphic to be annotated horizontally, and generating a horizontal broken line annotation result corresponding to the current graphic to be annotated horizontally.
[0104] The optimal lead of the current figure to be annotated may be determined from one or more optional leads of the current figure to be annotated. The optimal lead of the current figure to be annotated may be determined by: from all optional solutions of the current figure to be annotated that are sorted from best to worst, determining the optional lead in the first optional solution as the optimal lead of the current figure to be annotated.
[0105] Any optional solution of the current figure to be annotated may include an optional lead line and its corresponding optional lead point; the optional solution of the current figure to be annotated may also be referred to as an optional solution of pulling the lead line of the current figure to be annotated out of the viewing range.
[0106] The one or more optional solutions for pulling the lead line outside the view range of the current figure to be annotated, sorted from best to worst, may be generated when it is determined that there are one or more figures to be annotated whose annotation direction feature is horizontal among the one or more figures to be annotated.
[0107] Taking any figure to be annotated whose annotation direction feature is horizontal as the jth figure to be annotated (j is an integer greater than or equal to 1) as an example, one or more optional solutions for pulling a lead line outside the view range can be generated for the jth figure to be annotated, and the one or more optional solutions can be ranked from best to worst.
[0108] One or more optional solutions for pulling a lead outside the viewing range are generated for the jth figure to be annotated. The one or more optional lead points and one or more optional straight leads (i.e., one or more optional solutions) of the jth figure to be annotated can be determined based on lead point constraint rules, lead line constraint rules, and an area corresponding to the viewing range where the lead cannot pass through.
[0109] Exemplarily, it is assumed that the leader constraint rule includes that the user hopes or expects that the leader of each figure to be annotated does not pass through the component of the non-passable leader; the leader constraint rule may include: the user hopes or expects that the position of the leader in each figure to be annotated whose annotation feature direction is horizontal (including horizontal to the left and / or horizontal to the right) is set to be on the vertical center line of the figure to be annotated and / or the horizontal center line of the figure to be annotated. Determining one or more optional leader points and one or more optional straight leader lines of the jth figure to be annotated may be: determining the vertical center line of the jth figure to be annotated; determining one or more candidate leader points of the jth figure to be annotated along the vertical center line; from each candidate leader point of the one or more candidate leader points of the jth figure to be annotated, in the direction of the lead-out surface of the jth figure to be annotated, leading out a candidate straight leader line corresponding to each candidate leader point; based on the area corresponding to the view range that cannot pass through the leader, from each candidate leader point corresponding to the jth figure to be annotated and the candidate straight leader line corresponding to each candidate leader point, determine each optional leader point of the jth figure to be annotated and the optional straight leader line corresponding to each optional leader point. The annotation feature direction of the jth figure to be annotated may be horizontally to the right or horizontally to the left.
[0110] The lead-out surface of the jth figure to be annotated may be the outer surface of the intersection between the annotable area of the jth figure to be annotated and the view partition to which the jth figure to be annotated belongs.
[0111] Among them, there may be unlabeled areas and / or labelable areas in the jth figure to be labeled. For example, the jth figure to be labeled contains other graphics or elements, which are difficult to label due to the interference of other graphics or elements. The area where other graphics or elements are located can be called the unlabeled area of the jth figure to be labeled, and all other areas except the unlabeled area in the jth figure to be labeled can be called the labelable area of the jth figure to be labeled. For example, text elements are placed in some areas of the jth figure to be labeled. The area where the text elements are placed is the unlabeled area of the jth figure to be labeled, and the remaining areas are all the labelable areas of the jth figure to be labeled.
[0112] The overlapping part between the labelable area of the jth figure to be labeled and the view partition to which the jth figure to be labeled belongs is the intersection of the labelable area of the jth figure to be labeled and the view partition to which the jth figure to be labeled belongs. The overlapping part may include a surface facing outside the view range, which is used as the lead-out surface of the jth figure to be labeled.
[0113] Wherein, based on the area where the lead cannot pass through corresponding to the viewing range, from each candidate lead point corresponding to the jth figure to be annotated and the candidate straight lead line corresponding to each candidate lead point, determining each optional lead point of the jth figure to be annotated and the optional straight lead line corresponding to each optional lead point may include: extracting the current candidate straight lead line from each candidate lead point corresponding to the jth figure to be annotated and the candidate straight lead line corresponding to each candidate lead point; judging whether the current candidate straight lead line passes through the area where the lead cannot pass through corresponding to the viewing range, deleting the current candidate straight lead line and its corresponding candidate lead point if the current candidate straight lead line passes through the area where the lead cannot pass through corresponding to the viewing range, and using the current candidate straight lead line and its corresponding candidate lead point as the optional lead point and the optional straight lead line corresponding to the optional lead point, respectively, if the current candidate straight lead line does not pass through the area where the lead cannot pass through corresponding to the viewing range. This process is repeated until all optional lead points of the jth figure to be annotated and the optional straight lead lines corresponding to all optional lead points are obtained, and no further description is given.
[0114] Among them, sorting one or more optional solutions from best to worst can be based on the position of the optional lead point corresponding to the optional lead line in each optional solution in the current figure to be annotated, and sorting one or more optional solutions from best to worst. For example, the smaller the distance between the optional lead point in any optional solution and the center point of the current figure to be annotated, the better the optional solution is, and vice versa. It should be understood that this is only one way to determine the superiority or inferiority of the optional solution. In actual processing, other ways may also be used to determine the superiority or inferiority of the optional solution, and this embodiment does not limit or exhaustively list them.
[0115] Since for each figure to be annotated whose annotation direction feature is horizontal, the corresponding optional solutions are determined and sorted in the same manner as the j-th figure to be annotated, they will not be described one by one here.
[0116] Determining whether the optimal lead of the current figure to be annotated can be directly pulled may include: determining whether the optimal lead of the current figure to be annotated can satisfy the lead avoidance rule; if so, determining that the optimal lead of the current figure to be annotated can be directly pulled; if not, determining that the optimal lead of the current figure to be annotated cannot be directly pulled.
[0117] Specifically, the lead avoidance rule can be obtained based on the lead constraint rule. For example, the lead constraint rule may include at least one of the following: the user hopes or expects that the lead of each figure to be annotated does not pass through other annotation texts, the user hopes or expects that the lead of each figure to be annotated does not pass through other leads, and the user hopes or expects that the distance between the lead of each figure to be annotated and other leads is greater than a first specified distance; accordingly, the lead avoidance rule may include at least one of the following: the lead of the figure to be annotated does not pass through other annotation texts, the lead of the figure to be annotated does not overlap with other leads, the distance between the lead of the figure to be annotated and other leads is greater than a first specified distance, etc.
[0118] The annotation result corresponding to any figure to be annotated can be composed of the following parts: a lead point within the figure to be annotated, annotation text used to describe the figure to be annotated, and a lead line drawn from the lead point, where the lead line can point to the annotation text and the distance between the lead line and the annotation text is not less than a second specified distance.
[0119] Furthermore, the horizontal straight line annotation result corresponding to the current figure to be annotated may include: a lead point in the current figure to be annotated, an annotation text for describing the current figure to be annotated, and a straight leader line horizontally led out from the lead point. Generating the horizontal straight line annotation result corresponding to the current figure to be annotated based on the optimal lead line of the current figure to be annotated may refer to using the optimal lead line of the current figure to be annotated as a straight leader line horizontally led out from the lead point of the current figure to be annotated; using the optional lead point corresponding to the optimal lead line as a lead point in the current figure to be annotated; generating annotation text for describing the current figure to be annotated based on the relevant information of the annotation text, and setting the annotation text based on the user's wish or expectation contained in the lead constraint rule that the distance between the lead line of each figure to be annotated and the annotation text is not less than a second specified distance.
[0120] In addition, after generating a horizontal straight line annotation result corresponding to the current figure to be annotated based on the optimal leader of the current figure to be annotated, the method may further include: removing the area occupied by the horizontal straight line annotation result corresponding to the current figure to be annotated in the current remaining space to obtain an updated remaining space.
[0121] Determining whether there is currently remaining space in the view partition to which the current graphic to be annotated belongs may refer to: determining whether there is currently remaining space in the view partition to which the current graphic to be annotated belongs, and if so, determining that the current graphic to be annotated can be bent and pulled, otherwise, determining that the current graphic to be annotated cannot be bent and pulled. In some examples, determining whether there is currently remaining space in the view partition to which the current graphic to be annotated belongs may also be alternatively described as: determining whether the current graphic to be annotated can be bent and pulled.
[0122] The horizontal broken line annotation result corresponding to the current figure to be annotated may include: a lead point in the current figure to be annotated, an annotation text for describing the current figure to be annotated, and a bent lead line that is horizontally drawn out from the lead point after being bent. Bending the optimal lead line of the current figure to be horizontally annotated to generate the horizontal broken line annotation result corresponding to the current figure to be horizontally annotated may refer to taking the optional lead point corresponding to the optimal lead line of the current figure to be horizontally annotated as the lead point in the current figure to be annotated; in the remaining space, taking the lead point as the starting point to generate a broken line of a first length in a first direction at a first angle, and taking the annotation direction feature of the current figure to be annotated as the straight line extension direction, to obtain the bent lead line of the current figure to be annotated that is horizontally drawn out from the lead point after being bent; based on the relevant information of the annotation text, generating the annotation text for describing the current figure to be annotated, and setting the annotation text based on the user's wish or expectation contained in the lead constraint rule that the distance between the lead line of each figure to be annotated and the annotation text is not less than the second specified distance.
[0123] Among them, the first direction can be upward or downward, and the first direction can be determined according to actual conditions. The first angle can also be determined according to actual conditions, for example, it can be 30 degrees, or 45 degrees, or larger or smaller than the horizontal direction. The first length can also be determined according to actual conditions, for example, it can be 5 mm, or 1 cm, or larger or smaller, without limitation or exhaustive enumeration. It should be pointed out that the above determination methods of the first direction, the first angle, and the first length are not limited in this embodiment, as long as the bent lead wire horizontally led out after the lead point is bent can meet the lead avoidance rule, it is within the protection scope of this embodiment.
[0124] In addition, after bending the optimal lead of the current figure to be horizontally annotated and generating a horizontal broken line annotation result corresponding to the current figure to be horizontally annotated, it can also include: removing the area occupied by the horizontal broken line annotation result corresponding to the current figure to be horizontally annotated in the current remaining space to obtain an updated remaining space.
[0125] In addition, it may also include: if the optimal leader of the current figure to be annotated cannot be directly pulled, and there is no current remaining space in the view partition to which the current figure to be annotated belongs, it is determined that the current figure to be annotated cannot have a leader pulled horizontally, and the current figure to be annotated is used as a figure to be vertically annotated.
[0126] In the process of generating horizontal dimensioning results, first ensure that the object of the leader line can be directly pulled. If the leader line cannot be pulled directly, it can be pulled by bending.
[0127] See also Figure 5 , the processing of horizontal annotation provided by the embodiment of the present disclosure is exemplarily described, specifically including:
[0128] S501: For each of the one or more graphics to be annotated whose annotation direction feature is horizontal, generate one or more optional solutions for pulling a leader line outside a view range, and arrange the one or more optional solutions from best to worst.
[0129] S502: Determine whether there are one or more unprocessed graphics to be annotated among the one or more graphics to be annotated whose annotation direction feature is horizontal. If so, select any one of the one or more unprocessed graphics to be annotated as the current graphic to be annotated and execute S503; otherwise, end the processing.
[0130] S503: Determine whether the optimal leader of the current figure to be annotated can satisfy the leader avoidance rule. If so, execute S504; if not, execute S506.
[0131] S504: Determine that the current figure to be annotated is a current figure to be horizontally annotated that can draw a leader line horizontally, and generate a horizontal straight line annotation result corresponding to the current figure to be annotated based on the optimal leader line of the current figure to be annotated.
[0132] S505: Update the remaining space, and then execute S502.
[0133] S506: Determine whether the current figure to be annotated can be bent and pulled. If so, execute S507. Otherwise, take the current figure to be annotated as a figure to be vertically annotated and return to execute S502.
[0134] S507: Determine that the current figure to be marked is a current figure to be marked horizontally that can draw a lead line horizontally, bend the optimal lead line of the current figure to be marked horizontally, generate a horizontal fold line marking result corresponding to the current figure to be marked horizontally, and return to S505.
[0135] Here, the end processing in S502 may refer to the end processing of horizontal annotation. After the end processing, it may be further determined whether there are one or more graphics to be vertically annotated. If so, a vertical annotation result corresponding to each of the one or more graphics to be vertically annotated is generated.
[0136] Combination Figure 6 The processing results of horizontal annotation are schematically explained. Figure 6In the figure, the graphics to be annotated whose annotation direction feature is horizontal (specifically horizontal to the right) include a double sofa and a TV cabinet; first, the current graphic to be annotated is selected as the TV cabinet, and the optimal lead line of the TV cabinet meets the lead line avoidance rule. Because there are currently no other leads or other annotation texts, etc., the horizontal straight line annotation result corresponding to the TV cabinet can be generated directly based on the optimal lead line of the TV cabinet (its annotation text is "TV cabinet"); then the double sofa is selected as the current graphic to be annotated again, because the lead point of the double sofa and the lead point of the TV cabinet are the same in the vertical direction, the optimal lead line of the double sofa will coincide with the lead line of the TV cabinet, so the optimal lead line of the double sofa does not meet the lead line avoidance rule, but there is still remaining space on the right side of the current view range, and the double sofa can be bent and pulled, so the optimal lead line of the current graphic to be horizontally annotated can be bent (for example Figure 6 As shown, bend upward 90 degrees from the lead point, and then pull the lead line horizontally), and finally generate the horizontal broken line annotation result corresponding to the current horizontally annotated figure (the annotation text is "Double Sofa").
[0137] In some possible implementations, generating a vertical annotation result corresponding to each of the one or more graphics to be vertically annotated includes: grouping the one or more graphics to be vertically annotated based on the projection of each of the one or more graphics to be vertically annotated to obtain one or more vertical annotation groups; vertically annotating each of the graphics to be vertically annotated in each of the one or more vertical annotation groups to obtain a vertical annotation result corresponding to each of the graphics to be vertically annotated in each of the vertical annotation groups.
[0138] Among them, based on the projection of each of the one or more figures to be vertically annotated, grouping the one or more figures to be vertically annotated to obtain one or more vertical annotation groups may include: when there are one or more figures to be vertically annotated that are not added to the vertical annotation group among the one or more figures to be vertically annotated, projecting each of the one or more figures to be vertically annotated that are not added to the vertical annotation group to obtain the projection of each figure to be vertically annotated; based on the projection of each figure to be vertically annotated, determining one or more projection intervals, and determining the number of one or more candidate figures to be vertically annotated corresponding to each projection interval in the one or more projection intervals; selecting the projection interval with the largest number of corresponding candidate figures to be vertically annotated from the one or more projection intervals as the current projection interval; based on the one or more candidate figures to be vertically annotated corresponding to the current projection interval, generating a current vertical annotation group, wherein the current vertical annotation group is one of the one or more vertical annotation groups.
[0139] Here, when the one or more graphics to be vertically marked are processed for the first time, the one or more graphics to be vertically marked that are not added to the vertical marking group may include all graphics to be vertically marked.
[0140] Projecting each of the one or more figures to be vertically marked that are not added to the vertical marking group to obtain the projection of each of the figures to be vertically marked may include: dividing the one or more figures to be vertically marked that are not added to the vertical marking group based on the fact that the marking direction feature of each of the one or more figures to be vertically marked that are not added to the vertical marking group is vertically upward or vertically downward, to obtain one or more figures to be vertically marked that are not added to the vertical marking group and / or one or more figures to be vertically marked that are not added to the vertical marking group and pull the lead vertically downward; in the case that there are one or more figures to be vertically marked that are not added to the vertical marking group and pull the lead vertically upward, projecting each of the one or more figures to be vertically marked that are pulled vertically upward onto a baseline to obtain the projection of each figure to be vertically marked that pulls the lead vertically upward; in the case that there are one or more figures to be vertically marked that are not added to the vertical marking group and pull the lead vertically downward, projecting each of the one or more figures to be vertically marked that are pulled vertically downward onto a baseline to obtain the projection of each figure to be vertically marked that pulls the lead vertically downward. The reference line refers to the horizontal reference line in the projection process, which means that all the graphics to be vertically annotated need to be projected onto the reference line (horizontal reference line). Projection refers to the process of mapping the two-dimensional graphics to be annotated onto the reference line. The projection or mapping direction can be from top to bottom or from bottom to top. The mapping direction is not limited here. This mapping result only retains the length information from the left end point to the right end point of the graphics to be vertically annotated.
[0141] It should be noted that, among one or more graphics to be vertically marked that are not added to the vertical marking group, there may be graphics to be vertically marked with a horizontal marking direction feature. Such graphics to be vertically marked can be classified into any one of the following: graphics to be vertically marked that are not added to the vertical marking group and have their leaders pulled vertically upward, and graphics to be vertically marked that are not added to the vertical marking group and have their leaders pulled vertically downward.
[0142] Determining one or more projection intervals based on the projection of each of the graphics to be vertically annotated, and determining the number of projections of the one or more candidate graphics to be vertically annotated included in each of the one or more projection intervals, may include one of the following:
[0143] In the case where the nth figure to be vertically annotated is a figure to be vertically annotated in which a lead is pulled vertically upward, if the projection of the nth figure to be vertically annotated overlaps with the projections of one or more other figures to be vertically annotated in which the lead is pulled vertically upward, then the interval in which the projections of the nth figure to be vertically annotated and the one or more other figures to be vertically annotated in which the lead is pulled vertically upward are overlapped is taken as the mth projection interval, and the number of the nth figure to be vertically annotated and the one or more other figures to be vertically annotated is taken as the number of one or more candidate figures to be vertically annotated corresponding to the mth projection interval;
[0144] In the case where the nth figure to be vertically annotated is a figure to be vertically annotated from which a lead is pulled vertically downward, if the projection of the nth figure to be vertically annotated overlaps with the projections of one or more other figures to be vertically annotated from which a lead is pulled vertically downward, then the interval in which the projections of the nth figure to be vertically annotated and the one or more other figures to be vertically annotated from which a lead is pulled vertically downward overlap is taken as the mth projection interval, and the number of the nth figure to be vertically annotated and the one or more other figures to be vertically annotated is taken as the number of one or more candidate figures to be vertically annotated corresponding to the mth projection interval;
[0145] In the case where the nth figure to be vertically annotated is a figure to be vertically annotated with a lead line drawn vertically upward, if the projection of the nth figure to be vertically annotated does not overlap with the projection of any other figure to be vertically annotated with a lead line drawn vertically upward, the projection of the nth figure to be vertically annotated is taken as the mth projection interval, and the number of candidate figures to be vertically annotated corresponding to the mth projection interval is determined to be 1;
[0146] In the case where the nth figure to be vertically marked is a figure to be vertically marked with a lead line pulled vertically downward, if the projection of the nth figure to be vertically marked does not overlap with the projection of any other figure to be vertically marked with a lead line pulled vertically downward, then the projection of the nth figure to be vertically marked is taken as the mth projection interval, and the number of candidate figures to be vertically marked corresponding to the mth projection interval is determined to be 1.
[0147] Wherein, n and m are both integers greater than or equal to 1, the mth projection interval is any one of the one or more projection intervals, and the nth figure to be vertically annotated and the one or more other figures to be vertically annotated are all figures to be vertically annotated that are not added to the vertical annotation group. Since the same process is performed for each figure to be vertically annotated, it is not described one by one, and finally one or more projection intervals can be determined, and the number of projections of one or more candidate figures to be vertically annotated included in each projection interval of the one or more projection intervals can be determined.
[0148] Generating a current vertical annotation group based on the one or more candidate graphics to be vertically annotated corresponding to the current projection interval may refer to: adding the one or more candidate graphics to be vertically annotated corresponding to the current projection interval to the current vertical annotation group.
[0149] In addition, after the current vertical annotation group is generated based on the one or more candidate graphics to be vertically annotated corresponding to the current projection interval, it may also include: judging whether there are one or more graphics to be vertically annotated that are not added to the vertical annotation group among the one or more graphics to be vertically annotated, and if not, determining to obtain one or more vertical annotation groups, wherein the one or more vertical annotation groups include the current vertical annotation group. Or, after the current vertical annotation group is generated based on the one or more candidate graphics to be vertically annotated corresponding to the current projection interval, it may also include: judging whether there are one or more graphics to be vertically annotated that are not added to the vertical annotation group among the one or more graphics to be vertically annotated, and if so, returning to continue to perform the projection of each graphics to be vertically annotated in the one or more graphics to be vertically annotated that are not added to the vertical annotation group, and obtaining the projection of each graphics to be vertically annotated, until one or more vertical annotation groups are obtained, and no repeated explanation is given.
[0150] Vertically annotating each figure to be vertically annotated in each vertical annotation group in the one or more vertical annotation groups to obtain a vertical annotation result corresponding to each figure to be vertically annotated in each vertical annotation group may include: extracting a current vertical annotation group from the one or more vertical annotation groups; generating a ray perpendicular to the current projection interval corresponding to the current vertical annotation group with the midpoint of the current projection interval as a starting point; determining a bending direction of a lead line of the current vertical annotation group based on a position of the current vertical annotation group in the viewing range, when a lead point of each figure to be vertically annotated in the current vertical annotation group can be determined based on the ray; generating a vertical annotation result corresponding to each figure to be vertically annotated in the current vertical annotation group based on the bending direction of the lead line of the current vertical annotation group and a lead point of each figure to be vertically annotated in the current vertical annotation group.
[0151] Among them, extracting the current vertical annotation group from the one or more vertical annotation groups may mean: when there are one or more vertical annotation groups that have not generated vertical annotation results in the one or more vertical annotation groups, extracting a vertical annotation group with the largest number of corresponding graphics to be vertically annotated from the one or more vertical annotation groups that have not generated vertical annotation results as the current vertical annotation group.
[0152] The method for judging whether the guide point of each figure to be vertically annotated in the current vertical annotation group can be determined based on the ray, may include: judging whether the ray passes through the area that cannot pass through the guide line corresponding to the view range, if not, then determining the guide point of each figure to be vertically annotated in the current vertical annotation group based on the ray; otherwise, the guide point of each figure to be vertically annotated in the current vertical annotation group cannot be determined based on the ray. This is only an exemplary description, in actual processing, it can also be added to judge whether the ray overlaps and / or blocks other graphics, text elements, added annotation text, etc., and all possible judgment methods for whether the ray can determine the guide point of each figure to be vertically annotated in the current vertical annotation group are not limited or exhaustive.
[0153] Further, determining the leading point of each figure to be vertically annotated in the current vertical annotation group based on the ray may be as follows: obtaining the annotable lines of each figure to be vertically annotated obtained by passing the ray through each figure to be vertically annotated in the current vertical annotation group; determining the leading point of each figure to be vertically annotated on the annotable lines in each figure to be vertically annotated. Among them, the annotable lines in each figure to be vertically annotated may refer to the intersection lines obtained by the ray passing through the figure to be vertically annotated. Determining the leading point of each figure to be vertically annotated on the annotable lines in each figure to be vertically annotated may refer to determining the leading point (i.e., the optimal leading point) of each figure to be vertically annotated on the annotable lines in each figure to be vertically annotated. Exemplarily, determining the leading point of each figure to be vertically annotated on the annotable lines in each figure to be vertically annotated may be as follows: taking the midpoint of the annotable lines in each figure to be vertically annotated as the leading point of each figure to be vertically annotated.
[0154] In addition, in the case where the reference point of each figure to be vertically annotated in the current vertical annotation group cannot be determined based on the ray, it may also include: judging whether the current number of iterations exceeds the maximum number of iterations, if not, dividing the current projection interval into two left and right sub-projection intervals based on the midpoint of the current projection interval corresponding to the current vertical annotation group, and using the left and right sub-projection intervals as new current projection intervals corresponding to the current vertical annotation group. After obtaining the new current projection interval corresponding to the current vertical annotation group, executing the midpoint of the new current projection interval corresponding to the current vertical annotation group as the starting point, generating a ray perpendicular to the current projection interval and the subsequent processing, which will not be described in detail.
[0155] It should be noted that when the process of determining the guide point is performed for the first time, the current projection interval corresponding to the current vertical annotation group is the original projection interval of the current vertical annotation group.
[0156] It should also be pointed out that since the two left and right sub-projection intervals are respectively used as the new current projection intervals corresponding to the current vertical annotation group, that is, there are two current projection intervals, the midpoints of the two new current projection intervals corresponding to the current vertical annotation group are used as two starting points to generate rays perpendicular to the current projection interval and their subsequent processing.
[0157] After the guide point of each figure to be vertically annotated in the current vertical annotation group cannot be determined based on the ray each time, the method may further include: if the current number of iterations exceeds the maximum number of iterations, the guide point of each figure to be vertically annotated in the current vertical annotation group is obtained based on a default configuration. The default configuration may be configured according to actual conditions, for example, a ray perpendicular to the current projection interval may be generated with the midpoint of the original projection interval corresponding to the current vertical annotation group as the starting point, and the guide point of each figure to be vertically annotated in the current vertical annotation group may be determined based on the ray.
[0158] Determining the bending direction of the lead of the current vertical annotation group based on the position of the current vertical annotation group in the viewing range may include one of the following: when the position of the current vertical annotation group in the viewing range is on the left side of the viewing range, determining the bending direction of the lead of the current vertical annotation group to be left; when the position of the current vertical annotation group in the viewing range is on the right side of the viewing range, determining the bending direction of the lead of the current vertical annotation group to be right.
[0159] The vertical annotation results corresponding to each figure to be vertically annotated in the current vertical annotation group may include: a leader line extending vertically through the leader point of each figure to be vertically annotated to outside the viewing range, the leader point of each figure to be vertically annotated, and the annotation text of each figure to be vertically annotated. Based on the bending direction of the leader of the current vertical annotation group and the lead point of each figure to be vertically annotated in the current vertical annotation group, a vertical annotation result corresponding to each figure to be vertically annotated in the current vertical annotation group is generated, which may include: when the annotation direction feature corresponding to the current vertical annotation group is vertically upward, from the lead point of each figure to be vertically annotated in the current vertical annotation group, a leader is drawn that passes through the lead point of each figure to be vertically annotated and extends vertically upward to outside the viewing range; based on the bending direction of the leader of the current vertical annotation group, one or more bending lines are generated outside the viewing range, wherein the endpoint of the uppermost bending line among the one or more bending lines coincides with the endpoint of the leader, and the number of the one or more bending lines is the same as the number of figures to be vertically annotated contained in the current vertical annotation group; and the annotation text of the corresponding figure to be vertically annotated is added at a position that is not less than a second specified distance from the end position of each bending line among the one or more bending lines. Alternatively, when the annotation direction feature corresponding to the current vertical annotation group is vertically downward, a leader line is drawn from the lead point of each figure to be vertically annotated in the current vertical annotation group, extending vertically downward through the lead point of each figure to be vertically annotated to outside the viewing range; one or more bending lines are generated outside the viewing range based on the bending direction of the leader of the current vertical annotation group, wherein the endpoint of the lowest bending line among the one or more bending lines coincides with the endpoint of the leader, and the number of the one or more bending lines is the same as the number of figures to be vertically annotated contained in the current vertical annotation group; and the annotation text of the corresponding figure to be vertically annotated is added at a position that is not less than a second specified distance from the end position of each bending line among the one or more bending lines.
[0160] It should be pointed out that the lead constraint rules still need to be considered in the above processing. For example, in the process of drawing a lead line that extends vertically downward through the lead point of each figure to be vertically annotated to outside the viewing range, the length of the lead line needs to be able to avoid other annotation texts; in the process of generating one or more bending lines outside the viewing range based on the bending direction of the lead of the current vertical annotation group, the one or more bending lines can be perpendicular to the lead line, and the length or position of each bending line also needs to be able to avoid other annotation texts, and the interval between one or more bending lines also needs to meet the requirement that the annotation text can also avoid other annotation texts when the annotation text is finally added. In addition, in the process of adding the annotation text of the figure to be vertically annotated, the text avoidance rules will also be considered, that is, to ensure that the annotation text of the figure to be vertically annotated does not collide with other annotation texts. For example, the annotation text of the figure to be vertically annotated can be offset upward or downward by a third specified distance to avoid collision with other annotation texts, wherein the third specified distance can be configured according to actual conditions.
[0161] See also Figure 7 , the vertical annotation processing provided by the embodiment of the present disclosure is exemplarily described, specifically including:
[0162] S701 , projecting each of the one or more graphics to be vertically marked that are not added to the vertical marking group to obtain a projection of each of the graphics to be vertically marked.
[0163] S702: Determine one or more projection intervals based on the projection of each of the graphics to be vertically annotated, and determine the number of one or more candidate graphics to be vertically annotated corresponding to each of the one or more projection intervals.
[0164] S703: Selecting, from the one or more projection intervals, a projection interval corresponding to the largest number of candidate graphics to be vertically annotated as a current projection interval.
[0165] S704: Generate a vertical annotation group based on the one or more candidate graphics to be vertically annotated corresponding to the current projection interval.
[0166] S705, determining whether there are one or more graphics to be vertically annotated that are not added to the vertical annotation group among the one or more graphics to be vertically annotated; if yes, returning to execute S701, if no, executing S706.
[0167] S706, extracting the current vertical annotation group. In this step, extracting the current vertical annotation group may refer to: extracting the current vertical annotation group from one or more unprocessed vertical annotation groups. When this step is performed for the first time, the one or more unprocessed vertical annotation groups may be all vertical annotation groups.
[0168] S707 , taking the midpoint of the current projection interval corresponding to the current vertical annotation group as a starting point, generating a ray perpendicular to the current projection interval.
[0169] S708, determine whether the lead point of each figure to be vertically annotated in the current vertical annotation group can be determined based on the ray. If so, determine the lead point of each figure to be vertically annotated in the current vertical annotation group based on the ray and execute S711; otherwise, execute S709.
[0170] S709, determine whether the current number of iterations exceeds the maximum number of iterations, if not, execute S710, otherwise, based on the default configuration, obtain the guide point of each graphic to be vertically annotated in the current vertical annotation group, and execute S711.
[0171] S710, dividing the current projection interval corresponding to the current vertical annotation group into two left and right sub-projection intervals based on the midpoint of the current projection interval, taking the left and right sub-projection intervals as new current projection intervals corresponding to the current vertical annotation group, and returning to execute S707.
[0172] S711, based on the position of the current vertical annotation group in the viewing range, determine the bending direction of the leader of the current vertical annotation group; based on the bending direction of the leader of the current vertical annotation group and the lead point of each figure to be vertically annotated in the current vertical annotation group, generate a vertical annotation result corresponding to each figure to be vertically annotated in the current vertical annotation group. In the process of executing S711, it is necessary to ensure that the leader, bending line, and annotation text finally generated can meet the requirement of avoiding other annotation texts. The relevant description is the same as the above-mentioned embodiment and will not be repeated.
[0173] S712, determining whether there are one or more unprocessed vertical annotation groups in the one or more vertical annotation groups, if there are one or more unprocessed vertical annotation groups, returning to S706, i.e. extracting the current vertical annotation group again from the one or more unprocessed vertical annotation groups; if there are no unprocessed vertical annotation groups, ending the processing. Here, ending the processing may refer to: determining that the annotation processing of each vertical annotation group is completed, i.e. obtaining the vertical annotation result corresponding to each to-be-vertically-annotated graphic.
[0174] Combination Figure 6 The processing results of vertical annotation are schematically explained. Figure 6In the figure, the graphics to be vertically annotated whose annotation direction feature is vertical (specifically vertically upward) include a double bed, a flush toilet, and a shower room; based on the projections of the double bed, the flush toilet, and the shower room, it is determined that there are two projection intervals, and it is determined that the left projection interval corresponds to a double bed and the right projection interval corresponds to the flush toilet and the shower room in the two projection intervals, and a vertical annotation group A including the flush toilet and the shower room and a vertical annotation group B including the double bed can be generated; firstly, the vertical annotation group A including more graphics to be vertically annotated is selected, and a ray is generated to pass through the flush toilet and the shower room with the midpoint of the projection interval of the vertical annotation group A as the starting point, and then the lead points of the flush toilet and the shower room are determined respectively on the intersection lines obtained by the ray passing through the flush toilet and the shower room, and the lead lines are drawn out of the viewing range; since the flush toilet and the shower room are located on the left side of the viewing range, two bending lines connected to the lead lines and bent to the left at 90 degrees can be generated, and annotation texts (i.e. Figure 6 Then select the vertical annotation group B that contains a figure to be vertically annotated, and generate a ray passing through the double bed with the midpoint of the projection interval of the vertical annotation group B as the starting point. Then determine the lead point of the double bed on the intersection line obtained by the ray passing through the double bed, and draw a lead line out of the view range; because of the left side of the double bed, a bending line that bends 90 degrees to the left and connects to the lead line can be generated, and the annotation text is added to the left side of the bending line (i.e. Figure 6 "180cm*200cm double bed").
[0175] For the above Figure 7 For the processing of generating the illustrated vertical annotation results, the processing of generating the vertical annotation results provided in this embodiment preferably generates the vertical annotation results by using a lead line passing through more areas of the graphics to be vertically annotated in order to make the lead text as beautiful as possible. Therefore, each graphic to be vertically annotated is first projected in the vertical direction, and the projection interval is counted to count how many graphics to be vertically annotated can be passed through if a lead line is pulled in each projection interval, and then the projection interval that can pass through the most graphics to be vertically annotated by pulling a lead line is selected to start vertical annotation. Furthermore, in order to prevent collisions between the vertical annotation results in the vertical direction, the vertical annotation results are generated in such a way that the bending lines connected to the leads on the left side of the viewing range face to the left, and the bending lines connected to the leads on the right side of the viewing range face to the right. At the same time, through the avoidance rules of the annotation text, the annotation text can also be made clear and collision-free.
[0176] See also Figure 8 , is a structural block diagram of a marking device provided in an embodiment of the present application, including:
[0177] A view partition determination module 801 is used to divide a view range into one or more view partitions based on one or more optional annotation directions, wherein the view range is used to display one or more graphics to be annotated, and different view partitions in the one or more view partitions correspond to different optional annotation directions;
[0178] The annotation direction feature determination module 802 is used to determine the annotation direction feature of each of the one or more graphics to be annotated and the one or more view partitions.
[0179] The annotation module 803 is used to generate an annotation result corresponding to each of the graphics to be annotated based on the annotation direction feature of each of the graphics to be annotated;
[0180] Among them, the annotation direction feature determination module 802 is specifically used to obtain the area of each overlapping part of the i-th figure to be annotated and one or more overlapping parts of the one or more view partitions, wherein i is an integer greater than or equal to 1, and the i-th figure to be annotated is one of the one or more figures to be annotated; based on the area of each overlapping part and the weight value of the view partition where each overlapping part is located, calculate the area weighted value corresponding to each overlapping part; determine the target overlapping part with the maximum area weighted value from the one or more overlapping parts, and use the optional annotation direction corresponding to the view partition where the target overlapping part is located as the annotation direction feature of the i-th figure to be annotated.
[0181] The annotation module 803 is used to perform at least one of the following: when it is determined based on the annotation direction characteristics of each of the graphics to be annotated that there are one or more graphics to be annotated horizontally that can pull a lead horizontally, generate a horizontal annotation result corresponding to each of the one or more graphics to be annotated horizontally; when it is determined based on the annotation direction characteristics of each of the graphics to be annotated that there are one or more graphics to be annotated vertically, generate a vertical annotation result corresponding to each of the one or more graphics to be annotated vertically.
[0182] The annotation module 803 is used to extract the current figure to be annotated from the one or more figures to be annotated whose annotation direction characteristics are horizontal when it is determined that there are one or more figures to be annotated whose annotation direction characteristics are horizontal among the one or more figures to be annotated based on the annotation direction characteristics of each figure to be annotated; and generate a horizontal annotation result corresponding to the current figure to be annotated when it is determined that the current figure to be annotated is the current figure to be horizontally annotated that can pull a lead horizontally.
[0183] The annotation module 803 is used to perform one of the following: when the optimal lead of the current figure to be annotated can be directly pulled, determine that the current figure to be annotated is the current figure to be horizontally annotated that can pull the lead horizontally, and generate a horizontal straight line annotation result corresponding to the current figure to be annotated based on the optimal lead of the current figure to be annotated; when the optimal lead of the current figure to be annotated cannot be directly pulled and there is remaining space in the view partition to which the current figure to be annotated belongs, determine that the current figure to be annotated is the current figure to be horizontally annotated that can pull the lead horizontally, bend the optimal lead of the current figure to be horizontally annotated, and generate a horizontal broken line annotation result corresponding to the current figure to be horizontally annotated.
[0184] The annotation module 803 is used to perform at least one of the following: when it is determined based on the annotation direction feature of each of the one or more graphics to be annotated that there are one or more graphics to be annotated whose annotation direction feature is horizontal, extract the current graphics to be annotated one by one from the one or more graphics to be annotated whose annotation direction feature is horizontal, and when it is determined that the current graphics to be annotated cannot pull a lead horizontally, use the current graphics to be annotated as a graphic to be annotated vertically; when it is determined based on the annotation direction feature of each of the one or more graphics to be annotated that there are one or more graphics to be annotated whose annotation direction feature is vertical, use each of the one or more graphics to be annotated with the annotation direction feature being vertical as a graphic to be annotated vertically.
[0185] The annotation module 803 is used to group the one or more figures to be vertically annotated based on the projection of each of the one or more figures to be vertically annotated to obtain one or more vertical annotation groups; vertically annotate each figure to be vertically annotated in each of the one or more vertical annotation groups to obtain a vertical annotation result corresponding to each figure to be vertically annotated in each of the vertical annotation groups.
[0186] The annotation module 803 is used to project each of the one or more graphics to be vertically annotated that are not added to the vertical annotation group to obtain the projection of each graphics to be vertically annotated when there is one or more graphics to be vertically annotated that are not added to the vertical annotation group among the one or more graphics to be vertically annotated; determine one or more projection intervals based on the projection of each graphics to be vertically annotated, and determine the number of one or more candidate graphics to be vertically annotated corresponding to each projection interval in the one or more projection intervals; select the projection interval with the largest number of corresponding candidate graphics to be vertically annotated from the one or more projection intervals as the current projection interval; generate a current vertical annotation group based on the one or more candidate graphics to be vertically annotated corresponding to the current projection interval, wherein the current vertical annotation group is one of the one or more vertical annotation groups.
[0187] The annotation module 803 is used to extract the current vertical annotation group from the one or more vertical annotation groups; generate a ray perpendicular to the current projection interval with the midpoint of the current projection interval corresponding to the current vertical annotation group as the starting point; determine the bending direction of the leader of the current vertical annotation group based on the position of the current vertical annotation group in the viewing range, when the lead point of each figure to be vertically annotated in the current vertical annotation group can be determined based on the ray; generate a vertical annotation result corresponding to each figure to be vertically annotated in the current vertical annotation group based on the bending direction of the leader of the current vertical annotation group and the lead point of each figure to be vertically annotated in the current vertical annotation group.
[0188] For the description of specific functions and examples of each module and submodule of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0189] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0190] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0191] Fig. 9A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0192] like Fig. 9 As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0193] Multiple components in the electronic device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the electronic device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0194] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as the annotation method. For example, in some embodiments, the annotation method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the annotation method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the annotation method in any other appropriate manner (e.g., by means of firmware).
[0195] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0196] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0197] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0198] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0199] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0200] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0201] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0202] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A marking method, include: Based on one or more optional annotation directions, the view range is divided into one or more view partitions, wherein the view range is used to display one or more graphics to be annotated, and different view partitions in the one or more view partitions correspond to different optional annotation directions; Based on each of the one or more graphics to be annotated and the one or more view partitions, determining an annotation direction feature of each of the graphics to be annotated; Based on the annotation direction feature of each to-be-annotated figure, generating an annotation result corresponding to each to-be-annotated figure; The step of determining the annotation direction feature of each of the one or more graphics to be annotated and the one or more view partitions includes: Obtaining the area of each overlapping portion of the i-th figure to be annotated and one or more overlapping portions of the one or more view partitions, wherein i is an integer greater than or equal to 1, and the i-th figure to be annotated is one of the one or more figures to be annotated; Calculating an area weighted value corresponding to each overlapping portion based on the area of each overlapping portion and a weight value of a view partition where each overlapping portion is located; A target overlapping portion with a maximum area weighted value is determined from the one or more overlapping portions, and an optional annotation direction corresponding to the view partition where the target overlapping portion is located is used as an annotation direction feature of the i-th graphic to be annotated.
2. The method according to claim 1, in, The generating, based on the annotation direction feature of each of the graphics to be annotated, an annotation result corresponding to each of the graphics to be annotated, comprises at least one of the following: In the case where it is determined that there are one or more graphics to be horizontally annotated that can horizontally draw a leader line based on the annotation direction feature of each of the graphics to be annotated, a horizontal annotation result corresponding to each of the one or more graphics to be horizontally annotated is generated; When it is determined that there are one or more figures to be vertically annotated based on the annotation direction feature of each figure to be annotated, a vertical annotation result corresponding to each figure to be vertically annotated in the one or more figures to be vertically annotated is generated.
3. The method according to claim 2, in, The step of generating a horizontal annotation result corresponding to each of the one or more graphics to be horizontally annotated in a case where it is determined that there are one or more graphics to be horizontally annotated that can horizontally draw a leader line based on the annotation direction feature of each graphics to be horizontally annotated includes: When it is determined that there are one or more graphics to be annotated whose annotation direction features are horizontal among the one or more graphics to be annotated based on the annotation direction features of each of the graphics to be annotated, extracting the current graphics to be annotated from the one or more graphics to be annotated whose annotation direction features are horizontal; When it is determined that the current figure to be annotated is a current figure to be horizontally annotated that can draw a leader line horizontally, a horizontal annotation result corresponding to the current figure to be horizontally annotated is generated.
4. The method according to claim 3, in, In the case where it is determined that the current graphic to be annotated is a current graphic to be horizontally annotated that can horizontally draw a leader, generating a horizontal annotation result corresponding to the current graphic to be horizontally annotated includes one of the following: In the case where the optimal lead line of the current figure to be annotated can be directly pulled, determining that the current figure to be annotated is the current figure to be horizontally annotated that can pull the lead line horizontally, and generating a horizontal straight line annotation result corresponding to the current figure to be annotated based on the optimal lead line of the current figure to be annotated; When the optimal leader of the current figure to be annotated cannot be directly pulled and there is remaining space in the view partition to which the current figure to be annotated belongs, the current figure to be annotated is determined to be the current figure to be horizontally annotated whose leader can be pulled horizontally, the optimal leader of the current figure to be horizontally annotated is bent, and a horizontal broken line annotation result corresponding to the current figure to be horizontally annotated is generated.
5. The method according to claim 2, further comprising at least one of the following: If it is determined based on the annotation direction feature of each of the graphics to be annotated that there are one or more graphics to be annotated whose annotation direction feature is horizontal among the one or more graphics to be annotated, extract the current graphics to be annotated one by one from the one or more graphics to be annotated whose annotation direction feature is horizontal, and if it is determined that the current graphics to be annotated cannot draw a leader horizontally, use the current graphics to be annotated as a graphics to be annotated vertically; When it is determined that there are one or more figures to be annotated whose annotation direction feature is vertical among the one or more figures to be annotated based on the annotation direction feature of each figure to be annotated, each of the one or more figures to be annotated whose annotation direction feature is vertical is taken as a figure to be annotated vertically.
6. The method according to claim 2 or 5, in, The generating of the vertical annotation result corresponding to each of the one or more graphics to be vertically annotated includes: Based on the projection of each of the one or more graphics to be vertically annotated, grouping the one or more graphics to be vertically annotated to obtain one or more vertically annotated groups; Vertically annotate each figure to be vertically annotated in each vertical annotation group of the one or more vertical annotation groups to obtain a vertical annotation result corresponding to each figure to be vertically annotated in each vertical annotation group.
7. The method according to claim 6, in, The step of grouping the one or more graphics to be vertically annotated based on the projection of each of the one or more graphics to be vertically annotated to obtain one or more vertically annotated groups includes: In the case that there is one or more graphics to be vertically marked that are not added to the vertical marking group among the one or more graphics to be vertically marked, projecting each of the one or more graphics to be vertically marked that are not added to the vertical marking group to obtain a projection of each of the graphics to be vertically marked; Based on the projection of each of the graphics to be vertically annotated, determine one or more projection intervals, and determine the number of one or more candidate graphics to be vertically annotated corresponding to each of the one or more projection intervals; Selecting a projection interval with the largest number of corresponding candidate graphics to be vertically annotated from the one or more projection intervals as the current projection interval; A current vertical annotation group is generated based on the one or more candidate graphics to be vertically annotated corresponding to the current projection interval, wherein the current vertical annotation group is one of the one or more vertical annotation groups.
8. The method according to claim 6, in, The step of vertically marking each to-be-vertically-marked graphic in each vertical marking group of the one or more vertical marking groups to obtain a vertical marking result corresponding to each to-be-vertically-marked graphic in each vertical marking group includes: extracting a current vertical annotation group from the one or more vertical annotation groups; Taking the midpoint of the current projection interval corresponding to the current vertical annotation group as the starting point, generating a ray perpendicular to the current projection interval; In the case where the leading point of each to-be-vertically-annotated figure in the current vertical annotation group can be determined based on the ray, determining the bending direction of the leading line of the current vertical annotation group based on the position of the current vertical annotation group in the viewing range; Based on the bending direction of the leader line of the current vertical marking group and the leader point of each figure to be vertically marked in the current vertical marking group, a vertical marking result corresponding to each figure to be vertically marked in the current vertical marking group is generated.
9. A marking device, include: A view partition determination module, used to divide the view range into one or more view partitions based on one or more optional annotation directions, wherein the view range is used to display one or more graphics to be annotated, and different view partitions in the one or more view partitions correspond to different optional annotation directions; A labeling direction feature determination module, configured to determine a labeling direction feature of each of the one or more graphics to be labeled based on each of the one or more graphics to be labeled and the one or more view partitions; A labeling module, used for generating a labeling result corresponding to each of the graphics to be labeled based on the labeling direction characteristics of each of the graphics to be labeled; Among them, the annotation direction feature determination module is specifically used to obtain the area of each overlapping part of the i-th figure to be annotated and one or more overlapping parts of the one or more view partitions, wherein i is an integer greater than or equal to 1, and the i-th figure to be annotated is one of the one or more figures to be annotated; based on the area of each overlapping part and the weight value of the view partition where each overlapping part is located, calculate the area weighted value corresponding to each overlapping part; determine the target overlapping part with the maximum area weighted value from the one or more overlapping parts, and use the optional annotation direction corresponding to the view partition where the target overlapping part is located as the annotation direction feature of the i-th figure to be annotated.
10. The device according to claim 9, in, The annotation module is used to perform at least one of the following: In the case where it is determined that there are one or more graphics to be horizontally annotated that can horizontally draw a leader line based on the annotation direction feature of each of the graphics to be annotated, a horizontal annotation result corresponding to each of the one or more graphics to be horizontally annotated is generated; When it is determined that there are one or more figures to be vertically annotated based on the annotation direction feature of each figure to be annotated, a vertical annotation result corresponding to each figure to be vertically annotated in the one or more figures to be vertically annotated is generated.
11. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
12. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
Citation Information
Patent Citations
Regional information acquisition method and device
CN107221001A
Method for automatically arranging drawing marks, electronic equipment and computer program product
CN114254586A
Image processing method, scene image processing method, traffic image processing method, computing device, computer readable storage medium and computer program product
CN117953443A
Image processing method, apparatus and storage medium
WO2023240444A1
