Intelligent CAD (computer-aided design) primitive recognition method for scribing robot

Through the integration of local curvature calculation and quadtree spatial index, lightweight metadata adapted to robot views is constructed, which solves the recognition robustness problem of traditional scribe robots in complex scenarios, and improves the recognition speed and path planning accuracy.

CN120472489AActive Publication Date: 2025-08-12FOSHAN DAOSHAN INTELLIGENT ROBOT CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

Traditional scribe robots have insufficient robustness in complex deformation or occlusion scenarios, and require frequent manual calibration, resulting in reduced construction coherence.

Method used

Through the fusion of local curvature calculation and quadtree spatial index, a spatial data structure is constructed, and the connection area metric value and area mutation threshold decomposition mechanism is combined to achieve rapid segmentation of non-uniform geometry, and compared with the predefined geometric shape feature library to generate lightweight metadata adapted to the robot view.

Benefits of technology

It improves the speed of complex element retrieval and positioning, reduces the consumption of redundant computing resources, enhances the accuracy of basic geometric category judgment, and optimizes the real-time and execution accuracy of path planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120472489A_ABST
    Figure CN120472489A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer aided design, in particular to a lineation robot-oriented CAD primitive intelligent identification method, which comprises the following steps of: based on input CAD primitive vertex coordinate data, calculating to obtain a local curvature value of each vertex, and according to the local curvature value and a vertex spatial position coordinate of a CAD primitive, calculating the local curvature value of each vertex; a spatial data structure is constructed by applying quadtree division, and a spatial index structure including CAD primitive geometry and curvature features is established. According to the method, through fusion construction of local curvature calculation and quadtree spatial indexes, geometric features of CAD primitives are dynamically associated with spatial positions, a spatial data structure considering curvature sensitivity and region division efficiency is generated, the complex primitive retrieval and positioning speed is increased, and redundant computing resource consumption is reduced. And on the basis of a decomposition mechanism of a connected region metric value and an area mutation threshold value, combining absolute value comparison of area difference of adjacent regions to realize rapid segmentation of the non-uniform geometry.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer-aided design, and in particular to a CAD primitive intelligent recognition method for a marking robot. Background Art

[0002] The purpose of the intelligent CAD primitive recognition method for marking robots is to overcome the limitation of traditional marking robots relying on manual analysis of CAD drawings. By automatically identifying the geometric features and spatial relationships of CAD primitives, combining the robot's kinematic parameters with construction scene constraints, a marking path planning solution is generated.

[0003] Existing techniques rely on single attributes, such as the number of vertices or side length ratio, without integrating multi-dimensional features like angle distribution. This results in insufficient classification robustness in complex deformation or occlusion scenarios, leading to misaligned construction marks. Furthermore, projection calculations often ignore the coupling effect of camera pose and primitive space curvature. Accumulated deviations in projection range lead to mismatches between the robot's view and the theoretical model, requiring frequent manual calibration and correction, which reduces construction consistency. Therefore, improvements are needed. Summary of the Invention

[0004] The purpose of the present invention is to solve the shortcomings of the prior art and to propose a CAD primitive intelligent recognition method for a marking robot.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: a CAD primitive intelligent recognition method for a marking robot, comprising the following steps:

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

[0007] Retrieving and locating the CAD primitives to be processed based on the spatial index structure, calculating the connected area metric value, and comparing the area changes of adjacent connected areas with a preset area mutation threshold based on the connected area metric value to obtain a decomposed primitive set;

[0008] Based on each sub-element in the decomposed element set, analyzing the convex hull contour of each sub-element to obtain the element convex hull feature, comparing the element convex hull feature with a predefined geometric shape feature library to determine the basic geometric shape category to which the sub-element belongs, and generating a structured geometric parameter list;

[0009] Based on the geometric information of each graphic element in the structured geometric parameter list and the current view of the marking robot, the projection range of each graphic element in the screen coordinate system is calculated to obtain a screen space error measurement value. Based on the screen space error measurement value and the graphic element curvature information recorded in the spatial index structure, the simplification requirement of the graphic element is judged, the vertex of the graphic element is simplified, and graphic element metadata for the view of the marking robot is generated.

[0010] Preferably, the steps of obtaining the spatial index structure are:

[0011] Based on the input CAD primitive vertex coordinate data, traverse all vertices, extract the horizontal and vertical coordinate values of each vertex, calculate the sum of the coordinate differences between each vertex and its adjacent vertices, and generate a set of adjacent vertex coordinate differences;

[0012] Calculating a curvature change threshold according to the adjacent vertex coordinate difference set;

[0013] Vertices whose local curvature values are greater than a curvature change threshold are screened, associated with spatial position coordinates, divided into quadtree node units and stored with data, and a spatial index structure containing geometric and curvature features is established.

[0014] Preferably, the steps for obtaining the connected area metric value are:

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

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

[0017] Based on the normalized dimensionless parameters, a connected component metric value is calculated.

[0018] Preferably, the steps of obtaining the decomposed primitive set are:

[0019] Traverse the boundary vertex coordinate sets of all connected regions, extract the common boundary vertex coordinate data of adjacent connected regions, and calculate the difference ratio of the connected region metric values of the two regions in the adjacent connected region pair based on the distribution range of the connected region metric values. If the difference ratio of the connected region metric values is greater than or equal to the preset metric fluctuation threshold, it is determined to be a potential segmentation region pair and a list of region pairs to be segmented is generated;

[0020] According to the list of region pairs to be segmented, the connected area metric values and corresponding pixel area values of each region pair are extracted one by one, the absolute values of the area changes of adjacent region pairs are calculated, and the absolute values of the area changes are compared with a preset area mutation threshold. If the absolute value of the area change exceeds the preset area mutation threshold and satisfies the metric value difference ratio condition, 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, each high mutation region pair is geometrically segmented. The common boundary vertex coordinates are extracted and a 2-pixel wide transition band is extended on both sides. The overlapping pixels in the transition band are removed. The vertex coordinate data of the segmented independent sub-primitives are retained. The non-mutation region and the segmented sub-primitive data are merged to generate a decomposed primitive set.

[0022] Preferably, the steps of obtaining the primitive convex hull feature are:

[0023] Based on each sub-element in the decomposed element set, traversing the vertex coordinate set of each sub-element, using a monotone chain algorithm to screen peripheral vertices, connecting the peripheral vertices in a clockwise order to generate a minimum convex polygon, and forming a convex hull vertex sequence set of the sub-element;

[0024] According to the convex hull vertex sequence set of the sub-element, the number of vertices in each convex hull vertex sequence is counted, the Euclidean distance between adjacent vertices is calculated as the convex hull side length value, the numerical set of all side lengths is recorded, and at the same time, each vertex is traversed, and the radian value of the inner angle of the current vertex is calculated with the previous vertex, the current vertex and the next vertex as three consecutive points to generate a vertex angle value set;

