A face feature label placement method considering label shape and size

Through the polylabel+ algorithm, the placement position of surface feature labels is optimized to consider the shape and size of the labels, and the problem of visual inconsistency in the existing technology is solved, and an efficient and coordinated label placement effect is achieved.

CN118967878BActive Publication Date: 2025-04-11COMMUNICATION UNIVERSITY OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410953490.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2025-04-11
Estimated Expiration
2044-07-16

AI Technical Summary

Technical Problem

The prior art is difficult to effectively consider the shape and size of the label when placing the surface feature label, resulting in visual inconsistency, especially when the label has a large aspect ratio.

Method used

A polylabel+ algorithm is proposed to efficiently approximate the defined ideal position by constructing priority queues and dynamic spatial filtering, and optimize the placement position of the labels considering the shape and size of the labels.

Benefits of technology

A more coordinated visual effect is achieved. The boundaries of the label are far away from the boundaries of the target polygon, and the calculation is efficient. It can be calculated in the millisecond level, with an average time of 15.6 milliseconds, and the global optimality can be approached with any accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118967878B_ABST
    Figure CN118967878B_ABST
Patent Text Reader

Abstract

The present invention provides a method for placing face feature labels considering the shape and size of labels, belonging to the field of data processing technology, and specifically comprising: step 1: the algorithm model constructs a plurality of squares that can cover the target polygon with the short side of the bounding box of the target polygon as the side length, and presses them into a priority queue, the priority queue records the squares to be checked, and ranks the squares in descending order of the potential upper limit, and checks the squares in the queue in sequence; step 2: when the potential upper limit of the square is not lower than the sum of the best score and the precision of the best square, the square is divided down by one layer to obtain four sub-squares, and they are added to the queue, and the above process is repeated until the queue is empty, and the center of the final best square is the ideal position under the defined precision. The present invention can approximate the global optimum with arbitrary precision, can efficiently approximate the defined ideal position with arbitrary precision, and place the text label of a given shape and size at the ideal visual position.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of data processing, and in particular relates to a surface feature label placement method taking into account the label shape and size. Background Art

[0002] In the field of visualization, adding text labels to static images is a common way to supplement semantic information for visualization. For example, on a map, the name of a country is placed within the national territory, and on a human body structure diagram, the name of an organ is placed around the corresponding organ. However, when the labeled object consists of a single or multiple discrete closed polygons, the problem is called the face feature label placement problem. The core goal of this type of problem is to ensure that the label is visually harmonious with the labeled polygon. However, visual harmony does not have a unified and clear definition. It generally means that the label is at the visual center of the target polygon and as far away from the polygon boundary as possible.

[0003] To achieve this goal, researchers have defined different ideal label positions and proposed a variety of solutions. The two most common methods are the maximum subpolygon method and the maximum inscribed circle method: when there are internal holes in the polygon, the maximum subpolygon method may cause the label to be placed inside the hole, thereby reducing readability. The maximum inscribed circle method treats the label as a particle, ignoring the impact of the label's own shape and size on the visual effect. When the label has a large aspect ratio, this type of method often leads to visual disharmony.

[0004] In order to overcome the shortcomings of the above two methods, the present invention defines a new ideal position that takes into account the shape and size of the label itself, and designs and implements the polylabel+ algorithm inspired by the polylabel algorithm. The algorithm modifies the spatial filtering conditions and can efficiently approximate the defined ideal position with arbitrary precision, and in 77.2% of cases, the label placement results of the polylabel+ algorithm are better than those of the polylabel algorithm. The modified spatial filtering conditions can be mathematically proven. Specifically, the present invention provides a method for placing face feature labels that takes into account the shape and size of the label. Summary of the invention

[0005] The object of the present invention is to provide a method for placing face feature labels taking into account the shape and size of the labels.

[0006] In order to solve the above technical problems, the present invention provides a method for placing surface feature labels taking into account the shape and size of the labels, which is characterized by specifically comprising:

[0007] Taking the length and width of the label, the target polygon and the accuracy of the algorithm model as the basis, a priority queue of the label is newly created;

[0008] The algorithm model constructs multiple squares that can cover the target polygon with the short side of the bounding box of the target polygon as the side length, and pushes them into a priority queue. The priority queue records the squares that need to be checked and ranks them in descending order of the potential upper limit of the squares. The squares in the queue are checked in turn. When the score of the central node of the square is greater than the current best score, the best square is updated and updated to the current square.

