A CAD graph element intelligent recognition method for a scribing robot

By constructing a spatial index structure and primitive simplification algorithm, the robustness problem of primitive recognition in complex scenarios of line-drawing robots is solved, the primitive retrieval speed and path planning accuracy are improved, and the real-time performance and accuracy of robot views are optimized.

CN120472489BActive Publication Date: 2026-01-02FOSHAN DAOSHAN INTELLIGENT ROBOT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510535761.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2026-01-02
Estimated Expiration
2045-04-27

AI Technical Summary

Technical Problem

In existing technologies, the robustness of marking robots in recognizing CAD primitives in complex deformation or occlusion scenarios is insufficient, leading to misalignment of construction marks and affecting the consumption of construction resources.

Method used

By calculating the local curvature values ​​and the vertex spatial positions of CAD primitives, a spatial data structure is constructed using quadtree partitioning, a spatial index structure is established, and a structured geometric parameter list is generated by combining connected region metrics and primitive convex hull features. Primitive simplification and projection range optimization are then performed to generate primitive data adapted to the robot's view.

Benefits of technology

It improves the speed of complex primitive retrieval and localization, reduces the consumption of redundant computing resources, enhances the physical consistency of primitive sets and the accuracy of path planning, and optimizes the real-time performance and accuracy of robot views.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120472489B_ABST
    Figure CN120472489B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of computer-aided design, in particular to a CAD graph element intelligent recognition method for a scribing robot, which comprises the following steps: based on input CAD graph element vertex coordinate data, the local curvature value of each vertex is calculated and obtained, a spatial data structure is constructed by applying a quadtree division according to the local curvature value and the vertex spatial position coordinates of the CAD graph element, and a spatial index structure including the curvature characteristics and the geometry of the CAD graph element is established. The application dynamically associates the geometry characteristics and the spatial position of the CAD graph element by fusing the local curvature calculation and the quadtree spatial index construction, generates a spatial data structure which takes into account the curvature sensitivity and the area division efficiency, improves the complex graph element retrieval and positioning speed, and reduces the redundant calculation resource consumption. Based on the decomposition mechanism of the connected region measurement value and the area mutation threshold value, and in combination with the absolute value comparison of the area difference of adjacent regions, the fast segmentation of non-uniform geometric bodies is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of computer-aided design, in particular to a CAD graph element intelligent identification method for a scribing robot. BACKGROUND

[0002] The CAD graph element intelligent identification method for the scribing robot is used to solve the limitation that a traditional scribing robot depends on manual analysis of a CAD drawing, and the method generates a scribing path planning scheme by automatically identifying the geometric features and spatial relationship of CAD graph elements, in combination with the kinematic parameters of the robot and the constraints of a construction scene.

[0003] In the prior art, geometric shape matching depends on a single attribute such as the number of vertices or the length ratio of edges, and does not combine multi-dimensional features such as angle distribution for joint determination, so that the classification robustness is insufficient in a complex deformation or occlusion scene, and construction marking misplacement is caused. Meanwhile, projection calculation usually ignores the coupling influence of the camera posture and the spatial curvature of the graph element, and the deviation of the projection range is accumulated to cause the mismatch between the robot view and the theoretical model, so that frequent manual calibration and correction are required, and the construction continuity is reduced. Therefore, improvement is needed. SUMMARY

[0004] The application aims at solving the defects in the prior art and provides a CAD graph element intelligent identification method for a scribing robot.

[0005] In order to achieve the above-mentioned purpose, the application adopts the following technical scheme, a CAD graph element intelligent identification method for a scribing robot, comprising the following steps:

[0006] Based on the input CAD graph element vertex coordinate data, the local curvature value of each vertex is calculated and obtained, and according to the local curvature value and the vertex spatial position coordinates of the CAD graph element, a spatial data structure is constructed by applying a quadtree division, and a spatial index structure including the geometric and curvature features of the CAD graph element is established;

[0007] Based on the spatial index structure, the CAD graph elements to be processed are located and retrieved, the connected region measurement value is calculated, and based on the connected region measurement value, the size relationship between the area change amount of adjacent connected regions and the preset area mutation threshold value is compared, and the decomposed graph element set is obtained;

[0008] Based on each sub-graph element in the decomposed graph element set, the convex hull contour of each sub-graph element is analyzed, the graph element convex hull feature is obtained, the graph element convex hull feature is compared with a predefined geometric shape feature library, the basic geometric shape category to which the sub-graph element belongs is determined, and a structured geometric parameter list is generated;

[0009] Based on the geometric information of each primitive in the structured geometric parameter list and the current view of the ruling robot, the projection range of each primitive in the screen coordinate system is calculated to obtain a screen space error metric value, and based on the screen space error metric value and the primitive curvature information recorded in the spatial index structure, the simplification requirement of the primitive is determined, the vertex of the primitive is simplified, and the primitive data facing the view of the ruling robot is generated.

[0010] Preferably, the obtaining step of the spatial index structure is:

[0011] Based on the input CAD primitive vertex coordinate data, all vertices are traversed, the horizontal and vertical coordinate values of each vertex are extracted, the coordinate difference sum of each vertex and adjacent vertices is calculated, and a set of adjacent vertex coordinate differences is generated;

[0012] According to the set of adjacent vertex coordinate differences, a curvature change threshold is calculated;

[0013] Filtering the vertices with a local curvature value greater than the curvature change threshold, associating with the spatial position coordinates, dividing the quadtree node units and storing the data, and establishing a spatial index structure containing geometric and curvature characteristics.

[0014] Preferably, the obtaining step of the connected region metric value is:

[0015] Based on the spatial index structure, the quadtree node units are traversed, the pixel area value and the region perimeter value of each CAD primitive internal connected region are extracted, and a set of connected region basic parameter sets are generated;

[0016] According to the set of connected region basic parameters, the pixel area value and the region perimeter value of each connected region are standardized to eliminate the dimension difference, and a dimensionless parameter is obtained;

[0017] Based on the standardized dimensionless parameter, the connected region metric value is calculated.

[0018] Preferably, the obtaining step of the decomposed primitive set is:

[0019] Traverse the boundary vertex coordinate set of all connected regions, extract the common boundary vertex coordinate data of adjacent connected regions, combine the distribution range of the connected region metric value, calculate the connected region metric value difference proportion of the two regions in the adjacent connected region pair, and if the connected region metric value difference proportion is greater than or equal to the preset metric fluctuation threshold, it is determined as a potential partition region pair, and a to-be-partitioned region pair list is generated;

[0020] According to the region pair list to be segmented, the connected region metric value and the corresponding pixel area value of each region pair are extracted, the area change absolute value of adjacent region pairs is calculated, the area change absolute value is compared with the preset area mutation threshold value, if the area change absolute value exceeds the preset area mutation threshold value and at the same time the metric value difference proportion condition is met, the region pair is marked as a high mutation region pair, and a high mutation region identification table is generated;

[0021] Based on the high mutation region identification table, geometric segmentation is performed on each high mutation region pair, the common boundary vertex coordinates are extracted and a transition band with a width of 2 pixels is expanded to both sides, the overlapping pixels in the transition band are removed, the independent sub-graph vertex coordinate data after segmentation is reserved, the non-mutation regions and the sub-graph data after segmentation are combined, and a decomposed graph element set is generated.

[0022] Preferably, the step of acquiring the graph convex hull feature comprises the following steps:

[0023] Based on each sub-graph in the decomposed graph element set, the vertex coordinate set of each sub-graph is traversed, the peripheral vertices are screened by using a monotone chain algorithm, the peripheral vertices are connected in a clockwise order to generate a minimum convex polygon, and a convex hull vertex sequence set of the sub-graph is formed;

[0024] According to the convex hull vertex sequence set of the sub-graph, the number of vertices of each convex hull vertex sequence is counted, the Euclidean distance between adjacent vertices is calculated as a convex hull edge length value, and a value set of all edge lengths is recorded, and at the same time, each vertex is traversed, the previous vertex, the current vertex and the next vertex are taken as three consecutive points, the internal angle radian value of the current vertex is calculated, and a vertex angle value set is generated;

[0025] Based on the convex hull vertex number, the edge length value set and the vertex angle value set, the corresponding sub-graph number is integrated and associated, and a graph convex hull feature is generated.