[0025] Based on the number of convex hull vertices, the set of side length values, and the set of vertex angle values, the corresponding sub-element numbers are integrated and associated to generate the element convex hull features.

[0026] Preferably, the steps of obtaining the structured geometric parameter list are:

[0027] Based on the primitive convex hull feature table, traverse the convex hull vertex number, side length value set and vertex angle value set of each sub-primitive, load a predefined geometric shape feature library, parse 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, and generate a geometric shape comparison rule set;

[0028] According to the geometric shape comparison rule set, the convex hull feature data of the sub-element is matched one by one. If the number of vertices of the current sub-element is consistent with the vertex number threshold of a certain category in the feature library, and the ratio of all side length values falls within the side length ratio tolerance range of the corresponding category, and the vertex angle value meets the angle tolerance range, then the sub-element is determined to belong to this type of geometric shape category and a structured geometric parameter list is generated.

[0029] Preferably, the steps of obtaining the screen space error metric value are:

[0030] Based on the geometric information of each primitive in the structured geometric parameter list, the camera parameters of the current view of the marking robot are loaded, the geometric parameters and camera parameters of each primitive are traversed, and a primitive-view parameter mapping table is generated;

[0031] According to the primitive-view parameter mapping table, perform a projection transformation from a three-dimensional coordinate system to a screen coordinate system for each primitive, use a pinhole camera model to convert the primitive's world coordinates into screen pixel coordinates, correct the projection distortion based on the camera tilt angle, and generate a set of projection vertex coordinates of the primitive in the screen coordinate system;

[0032] Based on the projection vertex coordinate set of the primitive 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 ratio of the two coverage areas is calculated as the screen space error metric.

[0033] Preferably, the steps for acquiring the graphic metadata of the line-marking robot view are:

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

[0035] Calculate the simplification requirement judgment value of each vertex based on the vertex-level error-curvature data set;

[0036] Based on the simplification requirement judgment value, vertex deletion is performed on vertices whose simplification requirement judgment value is greater than a preset simplification threshold, the coordinates of vertices that do not meet the threshold are retained, the remaining vertices and the original data of the unprocessed primitives are merged, and the primitive data for the line marking robot view is generated.

[0037] Compared with the prior art, the advantages and positive effects of the present invention are:

[0038] This invention dynamically associates the geometric features of CAD primitives with their spatial positions through the fusion of local curvature calculation and quadtree spatial indexing, generating a spatial data structure that balances curvature sensitivity and region partitioning efficiency, improving the retrieval and positioning speed of complex primitives and reducing the consumption of redundant computing resources. Based on a decomposition mechanism combining connected region metrics and area mutation thresholds, combined with absolute value comparisons of area differences between adjacent regions, it achieves rapid segmentation of non-uniform geometric bodies, reduces missegmentation problems caused by contour adhesion or noise interference, and enhances the physical consistency of the decomposed primitive set. Through multi-dimensional analysis of the number of vertices, side lengths, and angles of sub-primitive convex hull features and regularized comparisons with a predefined geometric shape feature library, the accuracy of basic geometric category determination is improved, avoiding misclassification caused by local deformation in traditional single feature matching. The combined optimization of dynamic projection range calculation and screen space error metrics, combined with a curvature-driven vertex simplification strategy, reduces data redundancy while preserving key geometric features, generates lightweight primitive data that adapts to robot view constraints, and optimizes the real-time performance and execution accuracy of path planning. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 Schematic diagram of the steps of the present invention. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present 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 only used to explain the present invention and are not intended to limit the present invention.

[0041] See also Figure 1 The present invention provides a technical solution, a CAD primitive intelligent recognition method for a 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. According to the local curvature value and the spatial position coordinates of the CAD primitive vertex, a quadtree partitioning is applied to construct a spatial data structure, and a spatial index structure including the CAD primitive geometry and curvature features is established.

[0043] Retrieve and locate the CAD primitives to be processed based on the spatial index structure, calculate the connected area metric value, compare the area change of adjacent connected areas with the preset area mutation threshold based on the connected area metric value, and obtain the decomposed primitive set;

[0044] Based on each sub-element in the decomposed element set, the convex hull contour of each sub-element is analyzed to obtain the element's convex hull features. The element's 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 a structured geometric parameter list is generated.

[0045] Based on the geometric information of each primitive in the structured geometric parameter list and the current view of the marking robot, the projection range of each primitive in the screen coordinate system is calculated to obtain the screen space error measurement value. Based on the screen space error measurement value and the primitive curvature information recorded in the spatial index structure, the simplification requirement of the primitive is judged, the primitive is vertex simplified, and the primitive metadata for the marking robot view is generated.

[0046] The steps to obtain the spatial index structure are:

[0047] Based on the input CAD primitive vertex coordinate data, traverse all vertices and extract the horizontal and vertical coordinate values (x i ,y i ), calculate the coordinate difference Δx between each vertex and its adjacent vertex i =|x i -x i+1 | and Δy i =|y i -y i+1 |, generate a set of coordinate differences between adjacent vertices;

[0048] According to the set of adjacent vertex coordinate differences, the curvature change threshold is calculated using the formula:

[0049]

[0050] Where T is the curvature change threshold, Δx i and Δy i is the absolute value of the difference between the horizontal and vertical coordinates of vertex i and its adjacent vertices, and n is the total number of vertices;

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

[0052] Specifically, based on the input CAD primitive vertex coordinate data, the data is stored in the form of an ordered list, 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 later. Then, the vertex traversal program is started, starting from the first vertex i=1 in the vertex list and sequentially accessing to the last vertex. For the currently processed vertex i, its horizontal coordinate value x is read. i and the ordinate value y i At the same time, it is necessary to access the next logical vertex i+1 and obtain its coordinate x i+1 and y i+1In particular, for the last vertex in the list, its adjacent next vertex is defined as the first vertex in the list to ensure the logical consistency of the endpoint processing of closed polygons or open paths. After obtaining the coordinates of the current vertex i and its adjacent vertex i+1, the coordinate difference calculation is performed, specifically calculating 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 Represents the projection length of the line segment between vertex i and vertex i+1 in the horizontal and vertical directions, and the calculated difference pair (Δx i ,Δy i ) as a data unit and added to the previously initialized adjacent vertex coordinate difference set. This process continues until all vertices are traversed. For example, the input vertex sequence is {(10,20), (15,25), (12,30)}. When traversing the first vertex (10,20), the adjacent vertex is (15,25). Calculate Δx1 = |10-15| = 5, Δy1 = |20-25| = 5, add (5,5) to the set, and when traversing the second vertex (15,25), the adjacent vertex is (12, 30), calculate Δx2 = |15-12| = 3, Δy2 = |25-30| = 5, add (3,5) to the set, and when traversing the third vertex (12,30), since it is the last vertex, the adjacent vertex is regarded as the first vertex (10,20), calculate Δx3 = |12-10| = 2, Δy3 = |30-20| = 10, add (2,10) to the set, and finally complete the processing of all vertices to generate a complete set of adjacent vertex coordinate differences {(5,5), (3,5), (2,10)}.