[0009] Determine whether the potential upper limit of the grid is lower than the sum of the best score and the precision of the best grid. If so, discard the grid. If not, divide the grid downward by one layer to obtain four sub-grids, and add them to the queue.

[0010] The above process is repeated until the queue is empty, and finally the center of the best square is the ideal position under the defined accuracy.

[0011] The present invention can approximate the global optimum with arbitrary precision, can efficiently approximate the defined ideal position with arbitrary precision, and can place a text label of a given shape and size at a visually ideal position.

[0012] The beneficial effects of the present invention are specifically described as follows:

[0013] 1. Efficient calculation: First, based on quadtree space division and dynamic space filtering, the present invention can quickly exclude a large number of areas that will not produce global optimal solutions, which greatly reduces the number of inspections required; second, the present invention uses the priority queue as the data structure, and each time the area that is most likely to obtain the global optimal solution in theory is popped up, which can refresh the current optimal value at the fastest speed and promote rapid convergence; finally, the center of mass of the polygon is used as the initial position, and a solution close to the global optimal solution is often obtained in the early stage of the algorithm, which speeds up spatial filtering. Experiments on a test data set consisting of 300 regional boundaries show that the present invention can complete the calculation in milliseconds, with an average time consumption of 15.6 milliseconds.

[0014] 2. Simple parameters, can approach the global optimum with arbitrary precision: The polylabel+ algorithm of the present invention has only one parameter - precision, which controls the theoretical upper limit of the deviation between the final position and the global optimal position. The lower the value, the closer the result is to the global optimum.

[0015] 3. More coordinated visual effects: Since the ideal placement position takes into account the size and outline of the label, the polylabel+ method proposed in the present invention can keep the label boundary away from the boundary of the target polygon in more cases. In a quantitative evaluation of a test data set consisting of 300 region boundaries with 10 volunteers, the polylabel+ algorithm of the present invention achieved subjectively better visual effects at 77.2% of the region boundaries.

[0016] A further technical solution is that the target polygon is a target on which a label needs to be placed.

[0017] A further technical solution is that the potential upper limit of the square is determined according to the score of the central node of the square and the side length of the square.

[0018] A further technical solution is that the score of the central node of the square is determined according to the minimum value of the distances from the four vertices of the rectangular label of the square to the polygon.

[0019] A further technical solution is to divide the grid downwards by one layer to obtain four sub-grids, specifically including:

[0020] Based on the side length of the square, the side lengths of the sub-squares are determined according to the number of divisions being 4;

[0021] The square is divided downward one layer according to the division side length and the division number to obtain four sub-squares.

[0022] A further technical solution is that the preset number is determined according to the side length of the square and the current number of divisions of the square, wherein the longer the side length of the square and the fewer the current number of divisions of the square, the greater the preset number.

[0023] Other features and advantages will be described in the following description, and partly become apparent from the description, or understood by practicing the invention. The purpose and other advantages of the invention are realized and obtained by the structures particularly pointed out in the description and the drawings.

[0024] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The above and other features and advantages of the present invention will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.

[0026] Figure 1 is a flow chart of a method for face feature label placement that takes label shape and size into account.

[0027] Figure 2 It is a flow chart of the method for determining the side length of a square.

[0028] Figure 3 This is a schematic diagram of the visual incongruity of the polylabel algorithm.

[0029] Figure 4 is a schematic diagram of the new definition of the ideal position of the label.

[0030] Figure 5 It is the flow chart of polylabel+ algorithm.

[0031] Figure 6 It is a schematic diagram of the iterative partitioning process.

[0032] Figure 7 It is a schematic diagram that proves the upper limit of the grid's potential.

[0033] Figure 8 It is an example diagram of the division of the present invention. DETAILED DESCRIPTION

[0034] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the present invention will be comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their detailed description will be omitted.

[0035] The terms "a", "an", "the", and "said" are used to indicate the presence of one or more elements / components / etc.; the terms "comprising" and "having" are used to express an open-ended inclusive meaning and mean that additional elements / components / etc. may be present in addition to the listed elements / components / etc.

[0036] In the field of visualization, adding text labels to static images is a common way to supplement semantic information for visualization. For example, on a map, the name of a country is placed within the national territory, and on a human body structure diagram, the name of an organ is placed around the corresponding organ. When the labeled object consists of a single or multiple discrete closed polygons, the problem is called the face feature label placement problem. The core goal of this type of problem is to ensure that the label is visually harmonious with the labeled polygon. However, visual harmony does not have a unified and clear definition. It generally means that the label is at the visual center of the target polygon and as far away from the polygon boundary as possible.