[0026] Preferably, the step of acquiring the structured geometric parameter list comprises the following steps:

[0027] Based on the graph convex hull feature table, the convex hull vertex number, the edge length value set and the vertex angle value set of each sub-graph are traversed, a pre-defined geometric shape feature library is loaded, the vertex number matching rule, the edge length proportion tolerance range and the angle tolerance range of each type of geometric shape in the geometric shape feature library are analyzed, and a geometric shape comparison rule set is generated;

[0028] According to the geometric shape comparison rule set, the convex hull feature data of each sub-graph is matched, if the number of vertices of the current sub-graph is consistent with the vertex number threshold value of a certain type in the feature library, the proportion relationship of all edge length values falls within the edge length proportion tolerance range of the corresponding type, and the vertex angle value meets the angle tolerance range, it is determined that the sub-graph belongs to this type of geometric shape, and a structured geometric parameter list is generated.

[0029] Preferably, the step of obtaining the screen space error metric value is:

[0030] Based on the geometric information of each primitive in the structured geometric parameter list, load the camera parameters of the current view of the scribing robot, traverse the geometric parameters and camera parameters of each primitive, and generate a primitive-view parameter mapping table;

[0031] According to the primitive-view parameter mapping table, perform projection conversion from a three-dimensional coordinate system to a screen coordinate system for each primitive, convert the world coordinates of the primitive into screen pixel coordinates using a pinhole camera model, correct the projection distortion combined with the camera tilt angle, and generate a set of projected vertex coordinates of the primitive in the screen coordinate system;

[0032] Based on the set of projected vertex coordinates of the primitive in the screen coordinate system, calculate the minimum circumscribed rectangle projection range of each primitive, compare the theoretical projection range of the primitive with the detected contour range of the view, and calculate the intersection-over-union of the two coverage areas as the screen space error metric value.

[0033] Preferably, the step of obtaining the primitive data facing the view of the scribing robot is:

[0034] Based on the screen space error metric value and the curvature information of the primitive in the spatial index structure, traverse all the vertices of each primitive, extract the screen space error metric value and curvature information corresponding to the vertices, and generate a vertex-level error-curvature data set;

[0035] According to the vertex-level error-curvature data set, calculate the simplification requirement judgment value of each vertex;

[0036] Based on the simplification requirement judgment value, perform vertex deletion for the vertices whose simplification requirement judgment value is greater than a preset simplification threshold, retain the vertex coordinates that do not meet the threshold, combine the remaining vertices with the original data of the unprocessed primitive, and generate the primitive data facing the view of the scribing robot.

[0037] Compared with the prior art, the application has the advantages and positive effects that:

[0038] This invention integrates local curvature calculation with quadtree spatial indexing to dynamically correlate the geometric features and spatial positions of CAD primitives, generating a spatial data structure that balances curvature sensitivity and region partitioning efficiency. This improves the speed of complex primitive retrieval and positioning while reducing redundant computational resource consumption. Based on a decomposition mechanism using connected region metrics and area mutation thresholds, combined with absolute value comparison of area differences between adjacent regions, it achieves rapid segmentation of non-uniform geometries, reducing missegmentation caused by contour adhesion or noise interference and enhancing the physical consistency of the decomposed primitive set. Through multi-dimensional analysis of the number of vertices, side lengths, and angles of the convex hull features of sub-primitives, and regular comparison with a predefined geometric shape feature library, it improves the accuracy of basic geometric category determination, avoiding misclassification caused by local deformation in traditional single-feature matching. Joint optimization of dynamic projection range calculation and screen space error metrics, combined with a curvature-driven vertex simplification strategy, reduces data redundancy while retaining key geometric features, generating lightweight primitive data that adapts to robot view constraints, optimizing the real-time performance and execution accuracy of path planning. Attached Figure Description

[0039] Figure 1 This is a schematic diagram of the steps of the present invention. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0041] Please see Figure 1 This invention provides a technical solution: an intelligent recognition method for CAD primitives in a line-marking robot, comprising the following steps:

[0042] Based on the input CAD primitive vertex coordinate data, the local curvature value of each vertex is calculated and obtained. According to the local curvature value and the spatial position coordinates of the vertex of the CAD primitive, a quadtree partitioning is applied to construct a spatial data structure and establish a spatial index structure including the geometric and curvature features of the CAD primitive.

[0043] The CAD primitives to be processed are located by retrieving them based on the spatial index structure. The connectivity metric is calculated. Based on the connectivity metric, the relationship between the area change of adjacent connected regions and the preset area mutation threshold is compared to obtain the decomposed primitive set.

[0044] Based on each sub-element in the decomposed primitive set, the convex hull contour of each sub-element is analyzed to obtain the primitive convex hull features. The primitive convex hull features are compared with a predefined geometric shape feature library to determine the basic geometric shape category to which the sub-element belongs and generate a structured geometric parameter list.

[0045] Based on the geometric information of each primitive in the structured geometric parameter list and the current view of the ruling robot, the projection range of each primitive in the screen coordinate system is calculated to obtain a screen space error metric value. Based on the screen space error metric value and the primitive curvature information recorded in the spatial index structure, the simplification requirement of the primitive is determined, the vertex of the primitive is simplified, and the primitive data facing the view of the ruling robot is generated.

[0046] The obtaining step of the spatial index structure is:

[0047] Based on the input CAD primitive vertex coordinate data, all vertices are traversed, the horizontal and vertical coordinate values (x i ,y i ) of each vertex are extracted, the coordinate difference values Δx i =|x i -x i+1 | and Δy i =|y i -y i+1 | of each vertex and adjacent vertices are calculated, and an adjacent vertex coordinate difference set is generated.

[0048] According to the adjacent vertex coordinate difference set, the curvature change threshold is calculated, and the formula is:

[0049]

[0050] Wherein, T is the curvature change threshold, Δx i and Δy i are the horizontal and vertical coordinate difference absolute values of vertex i and adjacent vertices, and n is the total number of vertices.

[0051] The vertices with a local curvature value greater than the curvature change threshold are screened, associated with the spatial position coordinates, divided into quadtree node units and stored in data, and a spatial index structure containing geometric and curvature characteristics is established.

[0052] Specifically, based on the input CAD primitive vertex coordinate data, the data is stored in the form of an ordered list, and each element contains the two-dimensional coordinates (x, y) of the vertex. First, an empty adjacent vertex coordinate difference set is initialized to store the difference pairs calculated subsequently. Then, the vertex traversal program is started, starting from the first vertex i = 1 of the vertex list and sequentially accessing to the last vertex. For the currently processed vertex i, read its horizontal coordinate value x i and vertical coordinate value y i , and access its logically next vertex i + 1 to obtain its coordinates x i+1 and y i+1, and in particular, for the last vertex in the list, its adjacent next vertex is defined as the first vertex in the list to ensure the consistency of the end point handling logic for closed polygons or open paths. After obtaining the coordinates of the current vertex i and its adjacent vertex i+1, perform coordinate difference calculation, specifically calculate the absolute value of the horizontal coordinate difference Δx i = |x i -x i+1 | and the absolute value of the vertical coordinate difference Δy i = |y i -y i+1 | These two calculated non-negative values Δx i and Δy i represent the projection length of the line segment between vertex i and vertex i+1 in the horizontal and vertical directions. Take the calculated difference pair (Δx i , Δy i ) as a data unit and add it to the previously initialized adjacent vertex coordinate difference set. This process continues until all vertices are traversed. For example, given the input vertex sequence {(10, 20), (15, 25), (12, 30)}, when traversing the first vertex (10, 20), the adjacent vertex is (15, 25), Δx1 = |10-15| = 5, Δy1 = |20-25| = 5, (5, 5) is added to the set. When traversing the second vertex (15, 25), the adjacent vertex is (12, 30), Δx2 = |15-12| = 3, Δy2 = |25-30| = 5, (3, 5) is added to the set. When traversing the third vertex (12, 30), the adjacent vertex is considered as the first vertex (10, 20) since it is the last vertex. Δx3 = |12-10| = 2, Δy3 = |30-20| = 10, (2, 10) is added to the set. Finally, all vertices are processed and the complete adjacent vertex coordinate difference set {(5, 5), (3, 5), (2, 10)} is generated.

