A method, system and electronic device for drawing components in a drawing
An automated method for extracting and fitting straight lines from architectural drawings in PDF format improves the efficiency and accuracy of component drawing by identifying intersection points, addressing the inefficiencies of manual PDF-based component extraction.
Patent Information
- Application Number
- CN202111476763.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-12-06
AI Technical Summary
In the field of architecture, manually drawing architectural components from PDF format drawings is inefficient due to the stacked representation of components, which lacks clear positional and dimensional information.
An automated method for extracting the contour chain of architectural components from a target area in a drawing, followed by straight-line fitting to decompose it into segments, and using image processing to identify intersection points for accurate component drawing.
Enhances the efficiency and accuracy of component drawing by automating the identification and placement of components based on intersection points, reducing data processing complexity and improving user interaction.
Smart Images

Figure CN114139240B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly relates to a method, a system and an electronic device for drawing components in a drawing. Background Art
[0002] In the construction field, construction drawings are usually imported into software in the dwg format. In drawings of this format, different layers can be represented by different colors. At the same time, the lines in the drawings are all displayed using vector graphics, so that information such as the position and size of components in the drawings can be clearly represented.
[0003] However, in some scenarios, construction drawings are represented in the PDF format. In drawings of the PDF format, all components are stacked together. In practical applications, for drawings of this format, manual drawing is usually used for modeling. Specifically, the modeler needs to identify the position of the component in the drawing and then manually draw the corresponding component in the software. This drawing method undoubtedly has low efficiency. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, a system and an electronic device for drawing components in a drawing, which can improve the efficiency of component drawing.
[0005] On the one hand, the present invention provides a method for drawing components in a drawing, the method including: for a target area to be processed in the drawing, extracting a contour chain of a component in the target area; performing linear fitting on the contour chain to disassemble the contour chain into multiple line segments; determining intersection points corresponding to the contour chain according to each of the disassembled line segments, and drawing corresponding components according to the intersection points.
[0006] In the present application, a contour chain of a component in a target area can be extracted, and the contour chain can characterize the shape of the component. By performing linear fitting on the contour chain, the contour chain can be disassembled into multiple line segments. The intersection points formed by each line segment can be used as the accurate positions where the components are located. The above process of identifying intersection points can be automatically implemented through image processing. Drawing components through the identified intersection points not only has high efficiency but also has high accuracy.
[0007] In one embodiment, before extracting the contour chain of the component in the target area, the method further includes: for any target pixel point on the component, extracting the neighborhood of the target pixel point, and determining whether the target pixel point is a pixel point that can be removed based on the pixel points included in the neighborhood; if so, removing the target pixel point from the component.
[0008] By performing a reduction process on the pixel points of the components in the target area, the amount of data to be processed can be reduced, thereby improving the efficiency of data processing.
[0009] In one embodiment, extracting the contour chain of the components in the target area includes: using a contour extraction function to link the pixel points on the components in a specified order to form the contour chain of the components.
[0010] The contour chain is obtained by sequentially linking the pixel points on the component. Subsequently, linear fitting can be performed according to the order of the pixel points, thereby improving the efficiency of linear fitting.
[0011] In one embodiment, performing linear fitting on the contour chain includes: constructing an auxiliary line segment with the starting point and the ending point of the contour chain as endpoints; calculating the distances from each pixel point in the contour chain to the auxiliary line segment. If the maximum value of the distances is greater than or equal to a specified distance threshold, using the pixel point corresponding to the maximum value of the distances as a critical point, splitting the contour chain into multiple sub-contour chains, and respectively performing linear fitting on each of the sub-contour chains.
[0012] By calculating the distances from each pixel point in the contour chain to the auxiliary line segment, it can be determined whether the auxiliary line segment can be used as the fitted line segment. If the maximum value of the distances is greater than or equal to the specified distance threshold, it indicates that the auxiliary line segment cannot be used as the fitted line segment. At this time, the original contour chain can be split, and linear fitting is continued for the split sub-contour chains. By splitting the contour chain, the rate of data processing can be improved.
[0013] In one embodiment, the method further includes: if the maximum value of the distances is less than the specified distance threshold, using the auxiliary line segment as the line segment obtained by disassembling.
[0014] If the maximum value of the distances is less than the specified distance threshold, it indicates that the auxiliary line segment at this time can be used as the fitted line segment. Through the determination of the distances, the fitting accuracy of the line segment can be improved.
[0015] In one embodiment, determining the intersection points corresponding to the contour chain includes: identifying the intersection points between the line segments, and determining the distances between each of the intersection points and the center point of the target area, so as to screen out target intersection points from each of the intersection points based on the determined distances, and using the target intersection points as the intersection points corresponding to the contour chain.
[0016] Within the target area, the intersection points can be screened according to the distances to the center point of the target area, so as to selectively feedback the required intersection points to the user.
[0017] In one embodiment, screening out target intersections from each of the intersections based on the determined distance includes: identifying the minimum distance among the distances, and if the minimum distance is less than a specified threshold, taking the intersection corresponding to the minimum distance as the screened-out target intersection.
[0018] Feeding back the intersection corresponding to the minimum distance to the user can ensure that the intersection near the mouse position is automatically fed back to the user, thereby improving the user's operation experience.
[0019] In one embodiment, extracting the contour chain of the component in the target area includes: extracting edge pixel points on the component in the target area, and using a contour extraction function to link each of the edge pixel points in a specified order to form the contour chain of the component.
[0020] Forming the contour chain of the component through edge pixel points can ensure a high degree of matching between the contour chain and the true shape of the component, thereby improving the accuracy of subsequent intersection recognition.
[0021] In one embodiment, determining the intersections corresponding to the contour chain according to each line segment obtained by disassembling includes: dividing the mutually parallel line segments among the line segments obtained by disassembling into the same line segment group; pairing the line segments in the same line segment group, and generating corresponding centerlines for the paired line segments; determining the intersections of each of the centerlines, and screening out the intersections corresponding to the contour chain from the intersections of each of the centerlines.
[0022] Mutually parallel line segments can determine intersections through centerlines, thereby improving the accuracy of intersection recognition.
[0023] In one embodiment, pairing the line segments in the same line segment group includes: for any target line segment in the same line segment group, searching along the gradient direction of the target line segment starting from the center point of the target line segment, and taking the first line segment searched as the line segment matched with the target line segment.
[0024] Searching for the first line segment along the gradient direction of the target line segment can avoid repeated searching processes, thereby improving the efficiency of data processing.
[0025] In one embodiment, before extracting the contour chain of the component in the target area, the method further includes: calculating the gray-level co-occurrence matrix of the target area, and identifying the filled area in the target area according to the eigenvalues of the gray-level co-occurrence matrix; extracting the contour chain of the component in the target area includes: identifying the edge pixel points of the filled area, and using a contour extraction function to link each of the edge pixel points in a specified order to form the contour chain of the component.
[0026] The eigenvalues based on the gray-level co-occurrence matrix can accurately identify the filled area. For the filled area, the contour chain can be generated according to the edge pixel points, thereby improving the recognition accuracy of subsequent intersection points.
[0027] On the other hand, the present invention also provides a component drawing system in a drawing. The system includes: a contour chain extraction unit for extracting the contour chain of a component in a target area to be processed in the drawing; a straight line fitting unit for fitting the contour chain into straight lines to disassemble the contour chain into multiple line segments; and an intersection point recognition unit for determining the intersection points corresponding to the contour chain according to the disassembled line segments and drawing the corresponding components according to the intersection points.
[0028] On the other hand, the present invention also provides an electronic device. The electronic device includes a memory and a processor. The memory is used to store a computer program. When the computer program is executed by the processor, the component drawing method in the above-mentioned drawing is implemented.
[0029] On the other hand, the present invention also provides a computer storage medium. The computer storage medium is used to store a computer program. When the computer program is executed by a processor, the component drawing method in the above-mentioned drawing is implemented. Description of the Drawings
[0030] The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings. The drawings are schematic and should not be construed as limiting the present invention in any way. In the drawings:
[0031] Figure 1 Shows a schematic diagram of the steps of the component drawing method in a drawing according to an embodiment of the present invention;
[0032] Figure 2(a) shows a schematic diagram of the lines of a component according to an embodiment of the present invention;
[0033] Figure 2(b) shows a schematic diagram of the lines of the component after opening operation according to an embodiment of the present invention;
[0034] Figure 3 Shows a schematic diagram of a contour chain according to an embodiment of the present invention;
[0035] Figure 4(a) shows a schematic diagram of an auxiliary line segment according to an embodiment of the present invention;
[0036] Figure 4(b) shows a schematic diagram of the first sub-contour chain obtained by splitting according to an embodiment of the present invention;
[0037] Figure 4(c) shows a schematic diagram of the second sub-contour chain obtained by splitting according to an embodiment of the present invention;
[0038] Figure 5Shows a flowchart for intersection point recognition according to the center line in an embodiment of the present invention;
[0039] Figure 6 Shows a schematic diagram of the functional modules of a component drawing system in a drawing in an embodiment of the present invention;
[0040] Figure 7 Shows a schematic diagram of the structure of an electronic device in an embodiment of the present invention. Detailed implementation manners
[0041] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0042] The component drawing method in the drawing provided by the present application can be applied to computer-aided software or an electronic device running the computer-aided software. In the computer-aided software, a drawing in PDF format can be displayed. Of course, in practical applications, the technical solution of the present application is not limited to the PDF format, but can be applied to various drawing formats as long as the drawing format can display the lines of the components.
[0043] Please refer to Figure 1 , the component drawing method in the drawing provided in an embodiment of the present application may include the following multiple steps.
[0044] S1: For a target area to be processed in a drawing, extract the contour chain of the components in the target area.
[0045] In this embodiment, the target area to be processed in the drawing may be an area within a certain range centered on the mouse position. By processing the image in the target area, the intersection point closest to the mouse position can be fed back to the user.
[0046] Please refer to Fig. 2(a). Generally speaking, after a component is imaged in a drawing, the width of the line is usually composed of multiple pixel points (black pixel points), not just a single pixel point. In this case, the edge of the component will be uneven, and there will be holes in some lines. To improve the accuracy of subsequent data processing, the image in the target area can be preprocessed to smooth the edge of the line and fill the holes in the line at the same time.
[0047] In practical applications, morphological opening can be used to process the image in the target area. Specifically, morphological opening can include operations of image erosion and image dilation. After performing erosion and dilation operations on the image in the target area successively, the jagged line edges can be processed to be smoother, and at the same time, some holes can also be filled. If there are still small holes in the lines of the component after morphological opening, the small holes can be determined by analyzing the connected components of the image, and filled with black pixel points. Finally, the result shown in Fig. 2(b) can be obtained through processing.
[0048] As can be seen from Fig. 2(b), the lines of the component usually have a certain width. To reduce the amount of data to be processed, the lines of the component can be thinned. The purpose of this thinning process is to represent the lines of the component by single pixel points. Specifically, the pixel points at the center line of the line can be retained, while the pixel points at other positions on the line can be removed, so as to achieve the purpose of thinning the line.
[0049] In one embodiment, the lines of the component can be thinned by neighborhood determination. For any target pixel point on the component, the neighborhood of the target pixel point can be extracted. Specifically, the range of the neighborhood can be preset. For example, the neighborhood can refer to a 3*3 pixel matrix centered on the target pixel point. Based on the pixel points included in the neighborhood, it can be determined whether the target pixel point is a pixel point that can be removed. Specifically, if the target pixel point is on the center line of the line, there will usually be more black pixel points in the neighborhood, while if the target pixel point is at the edge position of the line, there will be a certain number of white pixel points in the neighborhood. In view of this, by identifying the proportion of white pixel points in the neighborhood, it can be determined whether the target pixel point is located on the center line or at the edge. Among them, the target pixel points at the edge can be used as pixel points that can be removed. If it is determined that the target pixel point is a pixel point that can be removed, the target pixel point can be removed from the component. By traversing each pixel point on the component, the pixel points at the edge can be removed, so as to achieve the purpose of thinning.
[0050] In this embodiment, before analyzing the lines of the component, the contour chain of the component can be extracted, and the contour chain can be obtained by linking the pixel points on the component in a specified order. Specifically, the contour extraction function findContours() in opencv can be used to extract the pixel points on the component as an ordered contour chain. For example, in Figure 3 the extracted contour chain, the pixel points can be linked in the direction indicated by the arrow. In this contour chain, a starting point and an ending point can be included.
[0051] S3: Perform a linear fitting on the contour chain to disassemble the contour chain into multiple line segments.
[0052] In this embodiment, in order to effectively identify the intersection points of components within the target area, a linear fitting can be performed on the contour chain of the components, thereby disassembling the contour chain into multiple line segments.
[0053] Specifically, referring to Fig. 4(a), construct an auxiliary line segment with the starting point and the ending point of the contour chain as endpoints. This auxiliary line segment can be the thicker line segment in Fig. 4(a) (for ease of viewing, there is a certain gap between this auxiliary line segment and the original line segment, but actually this auxiliary line segment should coincide with the original line segment). Then, the distance from each pixel point in the contour chain to this auxiliary line segment can be calculated. The distance from a pixel point to this auxiliary line segment can be the length of the perpendicular line segment obtained by drawing a perpendicular from the pixel point to the straight line where this auxiliary line segment is located. Then, the maximum value of the distances can be screened out, and then this maximum value of the distances is compared with a specified distance threshold. If the maximum value of the distances is greater than or equal to the specified distance threshold, it indicates that the contour chain needs to be further split. At this time, taking the pixel point corresponding to the maximum value of the distances as the critical point, the contour chain can be split into multiple sub - contour chains, and linear fitting is performed on each sub - contour chain respectively.
[0054] For example, the pixel point corresponding to the maximum value of the distances in Fig. 4(a) is marked as the turning point. From the original starting point to this turning point, the first sub - contour chain shown in Fig. 4(b) can be split. In the first sub - contour chain, the turning point becomes the ending point. From the turning point to the original ending point, the second sub - contour chain shown in Fig. 4(c) can be split. In the second sub - contour chain, the turning point becomes the starting point.
[0055] Subsequently, for each sub - contour chain, it can continue to be judged in the above - mentioned manner whether the sub - contour chain needs to be further split. Through this form of hierarchical splitting, finally, the maximum value of the distances will be less than the above - mentioned specified distance threshold. In this way, the auxiliary line segment can be used as the line segment disassembled from the contour chain. For example, the contour chain shown in Fig. 4(a) will finally be disassembled into four line segments numbered 1 to 4.
[0056] S5: Determine the intersection points corresponding to the contour chain according to the disassembled line segments, and draw the corresponding components according to the intersection points.
[0057] In this embodiment, after disassembling the contour chain into multiple line segments, the intersection points between each line segment can be identified. These intersection points can all represent the real positions of the components, and drawing the components based on these intersection points can achieve a relatively high modeling accuracy.
[0058] To provide feedback to the user on the intersection points relatively close to the mouse position, the distances between each intersection point and the center point of the target area can be determined. Among them, the center point of the target area can be the mouse position. Based on the determined distances, the target intersection points can be filtered out from each intersection point, and the target intersection points can be fed back to the user as the intersection points corresponding to the contour chain. Specifically, after calculating the distances between each intersection point and the center point, the minimum distance among the distances can be identified. If the minimum distance is less than the specified threshold, it indicates that the intersection point is relatively close to the mouse position. At this time, the intersection point corresponding to the minimum distance can be fed back to the user as the filtered target intersection point.
[0059] It can be seen that in the present application, the contour chain of the component in the target area can be extracted, and the contour chain can characterize the shape of the component. By performing linear fitting on the contour chain, the contour chain can be disassembled into multiple line segments. The intersection points formed by each line segment can be used as the accurate positions where the component is located. The above process of identifying intersection points can be automatically implemented through image processing. Drawing the component through the identified intersection points not only has high efficiency but also has high accuracy.
[0060] In practical applications, after the lines of the component are refined, the obtained lines may deviate from the center line of the original lines, resulting in inaccurate identification of subsequent intersection points. In view of this, in one embodiment, when extracting the contour chain of the component in the target area, edge pixel points can be extracted on the component, and the contour extraction function can be used to link each edge pixel point in a specified order to form the contour chain of the component. Generating the contour chain of the component through edge pixel points can accurately describe the original shape of the component lines.
[0061] Please refer to Figure 5 , after generating the contour chain of the component according to the extracted edge pixel points, the contour chain can be linearly fitted in the above manner, so as to disassemble and obtain multiple line segments corresponding to the contour chain. In the contour chain generated based on edge pixel points, there will be some parallel line segments. To avoid identifying redundant intersection points, the parallel line segments can be paired, and intersection point identification can be performed based on the paired results.
[0062] Specifically, the mutually parallel line segments among the disassembled line segments can be divided into the same line segment group, and then the line segments in the same line segment group can be paired, and the corresponding center line can be generated for the paired line segments. The center line can represent the position of the two mutually parallel line segments in a compromising manner. Finally, the intersection points of each center line can be determined, and the intersection points corresponding to the contour chain can be filtered out from the intersection points of each center line.
[0063] In practical applications, when pairing each line segment in the same line segment group, the line segments can be sorted by length first, and then, in the order from short to long, each line segment can be paired in turn. Specifically, for any target line segment in the same line segment group, starting from the center point of the target line segment, a search can be conducted along the gradient direction of the target line segment. This gradient direction can refer to the direction perpendicular to the target line segment. The first line segment found can be used as the line segment that matches the target line segment. In this way, through the gradient search method, the line segments can be paired.
[0064] In one implementation, after generating the center lines for the paired line segments, multiple collinear center lines can be merged into one, thereby reducing the amount of data to be processed. After merging the center lines, the intersection points of each center point can be determined. For the determined intersection points, the distances from the center points can be calculated in turn according to the above method, and it can be judged whether to feedback the intersection points to the user based on the distances.
[0065] In practical applications, there may be filled areas in some components. This filled area is usually filled with different forms of filling patterns in order to represent the material of the primitive. For the filled area, the edge pixel points can be extracted, and the intersection points can be identified based on the line segments formed by the edge pixel points.
[0066] Specifically, the gray-level co-occurrence matrix of the target area can be calculated, and the filled area in the target area can be identified based on the eigenvalues of the gray-level co-occurrence matrix. When calculating the gray-level co-occurrence matrix, a 5*5 neighborhood can be used for calculation. At the same time, in order to be compatible with the slight changes in gray level and reduce the size of the matrix, the gray-level values of each pixel point in each target area can be divided by 32 for calculation. In practical applications, the gray-level co-occurrence matrices in four directions can be calculated, and the average value of these four directions can represent the overall gray-level co-occurrence matrix of the target area.
[0067] In this implementation, after calculating the gray-level co-occurrence matrix, the eigenvalues of the gray-level co-occurrence matrix can be analyzed to identify the filled area existing in the target area.
[0068] In practical applications, the eigenvalues of the gray-level co-occurrence matrix can include energy, entropy, contrast, inverse difference moment, etc. In order to distinguish the filled area and the non-filled area in the target area, the entropy can be used as the eigenvalue to be analyzed. If the entropy is greater than or equal to the specified eigenvalue threshold, it indicates that there is a filled area in the target area.
[0069] In this embodiment, the edge pixel points of the filled area can be identified, and the contour extraction function is used to link the edge pixel points of the filled area in a specified order to form the contour chain of the component. Subsequently, the contour chain can be disassembled into multiple line segments by means of line fitting, and the intersection points between the line segments can be determined. The target intersection point for feedback to the user can be determined based on the distance between the intersection point and the center point.
[0070] Please refer to Figure 6 , this application also provides a component drawing system in a drawing, and the system includes:
[0071] A contour chain extraction unit, configured to extract the contour chain of the component in the target area to be processed in the drawing;
[0072] A line fitting unit, configured to perform line fitting on the contour chain to disassemble the contour chain into multiple line segments;
[0073] An intersection point recognition unit, configured to determine the intersection points corresponding to the contour chain according to the line segments obtained by disassembly, and draw the corresponding component according to the intersection points.
[0074] Please refer to Figure 7 , this application also provides an electronic device, the electronic device includes a memory and a processor, the memory is used to store a computer program, and when the computer program is executed by the processor, the component drawing method in the above-mentioned drawing is implemented.
[0075] This application also provides a computer storage medium, the computer storage medium is used to store a computer program, and when the computer program is executed by a processor, the component drawing method in the above-mentioned drawing is implemented.
[0076] In this application, the processor may be a Central Processing Unit (CPU). The processor may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. chips, or a combination of the above types of chips.
[0077] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the method in the embodiments of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions, and modules stored in the memory, that is, to implement the method in the above method embodiments.
[0078] The memory may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created by the processor and the like. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely set relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0079] Those skilled in the art can understand that to implement all or part of the processes in the above method embodiments, it can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it may include the processes of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memories.
[0080] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for drawing components in a drawing, characterized in that, The method includes: For a target area to be processed in a drawing, extract the contour chain of components in the target area; Perform linear fitting on the contour chain to disassemble the contour chain into multiple line segments; Based on each line segment obtained by disassembly, determine the intersection points corresponding to the contour chain, and draw the corresponding components according to the intersection points; Wherein, the performing linear fitting on the contour chain includes: Construct an auxiliary line segment with the starting point and the ending point of the contour chain as endpoints; Calculate the distance from each pixel point in the contour chain to the auxiliary line segment. If the maximum value of the distances is greater than or equal to a specified distance threshold, use the pixel point corresponding to the maximum value of the distances as a critical point to disassemble the contour chain into multiple sub - contour chains, and perform linear fitting on each of the sub - contour chains respectively.
2. The method according to claim 1, wherein Before extracting the contour chain of components in the target area, the method further includes: For any target pixel point on the component, extract the neighborhood of the target pixel point, and based on the pixel points included in the neighborhood, determine whether the target pixel point is a pixel point that can be removed; if so, remove the target pixel point from the component.
3. The method according to claim 1 or 2, characterized in that, Extracting the contour chain of components in the target area includes: Use a contour extraction function to link the pixel points on the component in a specified order to form the contour chain of the component.
4. The method according to claim 1, wherein The method further includes: If the maximum value of the distances is less than the specified distance threshold, use the auxiliary line segment as the line segment obtained by disassembly.
5. The method according to claim 1, wherein Determining the intersection points corresponding to the contour chain includes: Identify the intersection points between the line segments, and determine the distances between each of the intersection points and the center point of the target area. Based on the determined distances, screen out target intersection points from each of the intersection points, and use the target intersection points as the intersection points corresponding to the contour chain.
6. The method according to claim 5, characterized in that Screening out target intersection points from each of the intersection points based on the determined distances includes: Identify the minimum distance among the distances. If the minimum distance is less than a specified threshold, use the intersection point corresponding to the minimum distance as the screened - out target intersection point.
7. The method according to claim 1, characterized in that Extracting the contour chain of components in the target area includes: Extract edge pixel points on the component in the target area, and use a contour extraction function to link each of the edge pixel points in a specified order to form the contour chain of the component.
8. The method according to claim 7, wherein Determining the intersection points corresponding to the contour chain according to each line segment obtained by disassembly includes: Divide the mutually parallel line segments among the line segments obtained by disassembly into the same line segment group; Pair the line segments in the same line segment group, and generate corresponding center lines for the paired line segments; Determine the intersection points of each of the center lines, and screen out the intersection points corresponding to the contour chain from the intersection points of each of the center lines.
9. The method according to claim 8, wherein Pairing the line segments in the same line segment group includes: For any target line segment in the same line segment group, search along the gradient direction of the target line segment starting from the center point of the target line segment, and use the first line segment found as the line segment that matches the target line segment.
10. The method according to claim 1, characterized in that, Before extracting the contour chain of components in the target area, the method further includes: Calculate the gray-level co-occurrence matrix of the target area, and identify the filled area in the target area according to the eigenvalues of the gray-level co-occurrence matrix; Extracting the contour chain of the component in the target area includes: Identifying the edge pixel points of the filled area, and using a contour extraction function to link each of the edge pixel points in a specified order to form the contour chain of the component.
11. A component drawing system in a drawing, characterized in that, The system includes: A contour chain extraction unit, configured to extract the contour chain of the component in the target area for the target area to be processed in the drawing; A straight line fitting unit, configured to perform straight line fitting on the contour chain to disassemble the contour chain into multiple line segments; An intersection point identification unit, configured to determine the intersection points corresponding to the contour chain according to each of the line segments obtained by disassembly, and draw the corresponding component according to the intersection points; Wherein, the straight line fitting unit is configured to perform straight line fitting on the contour chain, specifically including: Constructing an auxiliary line segment with the starting point and the ending point of the contour chain as endpoints; Calculating the distance from each pixel point in the contour chain to the auxiliary line segment, and if the maximum value of the distance is greater than or equal to a specified distance threshold, using the pixel point corresponding to the maximum value of the distance as a critical point to disassemble the contour chain into multiple sub-contour chains, and respectively performing straight line fitting on each of the sub-contour chains.
12. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory is used to store a computer program, and when the computer program is executed by the processor, the method described in any one of claims 1 to 10 is implemented.
13. A computer storage medium, characterized in that, The computer storage medium is used to store a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Vector building drawing based method for reconstructing three-dimensional model
CN101673410A