[0053] formula: The formula is beneficial because it provides a global metric by calculating the average Euclidean distance between all adjacent vertices, reflecting the average level of line segment length in the CAD primitive. This metric serves as a benchmark for distinguishing vertex importance, namely the curvature change threshold T. This threshold T can be adaptively adjusted based on the overall size and complexity of the input primitive, avoiding the problem of inconsistent results for primitives of different scales that may result from using a fixed threshold.

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

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

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

[0057] Take the obtained set of adjacent vertex coordinate differences {(5,5),(3,5),(2,10)} as an example, the total number of vertices n = 3. Calculation process: 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 change threshold T:

[0058]

[0059] The results show that for this example primitive, which contains three vertices and has a vertex coordinate difference set of {(5,5), (3,5), (2,10)}, the average distance between adjacent vertices (i.e., the average segment length) is approximately 7.700 units. This value, T≈7.700, will serve as a baseline threshold for determining vertex importance 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, it is considered to represent a more significant change in geometric features and will be prioritized for subsequent processing. The size of this T value directly reflects the average length scale of the primitive's contour segments.

[0060] Based on the previously calculated local curvature value of each vertex and the calculated curvature change threshold T≈7.700, the vertex screening process begins. The system will traverse all vertices i of the input CAD primitive and compare the corresponding local curvature value C for each vertex. i With the curvature change threshold T, when C i >T, the vertex is judged as a significant feature point and is selected and retained. i ≤T, the vertex is temporarily ignored in this step. After completing the screening of all vertices, a subset of feature salient points is obtained. Next, these filtered feature salient points are compared with their original spatial position coordinates (x i ,y i ) to form a data structure containing vertex coordinates and their curvature attributes, such as (x k ,y k ,C k ) where k is the index of the filtered vertex. Subsequently, the quadtree spatial data structure is constructed using these significant vertex data associated with position and feature information. The construction process of the quadtree begins with a root node that can fully contain all input vertex coordinates (i.e., calculate all (x k ,y k )’s minimum bounding box [x min ,x max ]×[y min ,y max ], as the spatial range of the root node), and then recursively partition according to the number of significant vertices contained in the node, setting a node capacity threshold N capacity For example, based on experience and analysis of the density of primitives in the target scene, set N capacity =4, indicating that each leaf node can accommodate up to 4 significant vertices, and a minimum node size threshold S is set. min For example, to prevent excessive subdivision from causing excessive tree depth and reduced query efficiency, set S min = 1.0 unit length (can be adjusted according to the unit and precision of the CAD drawing). If the spatial area represented by the current node is larger than S min And the number of significant vertices it contains is N current More than N capacity , the spatial range of the node is divided along the midpoint line of the x-axis and y-axis to generate four child nodes of equal size (corresponding to the northwest, northeast, southwest, and southeast quadrants respectively), and the N current The salient vertices are calculated based on their spatial coordinates (x k ,y k ) are assigned to the corresponding child nodes, and this division process is performed recursively until all nodes meet N current ≤Ncapacity Or the node size is not greater than S min , these nodes that are no longer divided become leaf nodes. In the division process, not only the spatial position coordinates (x k ,y k ) is stored in the leaf node to which it ultimately belongs, and the local curvature value C of the vertex is also stored. k Store them together, so that each leaf node stores 1 to N in the space area capacity The non-leaf nodes store references or pointers to their four child nodes, eventually forming a complete quadtree structure.

[0061] The steps to obtain the connected area metric value are:

[0062] Based on the spatial index structure, the quadtree node units are traversed to extract the pixel area value and the area perimeter value of the connected area inside each CAD primitive, and a basic parameter set of the connected area is generated;

[0063] According to the connected area basic parameter set, the pixel area value A of each connected area j and the area perimeter value L j Perform standardization to eliminate dimension differences and obtain dimensionless parameters and Where max(A) and max(L) are the maximum values of pixel area and perimeter of all connected regions respectively;

[0064] Based on the standardized dimensionless parameters, the connected area metric is calculated using the following formula:

[0065]

[0066] Among them, M j is the connected area metric value of the j-th connected area, is the normalized pixel area value of the j-th connected region, is the normalized region perimeter value of the j-th connected region.

[0067] Specifically, based on the spatial index structure (quadtree) containing geometric and curvature features constructed in the previous step, a traversal process of the structure is started to identify and analyze the connected areas inside the CAD primitives. First, the CAD primitives (such as polygons and curve segments) defined by the vertices in the spatial index structure need to be rasterized and projected onto a two-dimensional pixel grid with a preset resolution. For example, the grid resolution is set to 0.1 unit length per pixel, and the boundary and internal area of the primitive are mapped to a set of pixels. All leaf nodes of the quadtree are traversed, and the primitive fragment information within the area covered by these nodes is collected. These fragments are marked on the pixel grid to form a binary image representation of the primitive (the pixel value of the primitive area is 1 and the background is 0). Then, a connected component labeling algorithm (for example, a scan line algorithm or a region growing algorithm based on an eight-neighborhood or four-neighborhood) is applied to identify each independent connected area in the binary image. Each connected area assigned a unique label j represents an independent component inside the CAD primitive. After all connected areas are identified, parameter extraction calculation is performed on each connected area marked as j to calculate the pixel area value A j It is obtained by counting the total number of pixels marked as j. For example, if region j contains 580 pixels, then A j =580, calculate the area perimeter value L j It is obtained 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, by counting the number of pixels inside the region adjacent to the background pixels, if region j has 95 pixels adjacent to the background, then L j =95, the pixel area value A calculated for each connected region j j and the area perimeter value L j Paired storage, forming (A j ,L j ) data pairs, traverse all the identified N connected regions, collect all these data pairs together, and finally generate a connected region basic parameter set.

[0068] Formula: Normalized pixel area value: Normalized region perimeter values: The connected region basic parameter set is {(580,95),(1200,150),(350,80)}. Calculate the maximum value: max(A) = 1200, max(L) = 150, and 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 after normalization, the original area and perimeter data {(580,95), (1200,150), (350,80)} are converted into 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 dimension and scale differences of the original data and can be directly used in the subsequent calculation of the connected region metric, making the comparison between different regions and the combination of area and perimeter in the metric formula more reasonable.

[0070] formula: The benefit of the formula is that it constructs a comprehensive consideration of the standardized area and normalized circumference The connected area measure M of the difference and its mean j .

[0071] Parameter Description:

[0072] The normalized pixel area value of the j-th connected component.

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