[0053] Formula: The advantage of the formula is that by calculating the average of the Euclidean distances between all adjacent vertices, it provides a global measure reflecting the average level of line segment length in the CAD primitive. This is used as a reference to distinguish the importance of vertices, i.e., the curvature change threshold T. This threshold T can be adjusted adaptively according to the overall size and complexity of the input primitive, avoiding the problem of inconsistent results on different scale primitives caused by using a fixed threshold.

[0054] n: total number of vertices. This is the number of vertices contained in the input CAD primitive vertex coordinate data. It is obtained by directly counting the number of elements in the input vertex list. For example, a CAD primitive containing 150 vertices, the value of n is 150.

[0055] Δx i : The absolute value of the x-coordinate difference between vertex i and its adjacent vertex i+1. This value is derived from the first component of the generated adjacent vertex coordinate difference set. The specific way to obtain it is: traverse the generated adjacent vertex coordinate difference set {(Δx j ,Δy j )}, and extract the first element Δx j of each data pair. For example, in the example, the adjacent vertex coordinate difference set is {(5,5),(3,5),(2,10)}, then Δx1=5, Δx2=3, Δx3=2.

[0056] Δy i : The absolute value of the y-coordinate difference between vertex i and its adjacent vertex i+1. This value is derived from the second component of the generated adjacent vertex coordinate difference set. The specific way to obtain it is: traverse the generated adjacent vertex coordinate difference set {(Δx j ,Δy j}, and extract the second element Δy j of each data pair. For example, in the example, the adjacent vertex coordinate difference set is {(5,5),(3,5),(2,10)}, then Δy1=5, Δy2=5, Δy3=10.

[0057] Take the obtained adjacent vertex coordinate difference set {(5,5),(3,5),(2,10)} as an example, the total number of vertices n=3. The calculation process is: calculate the distance between each vertex: Calculate the total distance: D=d1+d2+d3≈7.071+5.831+10.198=23.100, and calculate the curvature variation threshold T:

[0058]

[0059] The result shows that: for this example primitive containing 3 vertices, with the vertex coordinate difference set {(5,5),(3,5),(2,10)}, the average distance between adjacent vertices (i.e. the average line segment length) is approximately 7.700 units. This value T≈7.700 will be used as a benchmark threshold for judging the importance of vertices in subsequent steps. This calculated T value will be used to screen vertices, if the local curvature value of a vertex is greater than T, the vertex is considered to represent a more significant geometric feature change, and will be preferentially included in subsequent processing. The size of this T value directly reflects the average length scale of the primitive contour line segment.

[0060] Based on the previously calculated local curvature value of each vertex and the calculated curvature variation threshold T ~ 7.700, the screening process of the vertex is started. The system will traverse all the vertices i of the input CAD primitives. For each vertex, the corresponding local curvature value C i is compared with the curvature variation threshold T. When C i >T, the vertex is determined as a feature significant point and is selected to be retained. If C i ≤T, the vertex is temporarily ignored in this step. After the screening of all vertices is completed, a subset of feature significant points is obtained. Next, these screened feature significant points are associated with their original spatial position coordinates (x i ,y i ) to form a data structure containing vertex coordinates and curvature attributes, such as recording as (x k ,y k ,C k ). Where k is the index of the screened vertex. Subsequently, using these significant vertex data associated with position and feature information, a quadtree spatial data structure is constructed. The construction process of the quadtree starts with a root node that can completely contain all input vertex coordinates (i.e. the minimum bounding box [x k ,x k ] x [y min ,y max ] of all (x min ,y max ) is calculated as the spatial range of the root node). Then, according to the number of significant vertices contained in the node, recursive division is performed. A node capacity threshold N capacity is set, for example, according to experience and analysis of the primitive density in the target scene, N capacity = 4 is set, indicating that each leaf node can accommodate up to 4 significant vertices. At the same time, a minimum node size threshold S min is set, for example, to prevent excessive subdivision leading to excessive tree depth and reduced query efficiency, S min = 1.0 unit length (which can be adjusted according to the unit and precision of the CAD drawing) is set. If the spatial region represented by the current node is greater than S min and the number of significant vertices contained in it N current exceeds N capacity , the spatial range of the node is divided along the midpoint line of the x and y axes to generate four equal-sized child nodes (corresponding to the northwest, northeast, southwest, and southeast quadrants, respectively). The N current significant vertices in the original node are distributed to the corresponding child nodes according to their spatial coordinates (x k ,y k ). This division process is recursively performed until all nodes satisfy N current ≤Ncapacity or node size is not greater than S min These no longer divided nodes become leaf nodes, in the process of division, not only the spatial position coordinates (x k ,y k ) of the salient vertex are stored in the final leaf node to which it belongs, but also the local curvature value C k of the vertex is stored together, so that each leaf node stores 1 to N capacity salient vertices in the space region and their corresponding coordinates and curvature values, and non-leaf nodes store references or pointers to their four child nodes, finally forming a complete quadtree structure.

[0061] The acquisition step of the connected region metric value is:

[0062] Based on the spatial index structure, traverse the quadtree node unit, extract the pixel area value and the region perimeter value of each connected region inside the CAD primitive, and generate a connected region basic parameter set;

[0063] According to the connected region basic parameter set, the pixel area value A j and the region perimeter value L j of each connected region are standardized to eliminate the dimensional difference, and dimensionless parameters and are obtained, wherein max(A) and max(L) are the maximum values of the pixel area value and the perimeter value of all connected regions respectively;

[0064] Based on the standardized dimensionless parameters, the connected region metric value is calculated, and the calculation formula is:

[0065]

[0066] Wherein, M j is the connected region metric value of the jth connected region, is the standardized pixel area value of the jth connected region, is the standardized region perimeter value of the jth connected region.

[0067] Specifically, based on the spatial index structure (quadtree) containing geometry and curvature features constructed in the previous step, to start the traversal process of the structure to identify and analyze the connected regions inside the CAD primitives, first need to rasterize the CAD primitives (such as polygons, curve segments) defined by the vertices in the spatial index structure, project them onto a preset resolution two-dimensional pixel grid, for example, set the grid resolution to 0.1 units of length per pixel, map the boundaries and internal regions of the primitives to a set of pixel collections, traverse all leaf nodes of the quadtree, collect the primitive segment information in the covered area of these nodes, mark these segments on the pixel grid to form a binary image representation of the primitive (the pixel value of the primitive region is 1, and the background is 0), then apply a connected component labeling algorithm (such as a scanning line algorithm or region growing algorithm based on eight or four neighbors) to identify each independent connected region in the binary image, each connected region labeled with a unique label j represents an independent component inside the CAD primitive, after identifying all connected regions, perform parameter extraction calculation on each connected region labeled j, calculate the pixel area value A j Obtained by counting the total number of pixels labeled j, for example, if region j contains 580 pixels, then A j = 580, calculate the region perimeter value L j Then by detecting the boundary pixels of region j and counting the number of boundary pixels or calculating the total length of the boundary chain code, for example, using the method of counting the number of internal pixels adjacent to the background pixels, if region j has 95 pixels adjacent to the background, then L j = 95, pair the pixel area value A j and the region perimeter value L j calculated for each connected region j to form a data pair (A j , L j ), traverse all N connected regions identified, collect all these data pairs, and finally generate the connected region basic parameter set.

[0068] Formula: normalized pixel area value: Normalized region perimeter value: The connected region basic parameter set is {(580, 95), (1200, 150), (350, 80)}. Calculate the maximum value: max(A) = 1200, max(L) = 150, perform normalization calculation for each region: for region j = 1 (A1 = 580, L1 = 95): For region j = 2 (A2 = 1200, L2 = 150): For region j = 3 (A3 = 350, l3 = 80):

[0069] The results show that the original area and perimeter data {(580,95),(1200,150),(350,80)}, after standardization, yielded a dimensionless parameter set {(0.483,0.633),(1.000,1.000),(0.292,0.533)}. These values ​​within the [0,1] interval eliminate the dimensional and scale differences of the original data and can be directly used for subsequent calculations of connected region metrics, making comparisons between different regions and the combination of area and perimeter in the metric formula more reasonable.

[0070] formula: The advantage of the formula is that it constructs a comprehensive consideration of standardized area. and standardized perimeter The connectivity measure M of the differences and their means j .

[0071] Parameter description:

[0072] The standardized pixel area value of the j-th connected region.

[0073] The standardized perimeter value of the j-th connected region.

[0074] Substituting the above parameters into the calculation, the metric values ​​of the three connected regions are M1≈0.017, M2=0, and M3≈0.017, respectively. j The magnitude of the M values ​​reflects a measure of the relationship between the standardized area and perimeter of a region. For example, M2 = 0 because its standardized area and perimeter are exactly equal (both are maximum values, standardized to 1.0). The similar and non-zero values ​​of M1 and M3 indicate that there is a certain difference between the standardized areas and perimeters of these two regions, and this difference, combined with their average size, produces similar metric values. These M values... j The value will serve as the basis for subsequent analysis, used to determine whether there are significant changes in characteristics between regions, and thus decide whether segmentation is necessary. For example, if a metric fluctuation threshold is subsequently set, M... j The magnitude of the difference will directly affect the segmentation decision.

[0075] The steps to obtain the decomposed primitive set are as follows:

[0076] The boundary vertex coordinate set of all connected regions is traversed, the common boundary vertex coordinate data of adjacent connected regions is extracted, the difference proportion of the connected region metric values of the two regions in the adjacent connected region pair is calculated in combination with the distribution range of the connected region metric values, if the difference proportion of the connected region metric values is greater than or equal to a preset metric fluctuation threshold, it is determined as a potential partition region pair, and a to-be-partitioned region pair list is generated;

[0077] According to the to-be-partitioned region pair list, the connected region metric values and the corresponding pixel area values of each region pair are extracted, the absolute value of the area change amount of the adjacent region pair is calculated, the absolute value of the area change amount is compared with a preset area mutation threshold, if the absolute value of the area change amount exceeds the preset area mutation threshold and at the same time the metric value difference proportion condition is met, the region pair is marked as a high mutation region pair, and a high mutation region identification table is generated;

[0078] Based on the high mutation region identification table, geometric partition is performed on each high mutation region pair, the common boundary vertex coordinates are extracted and a transition band with a width of 2 pixels is expanded to both sides, the overlapping pixels in the transition band are removed, the independent sub-mesh vertex coordinate data after partition is reserved, the non-mutation regions and the sub-mesh data after partition are combined, and a decomposed mesh set is generated.

[0079] Specifically, according to the boundary vertex coordinate set of all connected regions j (j = 1,..., N) and the corresponding connected region metric values M j obtained in the previous step, the process of identifying potential partition boundaries is started, first, it is necessary to determine which connected regions are adjacent in space, by analyzing the pixel adjacency relationship of each connected region in the raster representation, an adjacency graph is constructed, where the nodes represent the connected regions, and the edges represent the shared boundary pixels of two regions, for each region pair (j, k) connected by an edge in the graph, the common boundary vertex coordinate data shared by them is extracted, these data can be directly obtained from the boundary pixels of the raster image, or accurately obtained by matching the points in the original CAD vertex that fall on the shared boundary, at the same time, the connected region metric values M j and M k of regions j and k are called, the difference proportion R jk of the two adjacent region metric values is calculated, which is used to quantify the relative difference of the two regions in shape characteristics, the calculation formula is where |M j -M k | is the absolute difference of the metric values, max(M j , M k ) is the larger value of the two, plus a small positive number ∈ (for example, 1 × 10 -6 ) is to prevent division by zero error when M j and M k are both zero, the difference proportion Rjk Compared with the preset measurement fluctuation threshold T metric_波动 For comparison, the setting of this threshold needs to be based on statistical analysis of the proportion of differences in the measurement values ​​of adjacent areas in a large number of different types of CAD drawings. Sample data covering various industrial parts and architectural layout drawings should be collected, and the R-value of all adjacent area pairs should be calculated. jk The values ​​are plotted, and their distribution histograms are analyzed to determine a threshold that can distinguish between normal fluctuations and significant characteristic changes. For example, the threshold can be set as the 85th percentile of the distribution, or as the mean plus 1.5 times the standard deviation. The specific calculation process is as follows: From 200 sample CAD drawings containing at least 10 connected regions, the R-values ​​of 5000 adjacent region pairs are calculated. jk Values, calculate the mean μ of these values. R =0.22 and standard deviation σ R =0.10, set T metric_波动 =μ R +1.5σ R =0.22 + 1.5 × 0.10 = 0.37, if the calculated difference ratio R for a certain region (j,k) is... jk Greater than or equal to 0.37, i.e., R jk If the value is ≥0.37, then a significant difference in shape characteristics is considered to exist between the two regions. The region pair (j,k) is marked as a potential segmentation region pair, and all region pairs that meet the condition are collected to generate a list of regions to be segmented.

[0080] Based on the generated list of regions to be segmented, the system further filters out high-abrupt region pairs that require geometric segmentation. The system processes each potential region pair (j,k) in the list one by one. For the current region pair (j,k), the system first extracts the corresponding pixel area value A from the previously stored set of basic parameters of connected regions. j and A k Then, the absolute change in area ΔA between the two adjacent regions is calculated. jk =|A j -A k This value directly reflects the degree of difference in size between two adjacent regions, and the absolute value of the calculated area change ΔA is used. jk Compared with the preset area mutation threshold T area_突变A numerical comparison is made to determine what degree of area change is considered a significant mutation, which should be set in conjunction with the specific application scenario and the general scale of the CAD graph elements. For example, when processing mechanical part graphs, the area difference between main components and fasteners or small features can be large, while when processing architectural floor plans, the area difference between rooms and walls, furniture has certain regularity. By analyzing 50 typical CAD drawings in the target application field, the area difference ΔA between adjacent regions with clear functional boundaries or structural boundaries is counted jk It is found that more than 80% of the area difference at these key boundaries exceeds 800 pixels (at a certain rasterization resolution), while the area difference between adjacent regions within the region due to noise or fine structure is usually less than 300 pixels. Therefore, T area_突变 = 800 pixels can be set as an empirical benchmark to distinguish between structural area changes and non-structural area changes, and the judgment condition is set as: if the absolute value of the area change of a region pair (j, k) ΔA jk exceeds the preset area mutation threshold T area_突变 (i.e. ΔA jk > 800), and the region pair (j, k) itself exists in the list of regions to be segmented, then the region pair (j, k) that satisfies both conditions is finally confirmed as a high mutation region pair. All such confirmed region pairs are recorded to form a high mutation region identification table.

[0081] Based on the generated high mutation region identification table, a geometric segmentation operation is performed to refine the primitive structure. The program iterates through each high mutation region pair (j, k) in the identification table. For each boundary that needs to be segmented, the program first accurately extracts the sequence of common boundary vertex coordinates or common boundary pixels between region j and region k. These coordinates or pixels define the interface where the two regions contact. Then, based on these common boundary points, the program expands a fixed width into the interior of region j and region k respectively to form a transition zone. According to the text description, the expansion width is 2 pixels, which means extending 2 pixels from the common boundary into the interior of region j and also extending 2 pixels into the interior of region k. All pixels falling within this 4-pixel wide belt are identified as transition zone pixels. Then, a pixel removal operation is performed to remove all identified transition zone pixels from their original pixel sets in connected regions j and k. The purpose of this step is to create a clear geometric gap between the originally adjacent two regions and eliminate boundary ambiguity or overlap that may be caused by rasterization or original data precision issues. After the pixel removal, the original regions j and k are transformed into two or more (if the original region is segmented into multiple pieces) new, separate sub-regions j' and k'. The vertex coordinate data of these independent sub-primitives formed after segmentation is retained. This is done by recalculating the boundary contour of the modified pixel sets j' and k' and extracting the vertex coordinates on the contour. All contour pixels can be selected as vertices, or a contour simplification algorithm (such as the Douglas-Peucker algorithm) can be applied to obtain a more compact vertex representation. Finally, the vertex coordinate data of all new sub-primitives generated by segmentation is merged with the vertex coordinate data of the original connected regions (i.e. non-mutation regions) that did not participate in any segmentation process. All these data are combined to form the final decomposed primitive set for downstream processing steps.

[0082] The acquisition step of the primitive convex hull feature is:

[0083] Based on each sub-primitive in the decomposed primitive set, the program iterates through the vertex coordinate set of each sub-primitive and uses the monotone chain algorithm to select the peripheral vertices. The peripheral vertices are connected in clockwise order to generate the minimum convex polygon, forming the convex hull vertex sequence set of the sub-primitive.

[0084] According to the convex hull vertex sequence set of the sub-primitive, the program counts the number of vertices in each convex hull vertex sequence, calculates the Euclidean distance between adjacent vertices as the convex hull edge length value, and records the value set of all edge lengths. Meanwhile, the program iterates through each vertex to calculate the interior angle radian value of the current vertex using the previous vertex, the current vertex, and the next vertex as consecutive three points, generating the vertex angle value set.

[0085] Based on the convex hull vertex number, the edge length value set, and the vertex angle value set, the program integrates and associates the corresponding sub-primitive number to generate the primitive convex hull feature.

[0086] Specifically, based on the generated set of decomposed primitives, which contains several independent sub-primitives, each sub-primitive consists of a set of vertex coordinates {P1, P2, ..., P...} m The system defines a set of sub-primitives and begins by calculating their minimum convex hull. It then iterates through each sub-primitive in this set, extracting its corresponding vertex coordinate set {(x1,y1),(x2,y2),...,(x...}. m ,y m The monotonic chain algorithm is used to determine the sequence of vertices that constitute the convex hull of the vertex set. This algorithm first sorts all input vertices in ascending order by their x-coordinates; if the x-coordinates are the same, it sorts them in ascending order by their y-coordinates, resulting in an ordered vertex list P′1, P′2, ..., P′. m Next, two empty lists are initialized to store the upper convex hull vertex (upper_hull) and the lower convex hull vertex (lower_hull), respectively. When constructing the lower convex hull, the sorted vertex list P′1 to P′ is traversed in order. m For the current vertex P′ i Check the lower_hull list; if lower_hull contains at least two vertices, and is composed of the second-to-last vertex, the last vertex, and the current vertex P′ of lower_hull. i If the resulting sequence does not constitute a "left turn" (or is collinear), the last vertex is removed from lower_hull. This turn determination is done by calculating the triangular cross product. For example, let the last two vertices of lower_hull be V. L-2 and V L-1 The current point is P′ i Calculate the cross product C = (V L-1 .xV L-2 .x)(P′ i .yV L-2 .y)-(V L-1 .yV L-2 .y)(P′ i .xV L- 2.x), if C≤0, it indicates a non-left turn (for constructing a counterclockwise convex hull), remove V. L-1 Repeat this check until the left turn condition is met or there are fewer than two vertices in lower_hull, then turn the current vertex P′. i Add to the end of lower_hull. When constructing the upper convex hull, the sorted vertex list P′ is traversed in reverse order. mFor P′1, the same logic is used, but the operation object is the upper_hull list. After completing two traversals, the lower_hull list (removing the last vertex because it is a duplicate of the first vertex of the upper_hull) is concatenated with the upper_hull list (removing the last vertex because it is a duplicate of the first vertex of the lower_hull). The result is the convex hull vertices arranged in counterclockwise order. Finally, this vertex sequence is reversed to obtain the convex hull vertex sequence arranged in clockwise order. This sequence is the minimum convex polygon vertex representation of this sub-primitive. This process is repeated for all sub-primitives in the decomposed primitive set, eventually forming a set containing the clockwise convex hull vertex sequence of each sub-primitive.

[0087] Based on the set of convex hull vertex sequences of the formed sub-primitives, the geometric feature parameters of each convex hull are further extracted. The system traverses each convex hull vertex sequence in the set, where each sequence represents the convex hull of a sub-primitive, in the form {V1, V2, ..., V...}. k}, where V i =(x i ,y i Furthermore, the vertices are arranged in clockwise order. For the current convex hull vertex sequence being processed, first count the number of vertices it contains, denoted as N. hull =k, this quantity itself is a basic indicator describing the complexity of the convex hull. Next, calculate the side length of the convex hull, and traverse each vertex V in the sequence. i (From i=1 to k), calculate its relationship with its next vertex V. i+1 The Euclidean distance between them (where V) k+1 Defined as V1), the calculation formula is: Where V i =(x i ,y i And V i+1 =(x i+1 ,y i+1 ), and calculate all the side lengths l1, l2, ..., l k Collect these values ​​to form a set of side lengths for the convex hull. This set records the lengths of each line segment that constitutes the contour of the convex hull. Then, calculate the interior angles of the convex hull and iterate through each vertex V in the sequence again. i (From i=1 to k), consider starting from the previous vertex V i-1 (where V0 is defined as V) k ), Current vertex V i and the next vertex V i+1 (where V) k+1 Defined as the angle formed by V1), calculate from V i Vector pointing to the previous vertex and from V i vector pointing to the next vertex The angle θ between the two vectors is calculated using the dot product i (i.e. the internal angle at vertex V i ), ensuring that the calculated angle θ i is an internal angle (for convex polygons, all internal angles should be less than π radians) and storing the angle value in radians, all the calculated internal angles θ1, θ2,..., θ k are collected to form the vertex angle value set of the convex hull, after all the parameters of the current convex hull vertex sequence are calculated, the next sequence is processed until all the convex hulls of the sub-meshes are processed.

