An engineering drawing line segment vectorization method and system based on category merging

By employing a classification and merging-based method, noise reduction, skeleton refinement, coordinate extraction, and collinearity merging are performed on engineering drawings, solving the problem that existing technologies struggle to handle complex engineering drawings and achieving efficient line segment vectorization.

CN115546820BActive Publication Date: 2026-06-19JIANGSU FRONTIER ELECTRIC TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGSU FRONTIER ELECTRIC TECH
Filing Date
2022-10-21
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing line segment vectorization algorithms are mainly designed for simple engineering drawings with a line segment width of 1. They are difficult to process complex engineering drawings and cannot be directly applied to complex engineering drawings.

Method used

A classification-based merging method is adopted to vectorize line segments through steps such as denoising, skeleton refinement, coordinate extraction, classification, and merging. Specific steps include image denoising, line width reduction, line segment coordinate extraction, collinearity classification, and intersection merging.

Benefits of technology

It improves the accuracy of line segment vectorization, reduces computational complexity and resource consumption, and is suitable for complex engineering drawings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115546820B_ABST
    Figure CN115546820B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of engineering drawing recognition technology, specifically relating to a method and system for vectorizing line segments in engineering drawings based on classification and merging. The method includes: denoising the image of the engineering drawing to obtain a drawing image to be processed; reducing the line width of the graphics in the drawing image to a preset value to obtain a skeletonized drawing image; extracting the coordinates of line segments in the skeletonized drawing image; classifying the line segments in the drawing image according to whether they are collinear based on their coordinates to obtain a set of collinear line segments; identifying intersecting line segments based on the set of collinear line segments; and merging all intersecting line segments in the drawing image to complete the vectorization of the line segments. This invention provides a complete line segment vectorization technology based on classification and merging methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of engineering drawing recognition technology, specifically relating to a method and system for vectorizing line segments in engineering drawings based on classification and merging. Background Technology

[0002] With the increasing informatization of society, engineering design has transitioned from paper-based to fully electronic design. This has led to the challenge of effectively managing the large number of scanned paper drawings to enable the reuse of design information. Furthermore, paperless office work has become a growing trend. To achieve the reuse of drawings and paperless office practices, engineering drawing recognition technology has become a hot research topic.

[0003] Line segments are crucial geometric elements in engineering drawings; almost all engineering graphics are composed of line segments. Since the structural relationships between graphic elements used by intelligent recognition algorithms, and the statistical information of these relationships, are based on the ability to effectively extract features from engineering drawings, line segment vectorization is of great significance in constructing high-level information for intelligent recognition of engineering drawings. However, existing line segment vectorization algorithms are mostly designed for engineering drawings with a line segment width of 1, and these algorithms largely employ a search-based approach, making them suitable for small, simple engineering drawings but unable to handle complex ones. Therefore, existing line segment vectorization algorithms cannot be directly applied to complex engineering drawings. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a method and system for vectorizing line segments in engineering drawings based on classification and merging. Based on classification and merging methods, it provides a complete line segment vectorization technology.

[0005] To address the shortcomings of existing technologies, the technical solution provided by this invention is as follows:

[0006] A method for vectorizing line segments in engineering drawings based on classification and merging includes,

[0007] Step 1: Denoise the engineering drawing image to obtain the engineering drawing image to be processed;

[0008] Step 2: Reduce the line width of the graphics in the engineering drawing image to a preset value to obtain a skeletonized engineering drawing image;

[0009] Step 3: Extract the coordinates of line segments from the skeletonized engineering drawing image;

[0010] Step 4: Based on the coordinates of the line segments in the engineering drawing image, classify the line segments in the engineering drawing image according to whether they are collinear to obtain a set of collinear line segments;

[0011] Step 5: Based on the set of collinear line segments, obtain the intersecting line segments, and merge all intersecting line segments in the engineering drawing image to complete the vectorization of the line segments.

[0012] Preferably, the step of classifying the line segments in the engineering drawing image according to whether they are collinear based on their coordinates to obtain a set of collinear line segments includes,

[0013] The line segments in the engineering drawings are categorized according to whether the angle between the line segments and the positive x-axis is the same, resulting in a set of line segments with the same angle.