[0074] Substituting the above parameters into the calculated values of the three connected regions are M1≈0.017, M2=0, and M3≈0.017. j The magnitude of the value reflects a measure of the relationship between the normalized area and perimeter of the region. For example, M2 = 0 because its normalized area and perimeter are exactly equal (both are maximum values, which are normalized to 1.0). The values of M1 and M3 are close and non-zero, indicating that there is a certain difference in the normalized area and perimeter of the two regions, and this difference, combined with their average size, produces similar metric values. These M j The value will be used as the basic data for subsequent analysis to determine whether there is a significant characteristic change between regions and to decide whether segmentation is necessary. For example, if a metric value fluctuation threshold is set later, M j The size of the difference will directly affect the segmentation decision.

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

[0076] Traverse the boundary vertex coordinate sets of all connected regions, extract the common boundary vertex coordinate data of adjacent connected regions, and calculate the difference ratio of the connected region metric values of the two regions in the adjacent connected region pair based on the distribution range of the connected region metric values. If the difference ratio of the connected region metric values is greater than or equal to the preset metric fluctuation threshold, it is determined to be a potential segmentation region pair and a list of region pairs to be segmented is generated;

[0077] According to the list of region pairs to be segmented, the connected area metric value and the corresponding pixel area value of each region pair are extracted one by one. The absolute value of the area change of adjacent region pairs is calculated and compared with the preset area mutation threshold. If the absolute value of the area change exceeds the preset area mutation threshold and meets the metric value difference ratio condition at the same time, 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, each high mutation region pair is geometrically segmented. The common boundary vertex coordinates are extracted and a 2-pixel wide transition zone is extended on both sides. The overlapping pixels in the transition zone 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 merged to generate a decomposed primitive set.

[0079] Specifically, based on the boundary vertex coordinate sets of all connected regions j (j=1,...,N) obtained in the previous step and the corresponding connected region metrics M j , to start the process of identifying potential segmentation boundaries, we first need to determine which connected regions are spatially adjacent. By analyzing the pixel adjacency relationship of each connected region in the raster representation, we construct an adjacency graph, where nodes represent connected regions and edges represent shared boundary pixels between two regions. For each pair of regions (j, k) connected by an edge in the graph, we extract the coordinate data of their shared common boundary vertices. These data can be obtained directly from the boundary pixels of the raster image, or by matching the points in the original CAD vertices that fall on the shared boundary. At the same time, we retrieve the connected region metric M of region j and region k. j and M k , calculate the difference ratio R of the metric values of these two adjacent regions jk , which is used to quantify the relative difference in shape characteristics between two regions and is calculated as where |M j -M k | is the absolute difference of the metric values, max(M j ,M k ) is the larger of the two, plus a small positive number ∈ (e.g. 1×10 -6 ) is to prevent when M j and M k When both are zero, a division by zero error occurs. The calculated difference ratio Rjk and the preset metric fluctuation threshold T metric_波动 The setting of this threshold is based on the statistical analysis of the difference ratio of adjacent region measurements in a large number of different types of CAD drawings, collecting sample data covering various industrial parts and architectural layout drawings, and calculating the R of all adjacent region pairs. jk The value is plotted, and its distribution histogram is plotted to determine a threshold that can distinguish normal fluctuations from significant characteristic changes. For example, the threshold can be set to the 85th percentile of the distribution, or to 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 of a certain region pair (j, k) jk Greater than or equal to 0.37, that is, R jk If the value is ≥0.37, it is considered that there is a significant difference in shape characteristics between the two regions, and the region pair (j, k) is marked as a potential segmentation region pair. All region pairs that meet the conditions are collected to generate a list of region pairs to be segmented.

[0080] According to the generated list of region pairs to be segmented, the high mutation region pairs that need to be geometrically segmented are further screened out. The system processes each potential segmentation region pair (j, k) in the list one by one. For the current region pair (j, k), first, the corresponding pixel area value A is extracted from the previously stored connected region basic parameter set. j and A k , then calculate the absolute change in the area of these two adjacent regions ΔA jk =|A j -A k |, this value directly reflects the difference in size between two adjacent areas, and the calculated absolute value of the area change ΔA jk With the preset area mutation threshold T area_突变Numerical comparison is performed. This threshold is used to define the extent to which area changes are considered significant mutations. Its setting should be combined with the specific application scenario and the general scale of CAD elements. For example, when processing mechanical parts drawings, the area difference between main components and fasteners and small features may be large. When processing architectural floor plans, the area difference between rooms and walls and furniture also has certain patterns. By analyzing 50 typical CAD drawings in the target application field, the area difference ΔA between adjacent areas with clear functional boundaries or structural boundaries is calculated. jk It is found that more than 80% of the area differences at these key boundaries exceed 800 pixels (at a specific rasterization resolution), while the area differences of adjacent regions caused by noise or subtle structures within the region are usually less than 300 pixels. Therefore, T can be set area_突变 = 800 pixels, as an empirical benchmark for distinguishing structural area changes from non-structural area changes, 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 region pairs to be segmented, then the region pair (j, k) that meets both conditions is finally confirmed as a high mutation region pair, and all such confirmed region pairs are recorded to form a high mutation region identification table.

[0081] Based on the generated high mutation area identification table, geometric segmentation operations are performed to refine the primitive structure. The program traverses each high mutation area pair (j, k) in the identification table. For each boundary that needs to be segmented, the common boundary vertex coordinate sequence or common boundary pixel sequence between area j and area k is first accurately extracted. These coordinates or pixels define the interface where the two areas contact. Then, based on these common boundary points, a fixed width is extended to the inside of area j and area k to form a transition zone. According to the text description, the extension width is 2 pixels, that is, 2 pixels are extended from the common boundary to the inside of area j, and 2 pixels are also extended to the inside of area k. All pixels falling into this strip area with a total width of 4 pixels are identified as transition zone pixels. Then, a pixel removal operation is performed to remove all pixels identified as transition zones from the pixel sets of the connected areas j and k to which they originally belong. The purpose of this step is to remove the pixels that are originally adjacent to each other. A clear geometric gap is created between the two regions to eliminate boundary ambiguity or overlap caused by rasterization or original data accuracy problems. After pixel removal, the original regions j and k are transformed into two or more (if the original region is divided into multiple blocks) new, separated sub-regions j′ and k′, and the vertex coordinate data of the independent sub-primitives formed after these divisions are retained. The specific method is to recalculate the boundary contours of the modified pixel sets j′ and k′ and extract the vertex coordinates on the contours. You can choose to retain all contour pixels as vertices, or apply contour simplification algorithms (such as Douglas-Peucker algorithm) to obtain a more compact vertex representation. Finally, the vertex coordinate data of all new sub-primitives generated by segmentation are 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 aggregated to form the final decomposed primitive set for downstream processing steps.

[0082] The steps to obtain the primitive convex hull feature are:

[0083] Based on each sub-element in the decomposed element set, traverse the vertex coordinate set of each sub-element, use the monotone chain algorithm to screen the peripheral vertices, connect the peripheral vertices in clockwise order to generate the minimum convex polygon, and form the convex hull vertex sequence set of the sub-element;