[0088] Based on the convex hull vertex number N hull , the edge length value set {l1,..., l k} and the vertex angle value set {θ1,..., θ k} calculated for each sub-mesh convex hull, the final integration and structured processing is carried out, the system creates a data record for each sub-mesh in the decomposed mesh set, which will contain all the previously calculated convex hull feature parameters, specifically, the sub-mesh number ID s is taken as the primary key or identifier of the record, then the corresponding convex hull vertex number N hull,s is stored in the record, then the value set of all the edge lengths of the convex hull {l 1,s ,..., l k,s} is organized into a list or array in clockwise order and stored in the record, similarly, the value set of all the vertex internal angles of the convex hull {θ 1,s ,..., θ k,s} is also organized into a list or array in clockwise order (corresponding to the vertices and edges) and stored in the same record, for example, for the sub-mesh numbered s = 5, if its convex hull is a rectangle with 4 vertices, edge lengths of 8.0, 6.0, 8.0, 6.0, and internal angles of 1.5708 radians (about 90°), the number of each sub-mesh is associated with the corresponding convex hull vertex number, the ordered edge length list, and the ordered angle list, and is stored, and finally all the structured records of the sub-meshes are collected to form a complete mesh convex hull feature data set, which systematically describes the key geometric properties of the external contour (approximated by the convex hull) of each sub-mesh, providing a quantitative basis for subsequent shape recognition and classification.