[0014] Line segments with the same included angle are grouped according to whether they are collinear to obtain a set of collinear line segments.

[0015] Preferably, the step of classifying line segments in the engineering drawing image according to whether the angles between the line segments and the positive x-axis are the same to obtain a set of line segments with the same angle includes,

[0016] Step 4-1, the set of line segments in the engineering drawing image is: Among them l i Represents the i-th line segment. in Let x and y represent the starting x-coordinate, starting y-coordinate, ending x-coordinate, and ending y-coordinate of the i-th line segment, respectively; n is the total number of line segments; i takes the values ​​1, 2, ..., n.

[0017] Step 4-2: Calculate the angle between each line segment and the positive x-axis.

[0018]

[0019] Among them agl i Indicate l i The angle with the positive x-axis;

[0020] Step 4-3: Calculate the similarity of the angles between any two line segments and the positive x-axis to obtain the mask matrix P, where P is a two-dimensional matrix. i,j 1 represents l i With l j The included angles are the same, P i,j 0 indicates l i With l j The included angles are different; j takes values ​​of 1, 2, ..., n;

[0021] Step 4-4: Set set S, initialize it as an empty set, and set set LS. k Initialize to an empty set, with initial k set to 1; initial line segment index idx set to 1.

[0022] Step 4-5: If idx is greater than n, proceed to step 4-8; otherwise, go to step 4-6.

[0023] Steps 4-6, determine l idx If it belongs to set S, increment idx by 1 and go to step 4-5; otherwise, go to step 4-7.

[0024] Steps 4-7, l idx Add to set LS k In the middle, according to the mask matrix P, P is... idx,j 1, and line segment l idx All line segments with the same angle and an index greater than idx are added to the set LS. k In, and will set LS k Add it to set S, increment idx and k by 1, and then proceed to steps 4-5.

[0025] Steps 4-8 yield the set S, S = {LS1, LS2, ..., LS}. k , ...,LS z}, where z is the total number of elements in set S; k = 1, 2, ..., z.

[0026] Preferably, the step of classifying line segments with the same included angle according to whether they are collinear to obtain a set of collinear line segments includes,

[0027] Steps 4-9, set LS k The indices of the midline segment are updated to 1, 2, ..., m. k , where m k For set LS k The number of median segments is calculated from the set LS. k The collinearity of any two line segments within the matrix yields the mask matrix Q. k Mask matrix Q k It is a two-dimensional matrix, where Q ki,j A value of 1 indicates the set LS k The Lth line segment l in LSki With the LSKj-th line segment l LSkj Collinear, Q ki,j A value of 0 indicates that the set LS k l in LSki With l LSkj Non-collinear, LSki takes values ​​of 1, 2, ..., m k LSKj takes values ​​of 1, 2, ..., m k Initially, k is 1, then proceed to step 4-10.

[0028] Steps 4-10: Determine if k is greater than z. If yes, end the process; otherwise, set set T. kInitialize to an empty set, set set LTk d Initialize as an empty set, initial d is 1; initialize line segment index idx to 1, extract set LS k The line segment in;

[0029] Step 4-11, if idx is greater than m k If yes, proceed to step 4-14; otherwise, proceed to step 4-12.

[0030] Step 4-12, determine l idx Does it belong to set T? k If yes, increment idx by 1 and proceed to step 4-11; otherwise, proceed to step 4-13.

[0031] Step 4-13, l idx Add to set LTk d According to the mask matrix Q k Q ki,j For 1, and l idx All collinear line segments with indices greater than idx are added to the set LTk. d In, and will set LTk d Add to set T k In the middle, after incrementing idx and d by 1, proceed to step 4-11;

[0032] Step 4-14 yields set T. k ={LTk1, LTk2, ..., LTk} d , ..., LTk wk}, wk is a set T k The total number of elements, d = 1, 2, ..., wk, add 1 to k and go to step 4-10.

[0033] Preferably, the method for deriving intersecting line segments based on the set of collinear line segments includes:

[0034] Expand each line segment in the set of collinear line segments into an axis-parallel rectangle, and determine whether any two axis-parallel rectangles intersect.