[0084] According to the convex hull vertex sequence set of the sub-element, count the number of vertices in each convex hull vertex sequence, calculate the Euclidean distance between adjacent vertices as the convex hull side length value, record the value set of all side lengths, and traverse each vertex at the same time. Take the previous vertex, the current vertex, and the next vertex as three consecutive points, calculate the internal angle radian value of the current vertex, and generate a vertex angle value set;

[0085] Based on the number of convex hull vertices, the set of side length values, and the set of vertex angle values, the corresponding sub-element numbers are integrated and associated to generate the element convex hull features.

[0086] Specifically, based on the generated decomposed primitive set, it contains several independent sub-primitives, each of which consists of a set of vertex coordinates {P1, P2, ..., P m} definition, start to calculate the minimum convex hull for each sub-element, the system traverses each sub-element in this set, extracts its corresponding vertex coordinate set {(x1,y1),(x2,y2),...,(x m ,y m )}, the monotone chain algorithm is applied to determine the vertex sequence that constitutes the convex hull of the vertex set. The algorithm first sorts all input vertices in ascending order of the horizontal coordinate x. If the horizontal coordinates are the same, they are sorted in ascending order of the vertical coordinate y to obtain an ordered vertex list P′1, P′2, ..., P′ m Then, initialize two empty lists to store the upper convex hull vertex upper_hull and the lower convex hull vertex lower_hull respectively. When constructing the lower convex hull, traverse the sorted vertex list P′1 to P′ in order. m , for the current vertex P′ i , check the lower_hull list, as long as the lower_hull contains at least two vertices, and consists of the second to last vertex, the last vertex and the current vertex P' of the lower_hull i If the resulting sequence does not constitute a "left turn" (or is collinear), remove the last vertex from lower_hull. This turn judgment is completed by calculating the three-point cross product. For example, let the last two points 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 means no left turn (for constructing counterclockwise convex hull), remove V L-1 Repeat this check until the left turn condition is met or there are less than two vertices in lower_hull, and then change the current vertex P′ i Add to the end of lower_hull, and when constructing the upper convex hull, traverse the sorted vertex list P′ in reverse order mTo P′1, the exact same logic is used, but the operation object is the upper_hull list. After completing two traversals, the lower_hull list (remove the last vertex because it is repeated with the first vertex of upper_hull) is connected with the upper_hull list (remove the last vertex because it is repeated with the first vertex of lower_hull), and the result is the convex hull vertices arranged in counterclockwise order. Finally, this vertex sequence is reversed to obtain a convex hull vertex sequence arranged in clockwise order, which is the minimum convex polygon vertex representation of this sub-element. Repeat this process for all sub-elements in the decomposed element set, and finally form a set containing the clockwise convex hull vertex sequence of each sub-element.

[0087] According to the formed convex hull vertex sequence set of the sub-element, the geometric feature parameters of each convex hull are further extracted. The system traverses each convex hull vertex sequence in the set. Each sequence represents the convex hull of a sub-element, such as {V1, V2, ..., V k}, where V i =(x i ,y i ) and the vertices are arranged in clockwise order. For the convex hull vertex sequence currently being processed, first count the number of vertices it contains, recorded as N hull =k, this number itself is a basic indicator of 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 the next vertex V i+1 The Euclidean distance between 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 ), all calculated side lengths l1,l2,...,l k Collect them to form a numerical set of the side lengths of the convex hull. This set records the lengths of the line segments that make up the convex hull outline. Then, calculate the inner angle of the convex hull and traverse each vertex V in the sequence again. i (from i=1 to k), consider 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), calculated from V i Vector pointing to the previous vertex and from V i The vector pointing to the next vertex Use the vector dot product to calculate the angle θ between the two vectors i (i.e. the convex hull is at the vertex V i The internal angle at the position), ensuring that the calculated angle θ i For the interior angle (for convex polygons, all interior angles should be less than π radians), and the angle value is stored in radians. All calculated interior angles θ1, θ2, ..., θ k Collect them to form a set of vertex angle values of the convex hull. After completing all parameter calculations for the current convex hull vertex sequence, continue processing the next sequence until the convex hulls of all sub-primitives are processed.

[0088] The number of convex hull vertices N calculated for each sub-primitive hull , the numerical set of edge lengths {l1,...,l k} and the vertex angle value set {θ1,...,θ k}, perform the final integration and structuring processing, the system creates a data record for each sub-element in the decomposed element set, which will contain all the convex hull feature parameters calculated previously. Specifically, the sub-element number ID s As the primary key or identifier of the record, then the number of convex hull vertices N hull,s Store it in the record, then record the numerical set of all the side lengths of the convex hull {l 1,s ,...,l k,s}Organize into a list or array in clockwise order and store it in a record. Similarly, the numerical set of all the vertex interior angles of the convex hull {θ 1,s ,...,θ k,s} are also organized into lists or arrays in clockwise order (corresponding to vertices and edges) and stored in the same record. For example, for the sub-element numbered s=5, if its convex hull is a rectangle with 4 vertices, side lengths of 8.0, 6.0, 8.0, 6.0, and internal angles of 1.5708 radians (about 90°), the number of each sub-element is associated with its corresponding convex hull vertex number, ordered side length list, and ordered angle list and stored. Finally, the structured records of all sub-elements are collected to form a complete element convex hull feature dataset, which systematically describes the key geometric properties of the outer contour of each sub-element (approximated by the convex hull), providing a quantitative basis for subsequent shape recognition and classification.

[0089] The steps to obtain the structured geometric parameter list are:

[0090] Based on the primitive convex hull feature table, 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;

[0091] According to the set of geometric shape comparison rules, the convex hull feature data of the sub-element is matched one by one. If the number of vertices of the current sub-element is consistent with the vertex number threshold of a certain category in the feature library, and the ratio of all side length values falls within the side length ratio tolerance range of the corresponding category, and the vertex angle value meets the angle tolerance range, then the sub-element is determined to belong to this type of geometric shape category and a structured geometric parameter list is generated.