[0089] The structured geometric parameter list acquisition steps are:

[0090] Based on the convex hull feature table of the graph element, the number of convex hull vertices, the edge length value set and the vertex angle value set of each sub-graph element are traversed, a pre-defined geometric shape feature library is loaded, the vertex number matching rule, the edge length proportion tolerance range and the angle tolerance range of each type of geometric shape in the geometric shape feature library are analyzed, and a geometric shape comparison rule set is generated;

[0091] According to the geometric shape comparison rule set, the convex hull feature data of the sub-graph element is matched one by one. If the number of vertices of the current sub-graph element is consistent with the vertex number threshold of a certain category in the feature library, and the proportional relationship of all edge length values falls within the edge length proportion tolerance range of the corresponding category, and the vertex angle value meets the angle tolerance range, it is determined that the sub-graph element belongs to this geometric shape category, and a structured geometric parameter list is generated.

[0092] Specifically, based on the generated convex hull feature table of the graph element, the table contains the number of convex hull vertices N hull,s , the edge length value set {l i,s} and the vertex angle value set {θ i,s} arranged in clockwise order corresponding to each sub-graph element s, the sub-graph element geometric shape recognition process is started. First, a pre-constructed geometric shape feature library needs to be loaded. This library is a structured data storage (for example, a JSON file or a database table), which defines various basic geometric shape categories that the system needs to recognize and their ideal features. This library needs to be established by domain experts or by analyzing common standard graphics (such as rectangles, squares, circles (approximated by regular polygons), equilateral triangles, isosceles triangles, regular hexagons, etc.) in the target CAD drawing. The library stores the matching rules for each geometric shape category (for example, “Rectangle”), which includes: vertex number matching rule (for example, “Rectangle” requires N expected =4), edge length proportion relationship and tolerance range (for example, “Rectangle” requires that the relative edge length proportions are close to 1, i.e. l 1,s / l 3,s and l 2,s / l 4,s should be within the range of [1-T len_ratio ,1+T len_ratio ], where T len_ratio is the edge length proportion tolerance; “EquilateralTriangle” requires that all edge length proportions are close to 1, i.e. l 1,s / l 2,s and l 2,s / l 3,s are within the same tolerance range), and angle requirement and tolerance range (for example, “Rectangle” requires that all internal angles are close to π / 2 radians, i.e. θ i,s should be within the range of [π / 2-T angle, π / 2 + T angle ] range;

[0093] "EquilateralTriangle" requires all internal angles to be close to [π / 3 radians, i.e. θ i,s should be in the range of [π / 3 - T angle , π / 3 + T angle , where T angle is the angle tolerance), the tolerance parameters T len_ratio and T angle are set according to the evaluation of the noise, precision error and approximation error introduced by the convex hull calculation itself in the actual CAD data, by testing 100 sample CAD files containing known standard shapes (but possibly with minor deviations) and observing the deviation of the convex hull features from the ideal values, a suitable tolerance value is selected, for example, set the side length ratio tolerance T len_ratio = 0.05, allowing a 5% floating of the side length ratio, set the angle tolerance T angle = 0.05 radians (about 2.86 degrees), allowing the angle to deviate within this range, after the system loads this feature library, it analyzes the vertex number rule, side length ratio rule, angle rule of each geometric shape category and the corresponding tolerances T len_ratio and T angle , organizes and stores these information as data structures in memory, forming a complete set of geometric shape comparison rules, for subsequent matching process.

[0094] According to the generated geometric shape comparison rule set, the system starts to match the sub-graphics convex hull feature data in the graphics convex hull feature table one by one, for each sub-graphics record s in the table (containing its convex hull vertex number N hull,s , side length value set {l i,s} and vertex angle value set {θ i,s}), try to match with each geometric shape category (such as "Rectangle", "EquilateralTriangle", etc.) defined in the geometric shape comparison rule set in order, the matching process follows a strict condition checking process, first, check the vertex number consistency, compare the convex hull vertex number N hull,s of the sub-graphics with the vertex number N expected required by the current shape category to be matched, if N hull,s ≠ N expected , then this sub-graphics cannot belong to this category, immediately stop matching this category and try the next category, if the vertex number is consistent, then enter the side length ratio check, according to the side length ratio rule of the current shape category (for example, "Rectangle" requires l 1,s / l 3,s ≈ 1 and l 2,sI 4,s The actual proportions of the relevant edge lengths of the convex hull of the subgraph element are calculated, and it is determined whether the proportions fall within the allowable range defined by the edge length proportion tolerance T len_ratio (0.05, for example), that is, it is checked whether |l 1,s I 3,s |≤ 0.05 and |l 2,s I 4,s |≤ 0.05 are simultaneously satisfied, if any one of the proportion checks fails, the matching of this category is stopped, the next category is tried, if the edge length proportions also meet the requirements, finally the angle check is performed, according to the angle rule of the current shape category (for example, “Rectangle” requires all angles θ i,s ≈π / 2), it is checked whether all the convex hull vertex angles θ i,s of the subgraph element fall within the allowable range defined by the angle tolerance T angle (0.05 radian, for example), that is, it is checked whether |θ i,s -π / 2|≤ 0.05 is satisfied for all i, if any one of the angles does not meet the requirements, the matching is stopped, the next category is tried, only when the convex hull features of a subgraph element simultaneously satisfy all the matching rules of the vertex number, edge length proportion and angle of a certain geometric shape category (all within the tolerance range), the system determines that the subgraph element belongs to this geometric shape category, and records the classification result (for example, the subgraph element ID s is classified as “Rectangle”), and extracts the key geometric parameters of the shape (such as the center point coordinates, width, height, rotation angle of the rectangle, which can be calculated from the convex hull vertices and edge lengths), organizes the subgraph element ID s , the recognized shape category and the extracted key geometric parameters into a record, after the matching and classification of all subgraph elements are completed, all successfully classified subgraph element records are collected, and finally a structured geometric parameter list is generated.

[0095] The obtaining step of the screen space error metric value is:

[0096] Based on the geometric information of each graph element in the structured geometric parameter list, the camera parameters of the current view of the ruling robot are loaded, and the geometric parameters of each graph element and the camera parameters are traversed to generate a graph element-view parameter mapping table;

[0097] According to the graph element-view parameter mapping table, the projection conversion from the three-dimensional coordinate system to the screen coordinate system is performed for each graph element, the world coordinates of the graph element are converted into screen pixel coordinates using a pinhole camera model, the projection distortion is corrected combined with the tilt angle of the camera, and a projection vertex coordinate set of the graph element in the screen coordinate system is generated;

[0098] Based on the projection vertex coordinate set of the graphics primitive in the screen coordinate system, the minimum circumscribed rectangle projection range of each graphics primitive is calculated, and the intersection over union of the theoretical projection range of the graphics primitive and the contour range detected by the view is calculated as the screen space error measurement value.

[0099] Specifically, based on the generated structured geometric parameter list, each record contains the identification ID of a sub-graphics primitive s , the identified geometric shape category (such as "Rectangle") and its key geometric parameters (for example, the center point in the world coordinate system, the vertex list {P w,i}, size, etc.), the mapping of the graphics primitive to the screen space is prepared, which first needs to load the camera parameters in the current working state of the marking robot. These parameters are usually stored in the configuration file of the robot system or obtained through real-time sensor data. Specifically, they include: camera intrinsic parameters (Intrinsic Parameters), such as focal length (f x ,f y , usually in pixels), principal point coordinates (c x ,c y , which is the position of the image optical center in the pixel coordinate system), which are obtained through offline camera calibration; camera extrinsic parameters (Extrinsic Parameters), which are the pose of the camera relative to the world coordinate system (usually aligned with the CAD model coordinate system), represented by a rotation matrix R (3x3) and a translation vector t (3x1), which are provided by the robot's positioning system (such as SLAM, GPS / IMU combined navigation, etc.) in real time or calibrated in a fixed installation scenario; and camera distortion parameters (DistortionCoefficients), including radial distortion coefficients (such as k1, k2, k3) and tangential distortion coefficients (such as p1, p2), which are also obtained through offline calibration and used to correct the nonlinear distortion introduced by the lens imaging. After loading the current camera intrinsic, extrinsic and distortion parameters, the system iterates through each graphics primitive record in the structured geometric parameter list, extracts the geometric information of the graphics primitive, especially its vertex coordinates P w,i =(X w,i ,Y w,i ,Z w,i ) in the world coordinate system (for 2D CAD graphics primitives, it is usually assumed to be located on a known plane, for example, Z w=0 plane, or assigned a specific depth according to the scene), pair and associate these world coordinate vertex information of each primitive with the same set of camera parameters (intrinsic parameters, extrinsic parameters, distortion coefficients) that were just loaded, forming the data input pairs required for subsequent projection calculations. This series of paired data conceptually constitutes a primitive-view parameter mapping table, laying the foundation for the next step of performing coordinate transformation on each primitive.

[0100] Based on the established mapping relationship between primitive geometric information and camera parameters, the system processes each primitive sequentially, performing a projection transformation from the 3D world coordinate system to the 2D screen pixel coordinate system. For the currently processed primitive s, it obtains all its world coordinate vertices P. w,i =(X w,i ,Y w,i Z w,i And the corresponding camera parameters (rotation matrix R, translation vector t, intrinsic parameter matrix K, distortion coefficients k1, k2, k3, p1, p2). First, convert the world coordinates to camera coordinates, and for each vertex P... w,i Applying rigid body transformation: P c,i =R·P w,i +t, to obtain the coordinates P in the camera coordinate system. c,i =(X c,i ,Y c,i Z c,i ), where Z c,i The depth of the point in front of the camera is represented by the pinhole camera model. Then, an ideal projection is performed, projecting the camera coordinates onto the normalized image plane to obtain distortion-free normalized coordinates (x′). i ,y′i)=(X c,i / Z c,i ,Y c,i / Z c,i Then, considering and correcting lens distortion, the normalized coordinates are adjusted using the applied distortion coefficients, and the square of the distortion radius is calculated. The corrected normalized coordinates (x″) are calculated using a distortion model (e.g., the Brown-Conrady model). i ,y″ i Finally, the distortion-corrected normalized coordinates (x″) are... i ,y″ i The camera intrinsic parameter matrix is ​​used to convert the coordinates into the final screen pixel coordinates (u). i ,v i Repeat this projection and distortion correction process for all vertices of the primitive to obtain the coordinates of all projected vertices of the primitive in the screen coordinate system under the current camera view. After processing all primitives, summarize these results to generate a complete set of projected vertex coordinates of the primitive in the screen coordinate system.

[0101] Based on the generated projection vertex coordinates of the primitives in the screen coordinate system, the screen space error metric value of each primitive s is calculated. First, the minimum bounding rectangle of the projection vertex set of each primitive is calculated, usually using the axis-aligned bounding box. The minimum and maximum u coordinate values (u min,s ,u max,s ) and the minimum and maximum v coordinate values (v min,s ,v max,s ) in the projection vertex set are determined, and the rectangular area defined by [u min,s ,v min,s ,u max,s ,v max,s ] represents the theoretical projection range B theoretical,s of the primitive calculated according to the CAD model and camera parameters. Next, the detected contour range B detected,s of the primitive in the actual camera view needs to be obtained. This information is obtained by processing the real-time camera image of the marking robot, such as extracting the object contour in the image by image segmentation or edge detection algorithm (such as Canny edge detection), and then using contour matching or target tracking algorithm to associate the detected contour with the current processed CAD primitive s (this association process is the premise of this step, assuming it has been completed). For the successfully associated detected contour, the minimum bounding rectangle is also calculated to obtain the view-detected contour range. Then, the spatial overlap between the theoretical projection range and the view-detected contour range is calculated, and the intersection over union (IoU) is used as the metric indicator. The calculated IoU s value is the screen space error metric value of the primitive s. The higher the value, the more consistent the theoretical projection and the actual detection, and the smaller the error.

[0102] The steps for obtaining the primitive data facing the view of the marking robot are as follows:

[0103] Based on the screen space error metric value and the curvature information of the primitives in the spatial index structure, all vertices of each primitive are traversed to extract the screen space error metric value and curvature information corresponding to the vertices, and a vertex-level error-curvature data set is generated;

[0104] According to the vertex-level error-curvature data set, the simplification requirement judgment value of each vertex is calculated, and the calculation formula is:

[0105]

[0106] Where Q c is the simplification requirement judgment value of the cth vertex, E c is the screen space error metric value of the cth vertex, and C c is the curvature information of the cth vertex recorded in the spatial index structure.

[0107] Based on the simplified requirement judgment value, vertices with simplified requirement judgment values ​​greater than the preset simplified threshold are deleted, while the coordinates of vertices that do not meet the threshold are retained. The remaining vertices are merged with the original data of unprocessed primitives to generate primitive data for the line drawing robot view.

[0108] Specifically, the screen space error metric IoU is calculated for each primitive s. s And the local curvature information C of each original CAD vertex c is constructed and stored. c The system uses a spatial index structure to begin preparing vertex-level simplification information. It needs to associate each vertex of each primitive participating in simplification with its corresponding error and curvature information. It iterates through these selected primitives s, then iterates through all original vertices c belonging to that primitive s. For the current vertex c, it performs information extraction and association operations, extracting the screen space error metric (IoU) of the primitive s to which vertex c belongs. s Since this metric applies to the entire primitive, the screen space error metric for all vertices belonging to that primitive is set to the same value. To make this value represent "error" rather than "fit," a transformation is performed, defining the screen space error E of vertex c. c =1-IoU s Therefore, E c The value of E is in the range of [0,1]. c The larger the value, the greater the difference between the theoretical projection of the primitive and the actual detection (higher error). c A smaller value indicates a smaller difference (lower error). Simultaneously, the local curvature information C, precisely associated with the current vertex c, is queried and extracted from the spatial index structure. c The C c The value is calculated in the initial stage of the method and quantifies the local geometric complexity or drastic change at vertex c. It is assumed that C... c The values ​​have been normalized before storage, and their range is mapped to the [0,1] interval. Larger values ​​indicate higher curvature (more significant geometric features). The extracted vertex error E... c and vertex curvature C c Pair them up to form a data tuple (E c C c Repeat this operation for all vertices of primitive s, and then continue processing the next selected primitive until all relevant vertices have obtained their corresponding (E) values. c C c Data pairs are aggregated to form a complete vertex-level error-curvature dataset, providing input for subsequent calculations of simplified requirement-based values ​​for each vertex.

[0109] formula: The advantage of the formula is that it incorporates the screen space error E of the vertex. c and its geometric curvature C c Calculate a simplified demand determination value Q. c This formula guides the vertex simplification process for view adaptation. It is designed to identify vertices that contribute little to the current view but may increase rendering overhead or cause visual clutter.

[0110] Parameter description:

[0111] E c The screen space error metric for the c-th vertex. For example, if the IoU of primitive s... s =0.2, then the E of all its vertices c =1-0.2=0.8.

[0112] C c : The curvature information of the c-th vertex recorded in the spatial index structure. This value is the local curvature value associated with vertex c, calculated and stored in the spatial index structure (such as a quadtree) in previous steps. For example, by querying the spatial index structure, the normalized curvature value of vertex c is found to be C. c =0.7.

[0113] Substituting the parameters into the formula, the simplified requirement value Q of the first vertex c is obtained. c ≈0.509, the simplified requirement judgment value Q of the second vertex c′ c′ =0.01. A higher Q c A value (such as 0.509) indicates that the vertex has a high simplification requirement because it is geometrically relatively important (C). c =0.7) but the corresponding graphic element has a large error in the current view (E c =0.8). Lower Q c′ A value (such as 0.01) indicates that the vertex has low simplification requirements because it is geometrically unimportant (C). c′ =0.1) and its constituent elements match the view well (E c′ =0.1). These Q c The value will be used to compare with a simplified threshold to determine which vertices are ultimately deleted.

[0114] Based on the simplified requirement determination value Q of each vertex obtained through calculation c To perform the final vertex simplification operation, a preset simplification threshold T must first be set. simplify This threshold determines which vertices will be considered redundant and removed; the threshold T simplify The settings should balance simplification and information fidelity, and be determined based on application requirements and experimental results. For example, Q can be calculated using data from a series of representative scenarios.c The value distribution is analyzed, a suitable percentile is selected as the threshold, or the threshold is iteratively optimized by adjusting the threshold and observing the display effect of the simplified primitives in the robot view (whether key features are lost, whether the number of vertices is significantly reduced), and a specific method for setting the threshold is as follows: collect Q c values (a total of 50,000 vertices), draw the cumulative distribution function (CDF) of Q c values, and select Q c value corresponding to the CDF value of 0.80 as the threshold, which means that 80% of the vertices Q c values below this threshold will be retained, and 20% above this threshold will be deleted. If the calculated value is 0.35, set T simplify = 0.35, after setting the threshold, the system traverses all the vertices c for which Q c values are calculated, compares Q c with T simplify , if Q c > 0.35, marks the vertex as to be deleted, if Q c ≤ 0.35, retains the original coordinates of the vertex, after completing the determination of all vertices, performs the vertex deletion operation, for the vertices marked as to be deleted, removes them from the vertex list of the primitive they belong to, and needs to update the topological connection relationship of the primitive synchronously, for example, if a vertex of a polygon is deleted, needs to connect the two adjacent vertices before and after it directly to form a new edge (needs to check whether the new edge will cause self-intersection and process it), retains the coordinates of all vertices that are not deleted to form the vertex set of the simplified primitive, at the same time, also needs to consider those primitives that do not participate in the simplification process (for example, primitives that are not detected or marked as not needing to be simplified during the calculation of the screen space error), retains the original vertex coordinate data of these untreated primitives intact, finally, merges the vertex coordinate data (from the simplified primitives) remaining after the vertex deletion and topological adjustment with the original vertex coordinate data of the untreated primitives, and the integrated data constitutes the final primitive data set that is adaptively simplified for the current robot view.

[0115] The above is only a preferred embodiment of the present application, and does not limit the present application in other forms. Any skilled person in the art can modify or change the above disclosed technical content to equivalent embodiments applied to other fields, but any simple modification, equivalent change and modification made according to the technical essence of the present application to the above embodiments within the technical solution content of the present application still falls within the protection scope of the present application.

Claims

1. A method for intelligent recognition of CAD primitives for line marking robots, characterized in that, Includes the following steps: Based on the input CAD primitive vertex coordinate data, the local curvature value of each vertex is calculated and obtained. According to the local curvature value and the spatial position coordinates of the vertex of the CAD primitive, a quadtree partitioning is applied to construct a spatial data structure and establish a spatial index structure including the geometric and curvature features of the CAD primitive. Based on the spatial index structure, the CAD primitives to be processed are retrieved and located, the connectivity region metric is calculated, and based on the connectivity region metric, the relationship between the area change of adjacent connected regions and the preset area mutation threshold is compared to obtain the decomposed primitive set. Based on each sub-element in the decomposed primitive set, the convex hull contour of each sub-element is analyzed to obtain the primitive convex hull feature. The primitive convex hull feature is compared with a predefined geometric shape feature library to determine the basic geometric shape category to which the sub-element belongs and to generate a structured geometric parameter list. Based on the geometric information of each primitive in the structured geometric parameter list and the current view of the line-drawing robot, the projection range of each primitive in the screen coordinate system is calculated to obtain the screen space error metric. Based on the screen space error metric and the primitive curvature information recorded in the spatial index structure, the simplification requirements of the primitive are determined, the primitive is simplified at the vertex, and primitive data for the line-drawing robot view is generated. The primitive convex hull features include the number of convex hull vertices, the set of side length values, and the set of vertex angle values. The steps for obtaining the screen space error metric are as follows: Based on the geometric information of each primitive in the structured geometric parameter list, the camera parameters of the current view of the line drawing robot are loaded, and the geometric parameters and camera parameters of each primitive are traversed to generate a primitive-view parameter mapping table. According to the primitive-view parameter mapping table, the projection transformation from the three-dimensional coordinate system to the screen coordinate system is performed on each primitive. The world coordinates of the primitive are converted into screen pixel coordinates using the pinhole camera model. The projection distortion is corrected by combining the camera tilt angle, and a set of projection vertex coordinates of the primitive in the screen coordinate system is generated. Based on the set of projection vertex coordinates of primitives in the screen coordinate system, the minimum bounding rectangle projection range of each primitive is calculated. The theoretical projection range of the primitive is compared with the contour range detected by the view, and the intersection-union ratio of the two covered areas is calculated as a screen space error metric. The formula for calculating the connected region metric is as follows: ; in, For the first Connectivity metric of each connected region For the first The standardized pixel area value of each connected region For the first The standardized perimeter value of a connected region.

2. The intelligent recognition method for CAD primitives for marking robots according to claim 1, characterized in that, The steps for obtaining the spatial index structure are as follows: Based on the input CAD primitive vertex coordinate data, traverse all vertices, extract the horizontal and vertical coordinate values ​​of each vertex, calculate the coordinate difference between each vertex and its adjacent vertices, and generate a set of coordinate differences between adjacent vertices. Calculate the curvature change threshold based on the set of coordinate differences between adjacent vertices; Vertices whose local curvature values ​​are greater than the curvature change threshold are selected, associated with spatial coordinates, divided into quadtree node units and stored in the data, and a spatial index structure containing geometric and curvature features is established.

3. The intelligent recognition method for CAD primitives for marking robots according to claim 1, characterized in that, The steps for obtaining the connected region metric are as follows: Based on the spatial index structure, the quadtree node units are traversed to extract the pixel area value and perimeter value of the connected region inside each CAD primitive, and a set of basic parameters of the connected region is generated. Based on the set of basic parameters of the connected regions, the pixel area value and the perimeter value of each connected region are standardized to eliminate the difference in dimensions and obtain dimensionless parameters. Based on the standardized dimensionless parameters, the connectivity metric is calculated.

4. The intelligent recognition method for CAD primitives for marking robots according to claim 1, characterized in that, The steps for obtaining the decomposed primitive set are as follows: Traverse the set of boundary vertex coordinates of all connected regions, extract the common boundary vertex coordinate data of adjacent connected regions, and calculate the ratio of the difference in connected region metric values ​​between the two regions in the adjacent connected region pair based on the distribution range of the connected region metric values. If the ratio of the difference in connected region metric values ​​is greater than or equal to the preset metric fluctuation threshold, it is determined to be a potential region pair to be segmented, and a list of regions to be segmented is generated. According to the list of regions to be segmented, extract the connectivity metric value and the corresponding pixel area value of each region pair, calculate the absolute value of the area change of adjacent region pairs, compare the absolute value of the area change with the preset area mutation threshold, if the absolute value of the area change exceeds the preset area mutation threshold and the metric value difference ratio condition is met at the same time, mark the region pair as a high mutation region pair and generate a high mutation region identifier table. Based on the high mutation region identifier table, each high mutation region pair is geometrically segmented, the coordinates of the common boundary vertex are extracted, and a transition band with a width of 2 pixels is extended to both sides. Overlapping pixels in the transition band are removed, and the vertex coordinate data of the segmented independent sub-primitives are retained. The non-mutation region and the segmented sub-primitive data are combined to generate a decomposed primitive set.

5. The intelligent recognition method for CAD primitives for line marking robots according to claim 1, characterized in that, The steps for obtaining the convex hull feature of the primitive are as follows: Based on each sub-element in the decomposed primitive set, the vertex coordinate set of each sub-element is traversed, the outer vertices are filtered using the monotonic chain algorithm, and the outer vertices are connected in clockwise order to generate the smallest convex polygon, forming a set of convex hull vertex sequences of the sub-element. Based on the set of convex hull vertex sequences of the sub-primitive, count the number of vertices in each convex hull vertex sequence, calculate the Euclidean distance between adjacent vertices as the convex hull edge length value, record the set of all edge length values, and simultaneously traverse each vertex, taking the previous vertex, the current vertex, and the next vertex as three consecutive points, calculate the interior angle radian value of the current vertex, and generate a set of vertex angle values. Based on the number of vertices, the set of side length values, and the set of vertex angle values ​​of the convex hull, the corresponding sub-primitive numbers are integrated and associated to generate the convex hull feature of the primitive.

6. The intelligent recognition method for CAD primitives for line marking robots according to claim 1, characterized in that, The steps for obtaining the structured geometry parameter list are as follows: Based on the convex hull features of the primitives, the number of convex hull vertices, the set of side length values, and the set of vertex angle values ​​of each sub-primitive are traversed. A predefined geometric shape feature library is loaded, and the vertex number matching rules, side length ratio tolerance range, and angle tolerance range of each type of geometric shape in the geometric shape feature library are parsed to generate a set of geometric shape comparison rules. According to the set of geometric shape comparison rules, the convex hull feature data of each sub-element is matched one by one. If the number of vertices of the current sub-element is consistent with the threshold of the number of vertices of a certain category in the feature library, and the ratio of all side length values ​​falls within the tolerance range of the side length ratio of the corresponding category, and the vertex angle values ​​meet the tolerance range of the angle, then the sub-element is determined to belong to this type of geometric shape category, and a structured geometric parameter list is generated.

7. The intelligent recognition method for CAD primitives for marking robots according to claim 1, characterized in that, The steps for obtaining the graph data of the line-drawing robot view are as follows: Based on the screen space error metric and the primitive curvature information in the spatial index structure, all vertices of each primitive are traversed, and the screen space error metric and curvature information corresponding to the vertex are extracted to generate a vertex-level error-curvature data set. Based on the vertex-level error-curvature data set, calculate the simplified requirement judgment value for each vertex; Based on the simplified requirement judgment value, vertex deletion is performed on vertices whose simplified requirement judgment value is greater than the preset simplified threshold, the coordinates of vertices that do not meet the threshold are retained, the remaining vertices are merged with the original data of unprocessed primitives, and primitive data for the line drawing robot view is generated.

Citation Information

Patent Citations

  • Method for generating three-dimensional building GLTF file based on index compression

    CN119313847A

  • Tumor partition recognition method and system based on multi-scale image analysis

    CN119478564A