[0035] If two axis-parallel rectangles intersect, then the two line segments corresponding to the axis-parallel rectangles intersect; otherwise, the two line segments corresponding to the axis-parallel rectangles do not intersect.

[0036] Preferably, expanding each line segment within the set of collinear line segments into an axis-parallel rectangle includes,

[0037] Get the set of collinear line segments LTk d , set LTk d The total number of elements is LTk d g, set LTk dThe indices of the median segment are 1, 2, ..., LTk. d g;

[0038] l LTkdi For set LTk d The LTkdi-th line segment is represented as in They represent l respectively LTkdi The starting x-axis coordinate, starting y-axis coordinate, ending x-axis coordinate, ending y-axis coordinate; LTkdi takes values ​​of 1, 2, ..., LTk d g;

[0039] l LTkdi The axis parallel rectangle is connected by line segment l LTkdi It is a diagonal line, and the endpoints are arranged in clockwise order as follows:

[0040] Preferably, determining whether any two axes of parallel rectangles intersect includes:

[0041] Calculate line segments With line segment Does it intersect? Calculate the line segment. With line segment Do they intersect? Let LTkdj represent the starting x-coordinate, starting y-coordinate, ending x-coordinate, and ending y-coordinate, respectively; LTkdj takes values ​​of 1, 2, ..., LTk. d g;l LTkdj The axis parallel rectangle is connected by line segment l LTkdj It is a diagonal line, and the endpoints are arranged in clockwise order as follows:

[0042] When line segment With line segment Line segments with no intersections With line segment If there is no intersection, the two axis-parallel rectangles are determined to be non-intersecting; otherwise, the axis-parallel rectangles are determined to be intersecting.

[0043] A vectorization system for line segments in engineering drawings based on classification and merging includes a noise reduction module, a skeleton refinement module, a coordinate extraction module, a classification module, and a merging module;

[0044] The denoising module is used to denoise the image of the engineering drawing to obtain the image of the engineering drawing to be processed;

[0045] The skeleton refinement module is used to reduce the line width of the graphics in the engineering drawing image to be processed to a preset value, so as to obtain a skeleton-refined engineering drawing image.

[0046] The coordinate extraction module is used to extract the coordinates of line segments in the skeletonized engineering drawing image;

[0047] The classification module is used to classify the line segments in the engineering drawing image according to whether they are collinear based on the coordinates of the line segments in the engineering drawing image to obtain a set of collinear line segments;

[0048] The merging module is used to derive intersecting line segments based on the set of collinear line segments, and to merge all intersecting line segments in the engineering drawing image to complete the vectorization of the line segments.

[0049] Preferably, the classification module is specifically used for,

[0050] The line segments in the engineering drawings are categorized according to whether the angle between the line segments and the positive x-axis is the same, resulting in a set of line segments with the same angle.

[0051] Line segments with the same included angle are grouped according to whether they are collinear to obtain a set of collinear line segments.

[0052] Preferably, the merging module is specifically used for,

[0053] Expand each line segment in the set of collinear line segments into an axis-parallel rectangle, and determine whether any two axis-parallel rectangles intersect.

[0054] If two axis-parallel rectangles intersect, then the two line segments corresponding to the axis-parallel rectangles intersect; otherwise, the two line segments corresponding to the axis-parallel rectangles do not intersect.

[0055] The beneficial effects of this invention are:

[0056] This paper proposes a classification and merging algorithm. Based on the classification algorithm, line segments are classified according to whether they are collinear or not. Based on the merging algorithm, collinear and intersecting line segments are merged to obtain multiple longer line segments. This provides a complete line segment vectorization technology with low computational complexity and low computational resource overhead, while significantly improving accuracy. Attached Figure Description

[0057] Figure 1 A flowchart of the method for vectorizing line segments in engineering drawings based on classification and merging provided by the present invention;

[0058] Figure 2 This is a schematic diagram of how to obtain a line segment axis parallel rectangle provided by the present invention. Detailed Implementation

[0059] The present invention will be further described below with reference to the embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.

[0060] A method for vectorizing line segments in engineering drawings based on classification and merging, see [link to relevant documentation]. Figure 1 ,include,