[0092] Specifically, based on the generated primitive convex hull feature table, the table contains the number N of convex hull vertices corresponding to each sub-primitive s hull,s , the set of side length values arranged in clockwise order {l i,s} and the vertex angle value set {θ i,s}, to start the sub-element geometry recognition process, you first need to load a pre-built geometric shape feature library. This library is a structured data storage (for example, a JSON file or a database table), which defines the various basic geometric shape categories that the system needs to recognize and their ideal features. The library must be established by domain experts or by analyzing common standard graphics in target CAD drawings (such as rectangles, squares, circles (approximated by regular polygons), equilateral triangles, isosceles triangles, regular hexagons, etc.). The library stores matching rules for each geometric shape category (for example, "Rectangle"), including: vertex number matching rule (for example, "Rectangle" requires the number of convex hull vertices N expected =4), side length ratio and tolerance range (for example, "Rectangle" requires the relative side length ratio to be close to 1, i.e. l 1,s / l 3,s and l 2,s / l 4,s Should be [1-T len_ratio ,1+T len_ratio ] range, where T len_ratio is the side length ratio tolerance; "EquilateralTriangle" requires that all side length ratios are close to 1, i.e. l 1,s / l 2,s and l 2,s / l 3,s within the same tolerance range), as well as angle requirements and tolerance ranges (for example, "Rectangle" requires all internal angles to be close to π / 2 radians, or θ i,s Should be [π / 2-T angle,π / 2+T angle ] within the scope;

[0093] "EquilateralTriangle" requires that all internal angles are close to [π / 3 radians, i.e. θ i,s Should be [π / 3-T angle ,[π / 3+T angle range, where T angle is the angle tolerance), the tolerance parameter T len_ratio and T angle The setting of is based on the evaluation of the noise, precision error and approximate error introduced by the convex hull calculation itself in the actual CAD data. By testing 100 sample CAD files containing known standard shapes (but there may be slight deviations), the deviation degree of their convex hull features from the ideal value is observed, and the appropriate tolerance value is selected. For example, the side length ratio tolerance T is set to len_ratio =0.05, allowing a 5% fluctuation in the side length ratio, setting the angle tolerance T angle = 0.05 radians (about 2.86 degrees), and the angle is allowed to have deviations within this range. After the system loads this feature library, it analyzes the vertex number rules, side length ratio rules, angle rules and corresponding tolerance T for each type of geometric shape. len_ratio and T angle ,This information is organized and stored as a data structure in memory, forming a complete set of geometric shape comparison rules for ,use in subsequent matching processes.

[0094] According to the generated geometric shape comparison rule set, the system starts to match the sub-element convex hull feature data in the element convex hull feature table one by one, and for each sub-element record s in the table (including the number of its convex hull vertices N hull,s , the set of side length values {l i,s} and the vertex angle value set {θ i,s}), sequentially try to match each geometric shape category defined in the geometric shape comparison rule set (such as "Rectangle", "EquilateralTriangle", etc.), the matching process follows a strict conditional check process, first check the consistency of the number of vertices, and add the number of convex hull vertices N of the sub-element hull,s The number of vertices N required by the current shape category to be matched expected For comparison, if N hull,s ≠N expected , then the sub-element cannot belong to this category, immediately stop matching this category, and try the next category. If the number of vertices is the same, 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,s / l 4,s ≈1), calculate the actual ratio of the relevant side lengths of the sub-element convex hull, and determine whether these ratios fall within the side length ratio tolerance T len_ratio (e.g. 0.05) within the defined allowable range, i.e. check if |l 1,s / l 3,s -1|≤0.05 and|l 2,s / l 4,s -1|≤0.05 is true at the same time. If any ratio check fails, stop matching this category and try the next category. If the side length ratio also meets the requirements, finally check the angle. According to the angle rule of the current shape category (for example, "Rectangle" requires all angles θ i,s ≈π / 2), check the angle θ of all convex hull vertices of the sub-element i,s Are they all within the angle tolerance T? angle (e.g. 0.05 radians) within the defined allowable range, i.e. check if |θ i,s -π / 2|≤0.05 for all i. If any angle does not meet the requirements, the matching stops and the next category is tried. Only when the convex hull feature of a sub-element satisfies all the matching rules of the number of vertices, side length ratio and angle of a certain geometric shape category (all within the tolerance range), the system determines that the sub-element belongs to this geometric shape category and reports the classification result (for example, sub-element ID s The sub-element ID is recorded and the key geometric parameters of the shape are extracted (such as the center point coordinates, width, height, and rotation angle of the rectangle, which can be calculated from the convex hull vertices and side lengths). s , the identified shape categories and the extracted key geometric parameters are organized into a record. After completing the matching and classification of all sub-elements, the records of all successfully classified sub-elements are collected to finally generate a structured geometric parameter list.

[0095] The steps to obtain the screen space error metric are:

[0096] Based on the geometric information of each primitive in the structured geometric parameter list, the camera parameters of the current view of the marking robot are loaded, the geometric parameters and camera parameters of each primitive are traversed, and a primitive-view parameter mapping table is generated;

[0097] According to the primitive-view parameter mapping table, perform projection transformation from the 3D coordinate system to the screen coordinate system for each primitive. Use the pinhole camera model to convert the primitive's world coordinates into screen pixel coordinates. Combined with the camera tilt angle to correct the projection distortion, generate the primitive's projection vertex coordinate set in the screen coordinate system.

[0098] Based on the projection vertex coordinate set of the primitive 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 ratio of the two coverage areas is calculated as the screen space error metric.

[0099] Specifically, based on the generated structured geometric parameter list, each record contains the ID of a sub-element 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.), start the mapping preparation work from the primitive to the screen space, first need to load the camera parameters of the marking robot in the current working state, these parameters are usually stored in the configuration file of the robot system or obtained through real-time sensor data, specifically including: camera internal parameters (IntrinsicParameters), such as focal length (f x ,f y , the unit is usually pixels), principal point coordinates (c x ,c y , that is, the position of the optical center of the image in the pixel coordinate system), these parameters are obtained through the offline camera calibration process; the camera external parameters (ExtrinsicParameters), that is, the posture of the camera relative to the world coordinate system (usually aligned with the CAD model coordinate system), are represented by the rotation matrix R (3×3) and the translation vector t (3×1), these parameters are provided in real time by the robot's positioning system (such as SLAM, GPS / IMU integrated navigation, etc.) or calibrated in a fixed installation scenario; and the camera distortion parameters (DistortionCoefficients), including radial distortion coefficients (such as k1, k2, k3) and tangential distortion coefficients (such as p1, p2), these parameters are also obtained through offline calibration and are used to subsequently correct the nonlinear distortion introduced by lens imaging. After loading the current camera intrinsic parameters, extrinsic parameters and distortion coefficients, the system traverses each primitive record in the structured geometric parameter list and extracts the geometric information of the primitive, especially its vertex coordinates P in the world coordinate system. w,i =(X w,i ,Y w,i ,Z w,i )(For 2DCAD entities, it is usually assumed that they are located in a known plane, such as Z w=0 plane, or assign it a specific depth based on the scene), and pair these world coordinate vertex information of each primitive with the same set of camera parameters (intrinsic parameters, extrinsic parameters, and distortion coefficients) just loaded to form the data input pairs required for subsequent projection calculations. This series of paired data conceptually constitutes the primitive-view parameter mapping table, laying the foundation for the next step of performing coordinate transformation on a primitive-by-primitive basis.

[0100] According to the mapping relationship between primitive geometry information and camera parameters, the system processes each primitive in sequence, performs projection transformation from the 3D world coordinate system to the 2D screen pixel coordinate system, and obtains all world coordinate vertices P of the currently processed primitive s. 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, for each vertex P w,i Apply rigid body transformation: P c,i =R·P w,i +t, get the coordinate 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 representative point in front of the camera, then the pinhole camera model is applied for ideal projection, the camera coordinate point is projected onto the normalized image plane, and the distortion-free normalized coordinate (x′ i ,y′i)=(X c,i / Z c,i ,Y c,i / Z c,i ), then, consider and correct the lens distortion, use the loaded distortion coefficient to adjust the normalized coordinates, and calculate the square of the distortion radius Apply a distortion model (e.g. Brown-Conrady model) to calculate the corrected normalized coordinates (x″) i ,y″ i ), and finally, the normalized coordinates (x″) after distortion correction i ,y″ i ) is converted to 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 the projected vertices of the primitive in the screen coordinate system under the current camera view. After completing the processing of 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 primitive's projected vertex coordinate set in the screen coordinate system, the screen space error metric value of each primitive s is calculated. First, the minimum bounding rectangle of the projected vertex set of each primitive is calculated, usually using an axis-aligned bounding box, by finding 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 ) is determined by [u min,s ,v min,s ,u max,s ,v max,s The rectangular area defined by ] represents the theoretical projection range B of the primitive calculated based on the CAD model and camera parameters. theoretical,s Next, we need to obtain the contour range B detected by the primitive in the actual camera view. detected,s This part of information comes from the result of processing the real-time camera image of the marking robot. For example, the object contour in the image is extracted through image segmentation or edge detection algorithm (such as Canny edge detection), and then the detected contour is associated with the currently processed CAD primitive s using contour matching or target tracking algorithm (this association process is the premise of this step and is assumed to have been completed). For the successfully associated detected contour, its minimum enclosing rectangle is also calculated to obtain the contour range detected by the view. Then, the theoretical projection range is compared with the contour range detected by the view, and the spatial overlap between the two is calculated. The intersection over union ratio is used as a metric. The calculated IoU s The value is the screen space error metric of the primitive s. The higher the value, the more consistent the theoretical projection is with the actual detection, and the smaller the error is.