[0037] To achieve this goal, researchers have defined different ideal label positions and proposed a variety of solutions. The two most common methods are the maximum subpolygon method and the maximum inscribed circle method:

[0038] The goal of the maximum sub-polygon method is to find the largest convex and hole-free sub-polygon of the target polygon or polygon group and place the label at the centroid of the sub-polygon. This method ensures that the label does not exceed the boundary of the polygon and can adapt to the situation of polygon groups. Kang and Elhami provide an implementation using the internal buffer function of GIS. However, when there are internal holes in the polygon, this method may cause the label to be placed inside the hole, thereby reducing readability.

[0039] The goal of the maximum inscribed circle method is to find the maximum inscribed circle of the target polygon and place the label at the center of the circle. Garcia et al. proposed a general Monte Carlo iterative solution for finding the maximum inscribed circle. This method has a large number of candidate points to check, resulting in excessive computation and falling into local optimality. Agafonkin et al. proposed the polylabel algorithm, which can efficiently approximate the center of the maximum inscribed circle with arbitrary precision by introducing spatial filtering. However, like all maximum inscribed circle methods, this algorithm treats the label as a particle and ignores the influence of the shape and size of the label itself on the visual effect. Figure 3 As shown, such methods often lead to visual disharmony when the label has a large aspect ratio.

[0040] The present invention provides a new definition of the ideal position by taking the shape of the label itself into consideration. Figure 4 The center of the label is point i, and the four corners of the label rectangular bounding box are point i a 、i b 、i c 、i d 、dist p represents the distance from any point p to the boundary, that is, the distance between point p and the nearest edge. Then the ideal position t defined and pursued by the present invention is as follows:

[0041]

[0042] That is, the ideal position is the point within the polygon where the minimum distance between the four corners of the label bounding box and the polygon reaches the maximum value.

[0043] In order to solve the above technical problems, Figure 1 As shown, the present invention provides a method for placing surface feature labels taking into account the shape and size of the labels, which is characterized by specifically comprising:

[0044] S1, taking the length and width of the label, the target polygon and the accuracy of the algorithm model as the basis, and creating a priority queue of the label;

[0045] Furthermore, the target polygon is a target on which a label needs to be placed.

[0046] The algorithm first defines a function Cell, which is used to construct a square with a side length of 2h and calculate the score dist of the square at its center (x, y) min And the potential limit of the grid The dist function in the function is used to calculate the distance between a point and a polygon.

[0047] S2. The algorithm model constructs multiple squares that can cover the target polygon with the short side of the bounding box of the target polygon as the side length, and pushes them into a priority queue. The priority queue records the squares that need to be checked and ranks them in descending order of the potential upper limit of the squares. The squares in the queue are checked in turn. When the score of the central node of the square is greater than the current best score, the best square is updated and updated to the current square.

[0048] Specifically, the side length of the square is determined according to the number of bounding boxes of the target polygon and the lengths of different bounding boxes, wherein the more the number of bounding boxes of the target polygon is and the shorter the lengths of different bounding boxes are, the shorter the side length of the square is.

[0049] Specifically, Figure 2 As shown, the method for determining the side length of the square is:

[0050] Determining the recommended side length of the grid by the number of bounding boxes of the target polygon;

[0051] Dividing the bounding box of the target polygon into a plurality of length intervals according to the length of the bounding box, and determining the side length compensation amount of the different length intervals according to the number of bounding boxes in the different length intervals and the length of the bounding boxes;

[0052] The side length of the square is determined based on the side length compensation amounts of different length intervals and the recommended side lengths.

[0053] Further, determining the side length of the grid based on the side length compensation amounts of different length intervals and the recommended side lengths specifically includes:

[0054] Determine a comprehensive side length compensation amount based on side length compensation amounts of different length intervals and basic weight values ​​of different length intervals;

[0055] The side length of the square is determined according to the comprehensive side length compensation amount and the recommended side length.

[0056] In another possible embodiment, the method for determining the side length of the square is:

[0057] Obtain the number of bounding boxes of the target polygon, and determine whether the number of bounding boxes of the target polygon is less than a preset number. If so, proceed to the next step; if not, proceed to step

[0058] Determine whether there is an enclosing frame whose length is less than the preset length according to the length of the enclosing frame, if so, proceed to the next step, if not, determine the side length of the square based on the preset length;