[0061] Step 1: Use a graphics denoising algorithm to denoise the engineering drawing image to obtain the engineering drawing image to be processed:

[0062] Set the background of the engineering drawing image to black, and set the foreground and background color pixel values ​​to fg and bg, respectively.

[0063] The image of the engineering drawing is converted into a grayscale image, and then converted into a binary image according to the binarization threshold, where the color pixel value of each element in the drawing is fg or bg;

[0064] The noise in the binary image is removed by median filtering with a kernel size of ksize, resulting in the engineering drawing image to be processed.

[0065] The foreground fg of the engineering drawing data is set to 255, and the background bg is set to 0; the binarization threshold is set to 32; and the filter kernel size ksize is set to 3.

[0066] Step 2: Reduce the line width of the graphics in the engineering drawing image to a preset value (1 pixel) to obtain a skeletonized engineering drawing image:

[0067] Map the color value fg in the engineering drawing image to 1, and the color value bg to 0;

[0068] Based on the dilation and erosion algorithms of computer graphics, the line width of the graphics in the engineering drawing image to be processed is reduced to 1 pixel, resulting in a skeletonized engineering drawing image.

[0069] Step 3: Extract the coordinates of line segments from the skeletonized engineering drawing image:

[0070] The line segment recognition algorithm based on Hough transform extracts the coordinates of line segments in the skeletonized engineering drawing image. The set pixel movement distance is 1, pixel movement angle is π / 180, voting threshold is 80, minimum line segment length threshold is 80, and maximum interval length threshold is 5.

[0071] Step 4: Based on the coordinates of the line segments in the engineering drawing image, classify the line segments in the engineering drawing image according to whether they are collinear to obtain a set of collinear line segments:

[0072] Step 4-1, the set of line segments extracted by the line segment recognition algorithm based on Hough transform is: Among them l i Represents the i-th line segment. in Let x and y represent the starting x-coordinate, starting y-coordinate, ending x-coordinate, and ending y-coordinate of the i-th line segment, respectively; n is the total number of line segments; i takes the values ​​1, 2, ..., n.

[0073] Step 4-2: Calculate the angle between each line segment and the positive x-axis.

[0074]

[0075] Among them agl i Indicate l i The angle with the positive x-axis;

[0076] Step 4-3: Calculate the similarity of the angles between any two line segments and the positive x-axis. Set the similar angles to 1 and the different angles to 0. This yields the mask matrix P, which is a two-dimensional matrix. i,j 1 represents line segment l i With line segment l j The included angles are the same, P i,j A value of 0 indicates line segment l i With line segment l j The included angles are different; j takes values ​​of 1, 2, ..., n;

[0077] Step 4-4: Set set S, initialize it as an empty set, and set set LS. k Initialize to an empty set, with initial k set to 1; initial line segment index idx set to 1.

[0078] Step 4-5: If idx is greater than the total number of line segments n, proceed to step 4-8; otherwise, go to step 4-6.

[0079] Steps 4-6, determine line segment l idx If it belongs to set S, increment idx by 1 and go to step 4-5; otherwise, go to step 4-7.

[0080] Steps 4-7: At this point, there is no line segment l in set S. idx Then line segment l idx Add to set LS k In the middle, P is determined according to the mask matrix. idx,j =1, and line segment l idx All line segments with the same angle and an index greater than idx are added to the set LS. k In, and will set LS k Add it to set S, increment idx and k by 1, and then proceed to steps 4-5.

[0081] Steps 4-8 yield the set S, S = {LS1, LS2, ..., LS}. k , ...,LS z}, z is the total number of elements in set S; k = 1, 2, ..., z; that is, the line segment is divided into z subsets according to the angle of the line segment, and the angle of the line segment in each subset is the same;

[0082] Next, line segments with the same angle will be further divided according to whether they are collinear:

[0083] Steps 4-9, for the z subsets LS of set S k , set LS k The number of median segments is m k , will set LS k The indices of the midline segment are updated to 1, 2, ..., m. k Calculate the set LS k Collinearity of any two line segments within the matrix yields z mask matrices Q. k Mask matrix Q k It is a two-dimensional matrix, where Q ki,j A value of 1 indicates the set LS k line segment l in LSki With line segment l LSkj Collinear, Q ki,j A value of 0 indicates that the set LS k line segment l in LSki With line segment l LSkj Non-collinear, LSki takes values ​​of 1, 2, ..., m k LSKj takes values ​​of 1, 2, ..., m k Starting from LS1, the line segments are further divided.

[0084] Steps 4-10: Determine if k is greater than z. If yes, proceed to step 5; otherwise, set set T. k Initialize to an empty set, set set LTk d Initialize as an empty set, initial d is 1; initialize line segment index idx to 1, extract set LS k The line segment in;

[0085] Step 4-11, if idx is greater than m k If yes, proceed to step 4-14; otherwise, proceed to step 4-12.

[0086] Step 4-12, determine line segment l idx Does it belong to set T? k If yes, increment idx by 1 and proceed to step 4-11; otherwise, proceed to step 4-13.

[0087] Step 4-13, at this point set T k There is no line segment l in the middle idx , line segment l idx Add to set LTk dAccording to the mask matrix Q k Q ki,j =1, and line segment l idx All collinear line segments with indices greater than idx are added to the set LTk. d In, and will set LTk d Add to set T k In the middle, after incrementing idx and d by 1, proceed to step 4-11;

[0088] Step 4-14 yields set T. k ={LTk1, LTk2, ..., LTk} d , ..., LTk wk}, wk is a set T k The total number of elements, d = 1, 2, ..., wk, that is, the set LS is divided according to whether they are collinear. k The line segments are divided into wk subsets. After adding 1 to k, proceed to step 4-10.

[0089] Step 5: Based on the set of collinear line segments, merge intersecting line segments to complete the vectorization of line segments:

[0090] With set LTk d This example illustrates the process; other sets will be handled in the same way.

[0091] Step 5-1, obtain set LTk d The total number of elements is LTk d g, set LTk d The indices of the midline segment are updated to 1, 2, ..., LTk d g,

[0092] l LTkdi For set LTk d The LTkdi-th line segment is represented as in Representing line segment l respectively LTkdi The starting x-axis coordinate, starting y-axis coordinate, ending x-axis coordinate, ending y-axis coordinate; LTkdi takes values ​​of 1, 2, ..., LTk d g;

[0093] Step 5-2, see Figure 2 For line segment l LTkdi and line segment l LTkdj LTkdj takes values ​​of 1, 2, ..., LTk d g; Calculate their intersection:

[0094] Expand each line segment into an axis-parallel rectangle:

[0095] line segment l LTkdi The axis parallel rectangle is connected by line segment lLTkdi It is a diagonal line, and the endpoints are arranged in clockwise order as follows:

[0096] line segment l LTkdj The axis parallel rectangle is connected by line segment l LTkdj It is a diagonal line, and the endpoints are arranged in clockwise order as follows:

[0097] Step 5-3, calculate the intersection of these two axis parallel matrices:

[0098] Calculate line segments With line segment Does it intersect? Calculate the line segment. With line segment Do they intersect?

[0099] When line segment With line segment Line segments with no intersections With line segment When there are no intersection points, it is determined that rectangles parallel to the axis do not intersect, i.e., line segment l LTkdi and line segment l LTkdj If they do not intersect, then the rectangles parallel to the axis intersect, i.e., line segment l. LTkdi and line segment l LTkdj intersect.

[0100] Step 5-3: Merge the two intersecting line segments.

[0101] This invention also provides a vectorization system for line segments in engineering drawings based on classification and merging, including a noise reduction module, a skeleton refinement module, a coordinate extraction module, a classification module, and a merging module;

[0102] The denoising module is used to denoise the image of the engineering drawing to obtain the image of the engineering drawing to be processed;

[0103] The skeleton refinement module is used to reduce the line width of the graphics in the engineering drawing image to a preset value, so as to obtain a skeleton-refined engineering drawing image.

[0104] The coordinate extraction module is used to extract the coordinates of line segments in the skeletonized engineering drawing image;