[0102] The steps for obtaining the metadata of the line drawing robot view are as follows:

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

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

[0105]

[0106] Among them, Q c is the simplified requirement judgment value of the c-th vertex, E c is the screen space error metric of the c-th vertex, C c The curvature information of the c-th vertex recorded in the spatial index structure;

[0107] Based on the simplification requirement judgment value, vertices whose simplification requirement judgment value is greater than the preset simplification threshold are deleted, the coordinates of vertices that do not meet the threshold are retained, and the remaining vertices are merged with the original data of the unprocessed primitives to generate primitive data for the line marking robot view.

[0108] Specifically, based on the calculated screen space error metric IoU for each primitive s s , and construct and store the local curvature information C of each original CAD vertex c c The spatial index structure of , starts the preparation of vertex-level simplification information. The system needs to associate the corresponding error and curvature information for each vertex of each primitive involved in the simplification, traverse these selected primitives s, and then traverse all the original vertices c belonging to the primitive s. For the current vertex c, perform information extraction and association operations to extract the screen space error metric IoU of the primitive s to which vertex c belongs s Since the metric value is for the entire primitive, the screen space error metric value of all vertices belonging to the primitive is set to the same value. In order to make the value represent "error" rather than "fit", a conversion is performed to define the screen space error E of vertex c c =1-IoU s , therefore, E c The value range of E is between [0,1]. c The larger the value, the greater the difference between the theoretical projection of the primitive and the actual detection (the error is high). c The smaller the difference, the smaller the error. At the same time, the local curvature information C that is precisely associated with the current vertex c is queried and extracted from the spatial index structure. c , the C c The value is calculated at the initial stage of the method and quantifies the local geometric complexity or the degree of change at the vertex c. Assuming that C c The value has been normalized before storage, and its range is also mapped to the interval [0,1]. The larger the value, the higher the curvature (the more significant the geometric features). The extracted vertex error E c and vertex curvature C c Pair to form a data tuple (E c ,C c ), repeat this operation for all vertices of the primitive s, and then continue to process the next selected primitive until all relevant vertices have obtained the corresponding (E c ,C c ) data pairs, all of which are collected together to form a complete vertex-level error-curvature data set, which provides input for the subsequent calculation of the simplified requirement judgment value of each vertex.

[0109] formula: The usefulness of this formula is that it incorporates the vertex screen space error E c and its geometric curvature C c , calculate a quantitative simplified demand judgment value Q c , which is used to guide the view-adaptive vertex simplification process. The formula is designed to identify vertices that do not contribute much to the current view but may increase rendering burden or visual noise.

[0110] Parameter Description:

[0111] E c : The screen space error metric of 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 cth vertex recorded in the spatial index structure. This value is the local curvature value associated with vertex c calculated in the previous step and stored in the spatial index structure (such as the quadtree). For example, by querying the spatial index structure, it is known that the normalized curvature value of vertex c is C c =0.7.

[0113] Substituting the parameters into the formula, we can calculate the simplified demand judgment value Q of the first vertex c. c ≈0.509, the simplified demand judgment value Q of the second vertex c′ c′ =0.01. Higher Q c A value such as 0.509 indicates that the vertex has a higher simplification requirement because it is relatively important geometrically (C c =0.7) but the error of the element to which it belongs is large in the current view (E c =0.8). Lower Q c′ A value such as 0.01 indicates that the vertex simplification requirement is low because it is geometrically insignificant (C c′ = 0.1) and its primitive matches the view well (E c′ =0.1). These Q c The value will be compared with the simplification threshold to decide which vertices are ultimately deleted.

[0114] Based on the calculated simplified demand value Q for each vertex c To perform the final vertex simplification operation, you first need to set a preset simplification threshold T simplify , which determines which vertices will be considered redundant and deleted. The threshold T simplify The setting of Q should balance the degree of simplification and information fidelity, and be determined according to application requirements and experimental results. For example, the Q calculated in a series of representative scenarios can be used toc Analyze the distribution of Q values and select an appropriate percentile as the threshold. Alternatively, iteratively optimize 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). A specific method for setting the threshold is to collect Q values under 10 different scenarios. c Calculate the results (a total of 50,000 vertices) and draw Q c The cumulative distribution function (CDF) of the values is selected, and the Q corresponding to a CDF value of 0.80 is selected. c value 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, then set T simplify =0.35, after setting the threshold, the system traverses all the c The value of the vertex c, Q c With T simplify For comparison, if Q c >0.35, then mark the vertex as pending deletion. c If the value of the coordinates of the vertex is less than or equal to 0.35, the original coordinates of the vertex are retained. After all vertices are determined, the vertex deletion operation is performed. For the vertices marked for deletion, they are removed from the vertex list of the primitive to which they belong, and the topological connection relationship of the primitive needs to be updated synchronously. For example, if a vertex of a polygon is deleted, its two neighboring vertices before and after it need to be directly connected to form a new edge (it is necessary to check whether the new edge will cause self-intersection and other problems and deal with them accordingly). The coordinates of all undeleted vertices are retained to form the vertex set of the simplified primitive. At the same time, those primitives that did not participate in the simplification process need to be considered (for example, primitives that were not detected or marked as not requiring simplification when calculating the screen space error) and the original vertex coordinate data of these unprocessed primitives are completely retained. Finally, the vertex coordinate data remaining after vertex deletion and topological adjustment (from the simplified primitives) are merged with the original vertex coordinate data of the unprocessed primitives. The integrated data constitutes the final primitive data set that has been adaptively simplified for the current line drawing robot view.