[0059] The bounding boxes whose length is less than the preset length are used as screening bounding boxes, and it is determined whether the number of the screening bounding boxes is greater than the preset number. If so, the side length of the square is determined based on the second preset length. If not, proceed to the next step.

[0060] Determine the difficulty of screening and labeling the target polygon by the number of screening bounding boxes and the lengths of different screening bounding boxes, and judge whether the screening and labeling difficulty meets the requirement; if so, determine the side length of the square based on the preset length; if not, proceed to the next step;

[0061] The bounding box of the target polygon is divided into multiple length intervals according to the length of the bounding box, and the side length compensation amount of different length intervals is determined according to the number of bounding boxes in different length intervals and the length of the bounding boxes. The side length of the square is determined based on the side length compensation amount of different length intervals and the recommended side length.

[0062] Specifically, the algorithm constructs several squares that can cover the polygon with the short side of the polygon bounding box as the side length, and pushes them into a priority queue. These squares are the initial squares of the top layer. The priority queue records the squares that need to be checked and ranks them in descending order of the potential upper limit of the squares. In this way, the squares popped out of the queue each time are the areas that are most likely to obtain the global optimal solution in theory. The best cell bestCell is initially placed at the center of mass of the polygon. At this point, the algorithm is initialized.

[0063] S3, determining whether the potential upper limit of the square is lower than the sum of the best score and the precision of the best square, if so, discarding the square, if not, dividing the square downward by one layer to obtain four sub-squares, and adding them to the queue;

[0064] Furthermore, the potential upper limit of the square is determined according to the score of the central node of the square and the side length of the square.

[0065] Specifically, the score of the central node of the square is determined according to the minimum value of the distances from the four vertices of the rectangular label of the square to the polygon.

[0066] It should be noted that the square is divided down one layer to obtain four sub-squares, specifically including:

[0067] Based on the side length of the square, the side lengths of the sub-squares are determined according to the number of divisions being 4;

[0068] The square is divided downward one layer according to the division side length and the division number to obtain four sub-squares.

[0069] Furthermore, the sub-squares are divided using a preset number, wherein the preset number is determined based on the side length of the square and the current number of divisions of the square, wherein the longer the side length of the square and the fewer the current number of divisions of the square, the greater the preset number.

[0070] Specifically, the method for determining the preset number is:

[0071] The sum of the best score and the accuracy of the current best solution is used as the basic score, and the number of basic divisions of the current grid is determined according to the deviation between the potential upper limit of the grid and the basic score;

[0072] Determine the corrected number of basic divisions of the square by using the side length of the square and the current number of divisions of the square;

[0073] The preset number is determined based on the basic division number of the grid and the revised number of the basic division number.

[0074] In another possible embodiment, the method for determining the preset number is:

[0075] S31 takes the sum of the best score and the accuracy of the current best solution as the basic score, and determines whether the deviation between the potential upper limit of the grid and the basic score is greater than a preset deviation threshold, if so, determines the preset number based on the deviation between the potential upper limit of the grid and the basic score, if not, proceeds to the next step;

[0076] S32 determines the basic number of divisions of the current grid by the deviation between the potential upper limit of the grid and the basic score, and judges whether the side length of the grid is greater than the preset side length. If so, proceed to step S34; if not, proceed to the next step;

[0077] S33: obtaining the current number of divisions of the grid, and determining whether the current number of divisions of the grid is less than a preset number; if so, determining the preset number based on the current basic number of divisions of the grid; if not, proceeding to the next step;

[0078] S34 determines the revised number of basic divisions of the square according to the side length of the square and the current number of divisions of the square, and determines the preset number based on the basic division number of the square and the revised number of basic divisions.

[0079] S4, looping the above process until the queue is empty, and finally the center of the best square is the ideal position under the defined accuracy.

[0080] Specific examples, such as Figure 5Shown is the flow chart of the polylabel+ algorithm.

[0081] Ⅰ. The algorithm first defines a function Cell, which is used to construct a square with a side length of 2h and calculate the score dist obtained by the square at its center (x, y) min And the potential limit of the grid The dist function in the function is used to calculate the distance between a point and a polygon.