[0105] The classification module is used to classify line segments in an engineering drawing image according to whether they are collinear, based on the coordinates of the line segments in the image, to obtain a set of collinear line segments.

[0106] The merging module is used to derive intersecting line segments based on a set of collinear line segments, and to merge all intersecting line segments in the engineering drawing image to complete the vectorization of the line segments.

[0107] The classification module is specifically used for,

[0108] The line segments in the engineering drawings are categorized according to whether the angle between the line segments and the positive x-axis is the same, resulting in a set of line segments with the same angle.

[0109] Line segments with the same included angle are grouped according to whether they are collinear to obtain a set of collinear line segments.

[0110] The merging module is specifically used for,

[0111] Expand each line segment in the set of collinear line segments into an axis-parallel rectangle, and determine whether any two axis-parallel rectangles intersect.

[0112] If two axis-parallel rectangles intersect, then the two line segments corresponding to the axis-parallel rectangles intersect; otherwise, the two line segments corresponding to the axis-parallel rectangles do not intersect.

[0113] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0114] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0115] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0116] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0117] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.

[0118] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A method for vectorization of line segments of engineering drawings based on class-based merging, characterized in that, include, Step 1: Denoise the engineering drawing image to obtain the engineering drawing image to be processed; Step 2: Reduce the line width of the graphics in the engineering drawing image to a preset value to obtain a skeletonized engineering drawing image; Step 3: Extract the coordinates of line segments from the skeletonized engineering drawing image; Step 4: Based on the coordinates of the line segments in the engineering drawing image, classify the line segments in the engineering drawing image according to whether they are collinear to obtain a set of collinear line segments; Step 5: Based on the set of collinear line segments, obtain the intersecting line segments, and merge all intersecting line segments in the engineering drawing image to complete the vectorization of the line segments; Specifically, the method of classifying line segments in the engineering drawing image based on their coordinates according to whether they are collinear to obtain a set of collinear line segments includes, Arrange the line segments in the engineering drawing image according to the line segments and We categorize line segments by whether the included angles along the positive axis are the same, thus obtaining a set of line segments with the same included angles. Line segments with the same included angle are grouped according to whether they are collinear to obtain a set of collinear line segments; The set of collinear line segments used to derive intersecting line segments includes, Expand each line segment in the set of collinear line segments into an axis-parallel rectangle, and determine whether any two axis-parallel rectangles intersect. If two axis-parallel rectangles intersect, then the two line segments corresponding to the axis-parallel rectangles intersect; otherwise, the two line segments corresponding to the axis-parallel rectangles do not intersect.

2. The method of claim 1, wherein the method further comprises: The process involves dividing the line segments in the engineering drawing image into line segments and... We categorize line segments by whether the included angles along the positive axis are the same, resulting in a set of line segments with the same included angles, including: Step 4-1, the set of line segments in the engineering drawing image is: ,in Indicates the first line segment ,in They represent the first The starting point of the line segment Axis coordinates, starting point Axis coordinates, endpoint Axis coordinates, endpoint Axis coordinates; This represents the total number of line segments; Values ; Step 4-2, calculate the angle between each line segment and the positive direction of the axis, the positive direction of the axis, wherein represents with the angle of the axis positive direction; Step 4-3, calculate the intersection of any two line segments. The similarity of the included angles along the positive axes yields the mask matrix. , It is a two-dimensional matrix, where A value of 1 indicates and The included angles are the same. 0 indicates and Different included angles; Values ; Step 4-4, Set up the collection Initialize as an empty set, set the set Initialized as an empty set, initial Set to 1; Initial line segment index =1; Steps 4-5, if Greater than If yes, proceed to step 4-8; otherwise, proceed to step 4-6. Steps 4-6, make judgments Does it belong to a set? If so, then If you add 1, proceed to step 4-5; otherwise, proceed to step 4-7. Steps 4-7, will Add to collection In, according to the mask matrix Will 1. and line segment All subscripts with the same angle are greater than Add the line segment to the set In, and will set Add to collection In the middle, Add 1 After adding 1, proceed to steps 4-5; Steps 4-8 yield the set. , , For set The total number of elements; .