[0115] The above are merely preferred embodiments of the present invention and do not limit the present invention in any other form. Any technician familiar with the profession may use the technical content disclosed above to change or modify it into an equivalent embodiment with equivalent changes and apply it to other fields. However, any simple modification, equivalent change and modification made to the above embodiment based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall still fall within the scope of protection of the technical solution of the present invention.

Claims

1. A CAD primitive intelligent recognition method for a marking robot, characterized in that: The following steps are involved: Based on the input CAD primitive vertex coordinate data, the local curvature value of each vertex is calculated. According to the local curvature value and the spatial position coordinates of the CAD primitive vertex, a quadtree partitioning is applied to construct a spatial data structure, and a spatial index structure including the CAD primitive geometry and curvature features is established. Retrieving and locating the CAD primitives to be processed based on the spatial index structure, calculating the connected area metric value, and comparing the area changes of adjacent connected areas with a preset area mutation threshold based on the connected area metric value to obtain a decomposed primitive set; Based on each sub-element in the decomposed element set, analyzing the convex hull contour of each sub-element to obtain the element convex hull feature, comparing the element convex hull feature with a predefined geometric shape feature library to determine the basic geometric shape category to which the sub-element belongs, and generating a structured geometric parameter list; Based on the geometric information of each graphic element in the structured geometric parameter list and the current view of the marking robot, the projection range of each graphic element in the screen coordinate system is calculated to obtain a screen space error measurement value. Based on the screen space error measurement value and the graphic element curvature information recorded in the spatial index structure, the simplification requirement of the graphic element is judged, the vertex of the graphic element is simplified, and graphic element metadata for the view of the marking robot is generated.

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

3. The intelligent recognition method for CAD primitives for a marking robot according to claim 1, characterized in that: The steps for obtaining the connected area metric value are as follows: Based on the spatial index structure, traverse the quadtree node units, extract the pixel area value and the area perimeter value of the connected area inside each CAD primitive, and generate a connected area basic parameter set; According to the connected region basic parameter set, the pixel area value and the region perimeter value of each connected region are normalized to eliminate the dimension difference and obtain dimensionless parameters; Based on the normalized dimensionless parameters, a connected component metric value is calculated.

4. The intelligent recognition method for CAD primitives for a marking robot according to claim 1, characterized in that: The steps for obtaining the decomposed primitive set are: Traverse the boundary vertex coordinate sets of all connected regions, extract the common boundary vertex coordinate data of adjacent connected regions, and calculate the difference ratio of the connected region metric values of the two regions in the adjacent connected region pair based on the distribution range of the connected region metric values. If the difference ratio of the connected region metric values is greater than or equal to the preset metric fluctuation threshold, it is determined to be a potential segmentation region pair and a list of region pairs to be segmented is generated; According to the list of region pairs to be segmented, the connected area metric values and corresponding pixel area values of each region pair are extracted one by one, the absolute values of the area changes of adjacent region pairs are calculated, and the absolute values of the area changes are compared with a preset area mutation threshold. If the absolute value of the area change exceeds the preset area mutation threshold and satisfies the metric value difference ratio condition, the region pair is marked as a high mutation region pair, and a high mutation region identification table is generated; Based on the high mutation region identification table, each high mutation region pair is geometrically segmented. The common boundary vertex coordinates are extracted and a 2-pixel wide transition band is extended on both sides. The overlapping pixels in the transition band are removed. The vertex coordinate data of the segmented independent sub-primitives are retained. The non-mutation region and the segmented sub-primitive data are merged to generate a decomposed primitive set.

5. The intelligent recognition method for CAD primitives for a marking robot according to claim 1, characterized in that: The steps for obtaining the primitive convex hull feature are as follows: Based on each sub-element in the decomposed element set, traversing the vertex coordinate set of each sub-element, using a monotone chain algorithm to screen peripheral vertices, connecting the peripheral vertices in a clockwise order to generate a minimum convex polygon, and forming a convex hull vertex sequence set of the sub-element; According to the convex hull vertex sequence set of the sub-element, the number of vertices in each convex hull vertex sequence is counted, the Euclidean distance between adjacent vertices is calculated as the convex hull side length value, the numerical set of all side lengths is recorded, and at the same time, each vertex is traversed, and the radian value of the inner angle of the current vertex is calculated with the previous vertex, the current vertex and the next vertex as three consecutive points to generate a vertex angle value set; Based on the number of convex hull vertices, the set of side length values, and the set of vertex angle values, the corresponding sub-element numbers are integrated and associated to generate the element convex hull features.

6. The intelligent recognition method for CAD primitives for a marking robot according to claim 1, characterized in that: The steps for obtaining the structured geometric parameter list are: Based on the primitive convex hull feature table, traverse the convex hull vertex number, side length value set and vertex angle value set of each sub-primitive, load a predefined geometric shape feature library, parse 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, and generate a geometric shape comparison rule set; According to the geometric shape comparison rule set, the convex hull feature data of the sub-element is matched one by one. If the number of vertices of the current sub-element is consistent with the vertex number threshold of a certain category in the feature library, and the ratio of all side length values falls within the side length ratio tolerance range of the corresponding category, and the vertex angle value meets the angle tolerance range, 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 a marking robot according to claim 1, characterized in that: The steps for obtaining the screen space error metric value 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 marking robot are loaded, the geometric parameters and camera parameters of each primitive are traversed, and a primitive-view parameter mapping table is generated; According to the primitive-view parameter mapping table, perform a projection transformation from a three-dimensional coordinate system to a screen coordinate system for each primitive, use a pinhole camera model to convert the primitive's world coordinates into screen pixel coordinates, correct the projection distortion based on the camera tilt angle, and generate a set of projection vertex coordinates of the primitive in the screen coordinate system; Based on the projection vertex coordinate set of the primitive 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 ratio of the two coverage areas is calculated as the screen space error metric.

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

Citation Information

Patent Citations

  • An automatic detection method for multiple combination areas of a plane geometric figure

    CN109671093A

  • 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

  • Three-dimensional point cloud data segmentation method and system based on multi-scale point features

    CN119648536A

  • Computer-vision system for classification and spatial localization of bounded 3d-objects

    US20070127816A1

Cited By

  • Computer automatic identification method for building CAD drawing

    CN121415432A