[0082] Ⅱ. The algorithm constructs several squares that can cover the polygon with the short side of the polygon bounding box as the side length, and pushes them into a priority queue. These squares are the initial squares of the top layer. The priority queue records the squares that need to be checked and ranks them in descending order of the potential upper limit of the squares. In this way, the squares popped out from the queue each time are the areas that are most likely to obtain the global optimal solution in theory. The best cell bestCell is initially placed at the center of mass of the polygon. At this point, the algorithm is initialized.

[0083] Ⅲ. Then check the cells in the queue one by one. If the dist of the popped cell min Exceeds the current best score recorded in bestCell max , then update bestCell to cell.

[0084] IV. If the potential upper limit of the cell is lower than the sum of the best score and precision of bestCell, then the cell cannot contain the global optimal solution and it is discarded. Otherwise, the cell may contain the global optimal solution, so it is divided down one layer to get four sub-squares and added to the queue.

[0085] V. Repeat the above process until the queue is empty, and finally the center of bestCell is the ideal position under the defined accuracy.

[0086] The core of the polylabel+ algorithm lies in the iterative spatial partitioning and dynamic spatial filtering based on the spatial quadtree. Quadtree is a tree-like data structure that recursively divides the space into four quadrants, thereby achieving efficient organization and retrieval of the space. In the process of label placement, through the iterative partitioning of the spatial quadtree, the space can be gradually subdivided according to the level, so that effective label placement operations can be performed in each sub-area. The dynamic spatial filtering technology is to be able to adjust the spatial partitioning and filtering strategies in time according to the dynamic changes of labels and areas in order to obtain the ideal position.

[0087] Regarding dynamic spatial filtering, the present invention expands the object of the grid potential upper limit from a single point to any shape, so that the idea of ​​dynamic spatial filtering conditions can be used to solve the ideal position of the present invention. Taking a rectangular label as an example, the expanded grid potential upper limit, the proof of the upper limit, and the specific dynamic spatial filtering conditions are given below.

[0088] The potential upper limit of the grid refers to the theoretical upper limit of the possible solutions for all points in the grid. This idea can quickly filter a large number of areas, and the only point that needs to be checked in each grid area is the center of the grid, so the calculation efficiency is very high. In the process of iterative segmentation of space, the filtering conditions are gradually stringent, and the search space is always global, so the algorithm can not only guarantee convergence to the global optimum, but also guarantee that the convergence is monotonic. This method effectively utilizes the information inside the grid, and quickly filters out a large number of areas by calculating the potential upper limit of the grid at the center point of each grid, thereby achieving efficient calculation in the process of iterative segmentation of space. At the same time, the search space of this method is global, which can guarantee convergence to the global optimum, and the convergence process is monotonic, which is conducive to improving the stability and accuracy of the algorithm. Figure 6 A grid showing the division of the iterative process.

[0089] The objects facing the grid potential upper limit are expanded from a single point to any shape. Figure 7 Given a polygon and a square with a side length of 2h at any position, the center of the square is point c. Let the minimum distance from the four vertices of the rectangular label centered at point i to the polygon be Then for any point i in the grid, There is an upper limit This upper limit is called the potential upper limit of the grid.

[0090] The following is a mathematical proof of the existence of the potential upper limit. Figure 6 Let the center c of the square with a side length of 2h obtain the shortest distance dist from the polygon on the side l. c , point i is any point in the grid, and its distance to edge l is dis i→l , then for any i, the following formula 2 holds:

[0091]

[0092] This means that there is an upper limit on the distance from any point in the grid to the target polygon. This upper limit is the upper limit of the grid potential in the polylabel algorithm.

[0093] When the label center is aligned with point c, the four vertices are c a 、c b 、c c 、c d, when aligned with point i, the four vertices are i a 、i b 、i c 、i d Then, with c a and i a Take this pair of points as an example, point c a With point i a The distance between point c and point i is equal to the distance between point c and point i, which is less than Therefore, a In c a In a square with a center and a side length of 2h. Furthermore, from Formula 2, we can see that the following Formula 3 holds:

[0094]

[0095] x can be a, b, c, d. Therefore,

[0096]

[0097] x can be a, b, c, or d.

[0098]

[0099] Therefore, the value of any point i in the grid There is a unified upper limit The proof is complete.

[0100] The dynamic space filtering condition is that in the process of spatial iterative division, for the square whose center is point c and whose side length is 2h, if its square potential upper limit Less than the optimal solution cur obtained at this moment max , then there cannot be a global optimal solution in this square, so skip this square and do not continue to divide it downward.