3. The method of claim 2, wherein the method further comprises: The process of grouping line segments with the same included angle according to whether they are collinear to obtain a set of collinear line segments includes, Steps 4-9, set The subscript of the median segment is updated to ,in For set Count the number of median segments, calculate the set. The collinearity of any two line segments within the matrix yields the mask matrix. mask matrix It is a two-dimensional matrix, where A value of 1 indicates a set. The first in line segment With the line segment Collinear, A value of 0 indicates a set. In and Not collinear, Values Values ;initial If the value is 1, proceed to step 4-10; Steps 4-10, determine Is it greater than If yes, then end; otherwise, set the set. Initialize as an empty set, set the set Initialized as an empty set, initial Set to 1; initialize line segment subscripts. If the value is 1, extract the set. The line segment in; Step 4-11, if greater than go to Step 4-14; otherwise go to Step 4-12; Step 4-12, Determine Does it belong to a set? If so, then If you add 1, proceed to step 4-11; otherwise, proceed to step 4-13. Step 4-13, Add to collection According to the mask matrix Will 1, and All collinear indices are greater than Add the line segment to the set In, and will set Add to collection In the middle, Add 1, After adding 1, proceed to step 4-11; Step 4-14, obtain the set , For set The total number of elements ,Will After adding 1, proceed to steps 4-10.

4. The method for vectorizing line segments in engineering drawings based on classification and merging according to claim 1, characterized in that, The step of expanding each line segment in the set of collinear line segments into an axis-parallel rectangle includes: Get the set of collinear line segments ,gather The total number of elements is ,gather The subscripts of the median segment are as follows: ; For set The Middle A line segment, represented as ,in They represent The starting point Axis coordinates, starting point Axis coordinates, endpoint Axis coordinates, endpoint Axis coordinates; Values ; The axis parallel rectangle is defined by line segment It is a diagonal line, and the endpoints are arranged in clockwise order as follows: , , , .

5. The method for vectorizing line segments in engineering drawings based on classification and merging according to claim 4, characterized in that, The determination of whether any two axes of parallel rectangles intersect includes, Calculate line segments ( ) and line segment ( Does it intersect? Calculate the line segment. ) and line segment Do they intersect? They represent The starting point Axis coordinates, starting point Axis coordinates, endpoint Axis coordinates, endpoint Axis coordinates; Values ; The axis parallel rectangle is defined by line segment It is a diagonal line, and the endpoints are arranged in clockwise order as follows: , , , ; When line segment ( ) and line segment ( Line segments with no intersections ) and line segment If there is no intersection, the two axis-parallel rectangles are determined to be non-intersecting; otherwise, the axis-parallel rectangles are determined to be intersecting.

6. A vectorization system for line segments in engineering drawings based on classification and merging, characterized in that, It includes a noise reduction module, a skeleton refinement module, a coordinate extraction module, a classification module, and a merging module; The denoising module is used to denoise the image of the engineering drawing to obtain the image of the engineering drawing to be processed; The skeleton refinement module is used to reduce the line width of the graphics in the engineering drawing image to be processed to a preset value, so as to obtain a skeleton-refined engineering drawing image. The coordinate extraction module is used to extract the coordinates of line segments in the skeletonized engineering drawing image; The classification module is used to classify the line segments in the engineering drawing image according to whether they are collinear based on the coordinates of the line segments in the engineering drawing image to obtain a set of collinear line segments; The merging module is used to derive intersecting line segments based on the set of collinear line segments, and to merge all intersecting line segments in the engineering drawing image to complete the vectorization of the line segments; Specifically, the classification module is used for: Arrange the line segments in the engineering drawing image according to the line segments and We categorize line segments by whether the included angles along the positive axis are the same, thus obtaining a set of line segments with the same included angles. Line segments with the same included angle are grouped according to whether they are collinear to obtain a set of collinear line segments; Specifically, the merging module is used for: Expand each line segment in the set of collinear line segments into an axis-parallel rectangle, and determine whether any two axis-parallel rectangles intersect. If two axis-parallel rectangles intersect, then the two line segments corresponding to the axis-parallel rectangles intersect; otherwise, the two line segments corresponding to the axis-parallel rectangles do not intersect.