[0101] Obviously, the above upper limit definition, proof of the upper limit and filtering conditions can be directly extended to labels with any number of vertices, that is, they are applicable to labels of any shape.

[0102] Based on the above embodiments, the following technical effects are achieved:

[0103] 1. Efficient calculation: First, based on quadtree space division and dynamic space filtering, the present invention can quickly exclude a large number of areas that will not produce global optimal solutions, which greatly reduces the number of inspections required; second, the present invention uses the priority queue as the data structure, and each time the area that is most likely to obtain the global optimal solution in theory is popped up, which can refresh the current optimal value at the fastest speed and promote rapid convergence; finally, the center of mass of the polygon is used as the initial position, and a solution close to the global optimal solution is often obtained in the early stage of the algorithm, which speeds up spatial filtering. Experiments on a test data set consisting of 300 regional boundaries show that the present invention can complete the calculation in milliseconds, with an average time consumption of 15.6 milliseconds.

[0104] 2. Simple parameters, can approach the global optimum with arbitrary precision: The polylabel+ algorithm of the present invention has only one parameter - precision, which controls the theoretical upper limit of the deviation between the final position and the global optimal position. The lower the value, the closer the result is to the global optimum.

[0105] 3. More coordinated visual effects: Since the ideal placement position takes into account the size and outline of the label, the polylabel+ method proposed in this invention can keep the label boundary away from the boundary of the target polygon in more cases. In a quantitative evaluation of a test data set consisting of 300 region boundaries with 10 volunteers, the polylabel+ algorithm of this invention achieved subjectively better visual effects at 77.2% of the region boundaries. Figure 8 This is an example diagram of the division of the present invention.

[0106] In the description of this specification, the description of the terms "one embodiment", "a preferred embodiment", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0107] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for placing face feature labels taking into account the shape and size of the labels, characterized in that: Specifically include: Taking the length and width of the label, the target polygon and the accuracy of the algorithm model as the basis, a priority queue of the label is newly created; The algorithm model constructs multiple squares that can cover the target polygon with the short side of the bounding box of the target polygon as the side length, and pushes them into a priority queue. The priority queue records the squares that need to be checked and ranks them in descending order of the potential upper limit of the squares. The squares in the queue are checked in turn. When the score of the central node of the square is greater than the current best score, the best square is updated and updated to the current square. Determine whether the potential upper limit of the grid is lower than the sum of the best score and the precision of the best grid. If so, discard the grid. If not, divide the grid downward by one layer to obtain four sub-grids, and add them to the queue. The above process is repeated until the queue is empty, and finally the center of the optimal square is the ideal position under the defined accuracy; The score of the central node of the square is determined according to the minimum value of the distances from the four vertices of the rectangular label of the square to the polygon; The potential upper limit of the square is determined according to the score of the central node of the square and the side length of the square; The method for determining the side length of the square is: Determining the recommended side length of the grid by the number of bounding boxes of the target polygon; Dividing the bounding box of the target polygon into a plurality of length intervals according to the length of the bounding box, and determining the side length compensation amount of the different length intervals according to the number of bounding boxes in the different length intervals and the length of the bounding boxes; The side length of the square is determined based on the side length compensation amounts of different length intervals and the recommended side lengths.

2. A method for placing face feature labels taking into account label shape and size as claimed in claim 1, characterized in that: The target polygon is a target on which a label needs to be placed.

3. A method for placing face feature labels taking into account label shape and size as claimed in claim 1, characterized in that: The side length of the square is determined according to the number of bounding boxes of the target polygon and the lengths of different bounding boxes, wherein the more the number of bounding boxes of the target polygon is and the shorter the lengths of different bounding boxes are, the shorter the side length of the square is.

4. A method for placing face feature labels taking into account label shape and size as claimed in claim 1, characterized in that: The side length of the grid is determined based on the side length compensation amounts of different length intervals and the recommended side lengths, specifically including: Determine a comprehensive side length compensation amount based on side length compensation amounts of different length intervals and basic weight values ​​of different length intervals; The side length of the square is determined according to the comprehensive side length compensation amount and the recommended side length.

5. A method for placing face feature labels taking into account label shape and size as claimed in claim 1, characterized in that: The square is divided down one layer to obtain four sub-squares, including: Based on the side length of the square, the side lengths of the sub-squares are determined according to the number of divisions being 4; The square is divided downward one layer according to the division side length and the division number to obtain four sub-squares.

Citation Information

Patent Citations

  • Identifying a visual center of a polygon

    US20190012571A1