Computer Vision-Based Cross-Section Drawing Method and System
Through the cross-section drawing method based on computer vision, the geometric features of the special-shaped section are quickly extracted and drawn on the CAD drawing using the element recognition model, which solves the problem of inefficient drawing of special-shaped section drawings, and achieves efficient and accurate cross-section drawing.
Patent Information
- Application Number
- CN202510193647.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-02-21
AI Technical Summary
During construction, the drawing of special-shaped cross-section drawings is inefficient, especially when drawing hand-painted sections on CAD drawings, it takes a lot of time and effort.
Using a cross-section drawing method based on computer vision, the geometric features of the hand-drawn section are quickly extracted through the element recognition model, and drawn on the drawing according to the diagram. The method includes acquiring image information, identifying element information, judging the enclosure of contour lines, acquiring internal and external contour point information, corresponding point information and dimension marking information, and finally drawing a cross-section.
Improves the efficiency of special-shaped section drawing, reduces the time and effort of manual drawing, ensures the accuracy of drawing, and supports batch drawing of the same type of sections.
Smart Images

Figure CN119691876B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a cross-section drawing method and system based on computer vision, belonging to the field of intelligent construction in civil engineering. Background Art
[0002] During the building construction process, the cross-section design of components and members is a crucial link. Traditionally, this process may involve manually drawing the approximate shape of the cross-section on paper for staff to conduct preliminary conceptualization and planning. After the concept is completed, the cross-section outline is manually drawn and marked on CAD drawings.
[0003] For cross-sections with relatively regular shapes, such as rectangles and circular tubes, the drawing of component cross-sections is relatively convenient. However, when it comes to non-standard or irregular shaped cross-sections, the process of drawing cross-section sketches on paper is relatively convenient, but it is rather troublesome to manually draw these irregular cross-sections onto CAD drawings, which requires a large amount of time and effort, resulting in low efficiency of drawing the drawings. Summary of the Invention
[0004] Aiming at the problem of low efficiency in the existing drawing method for irregular cross-section drawings, the present invention provides a cross-section drawing method and system based on computer vision that can quickly extract the geometric features of hand-drawn cross-sections and draw them on the drawings according to the illustrated markings.
[0005] To solve the above technical problems, the present invention includes the following technical solutions:
[0006] A cross-section drawing method based on computer vision, comprising the following steps:
[0007] Step 1, obtaining the image information of the cross-section to be drawn;
[0008] Step 2, obtaining the primitive information in the image information through a primitive recognition model, where the primitive information includes a plurality of key points and dimension marking information;
[0009] Step 3, judging whether the contour line of the cross-section to be drawn is a closed line shape according to the key points;
[0010] Step 4, if so, obtaining the inner contour and outer contour of the cross-section to be drawn, and the part between the inner contour and the outer contour is the range of the cross-section to be drawn;
[0011] Step 5, obtaining the point position information of the cross-section to be drawn according to the key points of the inner contour and the outer contour;
[0012] Step 6, corresponding the point position information with the dimension marking information primitive information to obtain a corresponding result;
[0013] Step Seven, draw the cross-section according to the corresponding result.
[0014] Further, in Step Two, the step of obtaining the primitive information in the image information through a primitive recognition model, where the primitive information includes multiple key points and dimension annotation information, includes:
[0015] The primitives in the primitive information include at least one of a straight line, an arc, or a spline curve. The key points are at least two of the starting point, ending point, center point, or inflection point of the primitive, and the dimension annotation information includes the coordinate information and dimension information of the key points.
[0016] Further, after Step Two, the following steps are also included:
[0017] Step S210, determine whether the distance between two key points is less than a preset value;
[0018] Step S220, if so, merge the two key points;
[0019] Step S230, merge the remaining key points according to Step S210 and Step S220 to obtain multiple key points.
[0020] Further, in Step Three, the step of determining whether the contour line of the cross-section to be drawn is a closed line shape according to the key points includes:
[0021] Step S310, select one primitive, with one end of the primitive being the first key point and the other end being the second key point;
[0022] Step S312, determine whether the second key point is connected to other primitives;
[0023] Step S314, if so, set the end of the primitive away from the second key point as the third key point;
[0024] Step S316, traverse the remaining primitives according to the methods of Step S312 and Step S314 to determine whether it is possible to return to the first key point;
[0025] Step S318, if so, the contour line of the cross-section to be drawn is a closed line shape.
[0026] Further, in Step Five, the step of obtaining the point position information of the cross-section to be drawn according to the key points of the inner contour and the outer contour includes:
[0027] Step S510, obtain the primitive information corresponding to the inner contour and the outer contour;
[0028] Step S512, calculate the inclination angle of the line connecting the starting point and the ending point of each primitive;
[0029] Step S514: When the inclination angle is less than the first preset angle, set the vertical coordinates of the starting point and the ending point of the graphic element to be the same, and the obtained coordinate information is the point position information of the graphic element;
[0030] Step S516: When the inclination angle is greater than the second preset angle, set the horizontal coordinates of the starting point and the ending point of the graphic element to be the same, and the obtained coordinate information is the point position information of the graphic element;
[0031] Traverse the line graphic elements according to the method of Step S512 to Step S516 to obtain multiple pieces of the point position information;
[0032] Step S518: Calculate the inclination angle of the connection line between any two key points that are not on the same graphic element, and merge the vertical coordinates or horizontal coordinates of the key points according to the methods of Step S514 and Step S516 to obtain the point position information.
[0033] Furthermore, in the sixth step, the step of corresponding the point position information with the dimension annotation information to obtain the corresponding result includes:
[0034] Step S610: Obtain the endpoint coordinates of the graphic element according to the dimension annotation information;
[0035] Step S612: Obtain the point position information closest to the endpoint according to the endpoint coordinates;
[0036] Step S614: Obtain the corresponding key point according to the point position information, and the point position information corresponds to the dimension annotation information to obtain the corresponding result;
[0037] Step S616: Traverse the dimension annotation information of the remaining graphic element information to obtain multiple corresponding results.
[0038] Furthermore, the dimension annotation information includes the drawing length between two key points; the point position information includes the pixel length between two key points, and the corresponding result includes the ratio of the pixel length to the drawing length.
[0039] Furthermore, in the seventh step, the step of drawing the cross-section according to the corresponding result includes:
[0040] Step S710: Establish a drawing coordinate system;
[0041] Step S712: Obtain the drawing length of the key point according to the corresponding result;
[0042] Step S714: Determine the coordinates of the key point in the drawing coordinate system according to the point position information;
[0043] Step S716: Draw the contour of the cross-section according to the coordinates and the drawing length.
[0044] Furthermore, after the above Step Seven, there is also a step of batch drawing.
[0045] The system for the cross-section drawing method based on computer vision described above includes:
[0046] An information acquisition module, configured to acquire the image information of the cross-section to be drawn;
[0047] A primitive recognition module, which obtains the primitive information in the image information through a primitive recognition model, and the primitive information includes multiple key points and dimension annotation information;
[0048] An identifiability determination module, configured to determine whether the contour line of the cross-section to be drawn is a closed line shape according to the key points; if so, obtain the inner contour and the outer contour of the cross-section to be drawn, and the part between the inner contour and the outer contour is the range of the cross-section to be drawn;
[0049] A point position information acquisition module, which acquires the point position information of the cross-section to be drawn according to the key points of the inner contour and the outer contour;
[0050] A dimension annotation correspondence module, which corresponds the point position information with the dimension annotation information primitive information to obtain a correspondence result;
[0051] A cross-section drawing module, configured to draw the cross-section according to the correspondence result.
[0052] Due to the adoption of the above technical solutions, compared with the prior art, the cross-section drawing method and system based on computer vision of the present invention can quickly extract the geometric features of the cross-section to be drawn by using computer vision technology and a primitive recognition model, and can draw them on a CAD drawing, solving the cumbersome problems in the drawing process of special-shaped cross-sections and improving the drawing efficiency. Description of the Drawings
[0053] Figure 1 It is a flowchart of the cross-section drawing method based on computer vision in an embodiment;
[0054] Figure 2 It is a schematic diagram of a hand-drawn special-shaped cross-section in an embodiment;
[0055] Figure 3 It is a flowchart of the merging of key points in an embodiment;
[0056] Figure 4 It is a flowchart of determining whether the contour line of the cross-section to be drawn is a closed line shape according to the key points in an embodiment;
[0057] Figure 5 Flow chart for obtaining point position information of a cross-section to be drawn according to key points of an inner contour and an outer contour in an embodiment
[0058] Figure 6 Flow chart for corresponding point position information with dimension annotation information to obtain a corresponding result in an embodiment
[0059] Figure 7 Effect diagram of cross-section drawing in an embodiment
[0060] Figure 8 Flow chart for drawing a cross-section according to a corresponding result in an embodiment
[0061] Figure 9 Batch drawing of point position information of cross-sections in an embodiment
[0062] Figure 10 Effect diagram of batch drawing in an embodiment
[0063] Figure 11 Cross-section drawing system based on computer vision in an embodiment Specific implementation manners
[0064] The following further elaborates on the computer vision-based cross-section drawing method and system provided by the present invention in conjunction with the accompanying drawings and specific embodiments. In combination with the following description, the advantages and features of the present invention will be clearer. It should be noted that the accompanying drawings are all in a very simplified form and use non-precise scales, only for conveniently and clearly assisting in explaining the purpose of the embodiments of the present invention.
[0065] The computer vision-based cross-section drawing method of the present invention can be used to draw a hand-drawn cross-section onto a CAD drawing. Among them, the cross-section can be either a relatively regular cross-section or a special-shaped cross-section with an irregular and non-standard shape. Compared with the existing special-shaped cross-section drawing methods, the present invention has higher efficiency in drawing special-shaped cross-sections. The following will describe the computer vision-based cross-section drawing method of the present invention in conjunction with embodiments. Embodiment 1
[0066] As Figure 1 shown, the computer vision-based cross-section drawing method in an embodiment includes the following steps:
[0067] Step 1 S10, obtaining image information of the cross-section to be drawn. As Figure 2 shown, generally, the user hand-draws the cross-section to be drawn on the drawing. The hand-drawn graphic of the cross-section can be converted into a picture format by means of photographing, scanning, etc., to facilitate subsequent application to computer vision recognition. As Figure 2As shown, when hand-drawing a drawing, the dimensional information of each cross-section and line segment will be marked on the drawing. For example, the length of the line segment forming the cross-section, the width between line segments, the radian, etc. That is, the dimensional annotation information will be marked on the hand-drawn drawing to facilitate the subsequent staff to accurately draw the drawing when drawing.
[0068] Step S20, obtain the primitive information in the image information through the primitive recognition model, and the primitive information includes multiple key-point information and dimensional annotation information.
[0069] An irregular cross-section generally includes multiple types of primitives, such as straight lines, curves, arcs, etc. When the primitive types of the irregular cross-section and the key points forming these primitives are determined, the shape of the irregular cross-section can be determined.
[0070] In this embodiment, the primitives in the primitive information include at least one of straight lines, arcs or spline curves, and the key points are at least two of the starting point, ending point, center point or inflection point of the primitive. For different types of primitives, the corresponding key-point types are also different. The key points refer to the points in the cross-section that can represent the entire cross-section. By determining the coordinates of these key points, the cross-section contour can be drawn.
[0071] If the cross-section is a regular shape, such as a rectangle or a circle, at this time, the primitives of the cross-section contour are generally composed of one type of line, such as a straight line or an arc. If the cross-section shape is an irregular shape, such as an irregular cross-section, at this time, the cross-section contour will be composed of multiple lines. For different types of primitives, the setting method of the key points is as follows:
[0072] When the primitive is a straight line, the key points include the starting point and the ending point of the straight line.
[0073] When the primitive is an arc, the key points include the starting point, the ending point and the center point of the arc.
[0074] When the primitive is a spline curve, the key points include the starting point, the ending point and the inflection point of the spline curve.
[0075] Through the primitive recognition model, the primitive information in the cross-section image information can be obtained, including the primitive types included in the cross-section picture, such as straight lines, arcs and spline curves, the coordinate information of the starting point, ending point and inflection point of the straight line, arc and spline curve, and the dimensional annotation information of each primitive. The primitive recognition model can either adopt a trained model or train a deep learning model according to the following method using an existing data set.
[0076] Specifically, in this embodiment, the method for establishing the primitive recognition model includes the following steps:
[0077] A dataset is established, which contains a series of pictures of special-shaped cross-sections and the corresponding annotation information. The corresponding labels are: the starting point, ending point, center point, and inflection point information of straight lines, arcs, and spline curves in each cross-section picture, as well as the dimension labels in the cross-section image and the two end points and values of the labels. To ensure generality, when there is a circle in the cross-section, the label of the circle is set to be composed of two arcs.
[0078] The interface information recognition model is trained using the dataset to obtain a model that can recognize primitive elements such as straight lines, arcs (including the centers of arcs), and spline curves, that is, a primitive element recognition model.
[0079] When using the primitive element recognition model, the upper left corner of the image can be defined as the coordinate origin, the horizontal right direction is the positive direction of the X-axis, the vertical downward direction is the Y-axis, and the coordinates of the recognized key points are the pixel positions of the points on the X-axis and Y-axis. The image information of the cross-section obtained in step S10 is input into the primitive element recognition model, and the output result is the primitive element information in the image information, including the line type, key point coordinates, and corresponding dimension annotation information.
[0080] Furthermore, as Figure 3 shown, in this embodiment, after the step of obtaining the primitive element information in the image information through the primitive element recognition model in step S20, where the primitive element information includes multiple key points and dimension annotation information, there is also a step of merging the key points. Through the primitive element recognition model, the primitive elements, key points of the primitive elements, and corresponding dimension annotation information included in the cross-section image information can be obtained.
[0081] When two primitive elements are adjacent primitive elements, for example, line segment 1 and line segment 2 are adjacent and connected, and the connection point is point O. When the primitive element recognition model recognizes line segment 1, it will recognize point O as a key point of line segment 1, and when recognizing line segment 2, it will also recognize point O as a key point of line segment 2. That is, point O is both a key point of line segment 1 and a key point of line segment 2. Merging the same key point can reduce the number of key points and improve the recognition efficiency.
[0082] Please continue to refer to Figure 3 , in this embodiment, the step of merging the key points is specifically as follows:
[0083] Step S210, determine whether the distance between two key points is less than a preset value. In step S20, the pixel coordinates of each key point are obtained. Taking key point P1 and key point P2 as examples, the coordinates of P1 are (Xa, Ya), and the coordinates of P2 are (Xb, Yb). The distance between key point P1 and key point P2 can be obtained by calculating the Euclidean distance between the two points to get the length of the line segment.
[0084] Step S220: If so, merge two key points. If the distance between two key points is less than a preset value, these two key points are considered to be the same key point. For example, if the preset value is set to a distance of 5 pixels, and the distance between key point P1 and key point P2 is less than 5 pixels, then P1 and P2 are considered to be the same key point. At this time, merge these two key points. For example, merge the coordinates of P1 and P2 into (Xa, Ya). When merging the coordinates of key points, the corresponding primitive also follows the key points for merging.
[0085] Step S230: Merge the remaining key points according to Step S210 and Step S220 to obtain multiple key points. Merge all the key points in sequence according to the above method to obtain a series of key points, and the coordinates of these key points are (X1, Y1), (X2, Y2), (X3, Y3) ……, (Xn, Yn). It should be noted that the preset value can be selected as an appropriate value according to actual needs and is not limited here.
[0086] Step S30: Determine whether the contour line of the cross-section to be drawn is a closed line shape according to the key points. The contour in the cross-section is continuous itself. Therefore, each line existing in the cross-section should be closed and non-intersecting, and the closed lines form the contour of the cross-section.
[0087] As Figure 4 shown, in this embodiment, the steps of determining whether the contour line of the cross-section to be drawn is a closed line shape according to the key points include:
[0088] Step S310: Select a primitive, with one end of the primitive being the first key point and the other end being the second key point. For any primitive, the endpoints on both sides of it are key points. Therefore, for any key point, the number of primitives connected to it should not exceed two. For example, take a straight line as an example, with the starting point of the straight line being the first key point and the ending point being the second key point.
[0089] Step S312: Determine whether the second key point is connected to other primitives. In Step S20, all the key point coordinates and the corresponding primitive types in the cross-section image information have been obtained according to the primitive recognition model. At this time, read the coordinates of the second key point and the corresponding primitive information. For example, if the second key point corresponds to both primitive A and primitive B, then it is considered that the second key point is connected to other primitives.
[0090] Step S314: If so, set the end of the primitive far from the second key point as the third key point. Still taking primitive A and primitive B as an example, the first key point is the starting point of primitive A, the second key point is the ending point of primitive A and the starting point of primitive B, then the third key point is the endpoint of primitive B.
[0091] Step S316: Traverse the remaining primitive elements according to the methods in Step S312 and Step S314, and determine whether it is possible to return to the first key point. Starting from the third key point, traverse the remaining primitive elements.
[0092] Step S318: If so, the contour line of the cross-section to be drawn is a closed line. After traversing all the primitive elements and returning to the first key point, it is determined that the contour line is a closed line, and it is judged that the image of the cross-section to be drawn is an identifiable image. If it is impossible to traverse to the next primitive element or return to the first key point, it is judged that the cross-section image is an unidentifiable cross-section image, and the recognition ends.
[0093] According to the methods in the above Steps S310 - S318, multiple closed lines of the cross-section to be drawn can be obtained.
[0094] Step Four S40: If so, obtain the inner contour and outer contour of the cross-section to be drawn, and the part between the inner contour and the outer contour is the range of the cross-section to be drawn. The types of closed lines include two kinds, one is the inner contour of the contour cross-section, and the other is the outer contour of the contour cross-section. In Step Three S30, the line with the largest area among the identified closed lines is the outer contour, and the other closed lines are the inner contours. The part between the inner contour and the outer contour is the range of the cross-section to be drawn.
[0095] Step Five S50: Obtain the point position information of the cross-section to be drawn according to the key points of the inner contour and the outer contour. The inner contour and the outer contour include multiple primitive elements. Taking the hand-drawn cross-section shown in Figure 2 as an example, the inner contour includes 4 primitive elements, which are 4 straight lines respectively. The outer contour includes 12 primitive elements, which are 12 straight lines respectively. When the primitive element is a straight line, when the two endpoint information of the straight line is determined at the same time, the range between the inner contour and the outer contour can be determined.
[0096] As shown in Figure 5 , in this embodiment, obtaining the point position information of the cross-section to be drawn according to the key points of the inner contour and the outer contour includes the following steps:
[0097] Step S510: Obtain the primitive element information corresponding to the inner contour and the outer contour. According to Step S20, the primitive element information in the cross-section image has been identified. Taking the cross-section image information shown in Figure 2 as an example, the inner contour includes 4 primitive elements, and the corresponding primitive element information includes the coordinate information of 4 key points I 1 , I 2 , I 3 , I 4 , which are (X I1 , Y I1 ), (X I2 , Y I2 ), (X I3 , Y I3 ), (XI4 , Y I4 ). At the same time, the outer contour includes 12 primitive elements, and the corresponding primitive element information includes 12 key points E 1 , E 2 , E 3 ...... E 12 's coordinate information, which are (X E1 , Y E1 ), (X E2 , Y E2 ), (X E3 , Y E3 )...... (X E12 , Y E12 ).
[0098] Step S512, calculate the inclination angle of the line connecting the starting point and the ending point of each primitive element. The inclination angle is the angle between the line connecting the starting point and the ending point and the horizontal line, and the range of the angle is between 0° and 90°.
[0099] Step S514, when the inclination angle is less than the first preset angle, set the vertical coordinates of the starting point and the ending point of the primitive element to be the same, and the obtained coordinate information is the point position information of the primitive element. For example, when the inclination angle of the line connecting the starting point and the ending point of a certain primitive element is less than 10°, it is considered that the starting point and the ending point of this primitive element are on the same horizontal line. Taking Figure 2 's I 1 (X I1 , Y I1 ) and I 4 (X I4 , Y I4 ) as an example, I1 and I4 are the starting point and the ending point of the straight line segment G1, and the inclination angle of the line connecting I1 and I4 is less than 10°. At this time, it can be judged that I1 and I4 are on the same horizontal line, that is, Y I1 = Y I4 , then (X I1 , b 1 ) and (X I4 , b 1 ) can be used to replace the starting point and the ending point of the primitive element G1, and (X I1 , b 1 ) and (X I4 , b 1 ) are the point position information of the primitive element G1. Among them, the value of b 1 can be the same as Y I1 or Y I4 .
[0100] It should be noted that the first preset angle can be selected according to the actual situation. For example, the first preset angle can be 10°. The closer the value of the first preset angle is to 0, the closer the starting point and the ending point of this primitive element are on the same horizontal line.
[0101] Step S516: When the inclination angle is greater than the second preset angle, set the abscissas of the starting point and the ending point of the primitive to be the same, and the obtained coordinate information is the point position information of the primitive. When the starting point and the ending point of a certain primitive are greater than the second preset angle, it is considered that the starting point and the ending point of the primitive are on the same vertical line. The second preset angle can be selected according to the actual situation. For example, the second preset angle can be 80°. The closer the value of the second preset angle is to 90°, the closer the starting point and the ending point of the primitive are to being on the same vertical line.
[0102] For example, taking Figure 2 I 1 (X I1 , Y I1 ) and I 2 (X I2 , Y I2 ) as an example, I 1 and I 2 are the starting point and the ending point of the straight line segment G2. The inclination angle of the connection line between I 1 and I 2 is greater than 80°. At this time, it can be determined that I1 and I2 are on the same vertical line, that is, X I1 = X I2 . Then, (a1, Y I1 ) and (a1, Y I2 ) can be used to replace the starting point and the ending point of the primitive G2. (a1, Y I1 ) and (a1, Y I2 ) are the point position information of the primitive G2. Among them, the value of a1 can be the same as X I1 or X I2 .
[0103] Traverse the straight line primitives according to the method of step S512 to step S516 to obtain multiple pieces of the point position information, and replace the starting point and the ending point of all primitives with new variables. When the horizontal or vertical coordinates of some key points cannot be merged, a new variable in the a or b sequence can be added. According to the above method, a series of obtained point position information is: (a1, b1), (a1, b2), (a2, b3) ……, (a2, b1), etc.
[0104] Calculate the inclination angle of the connection line between any two key points that are not in the same primitive, and merge the key points according to the method of step S512 to step S516. The obtained series of point position information is: (c1, d1), (c1, d2), (c2, d3) ……, (c2, d1), etc.
[0105] The purpose of step S50 is to correspond the information within the entire cross-section with as few variables as possible. After obtaining a series of point position information, proceed to step S60:
[0106] Step S60, correspond the point position information with the dimension annotation information to obtain the corresponding result. This step corresponds the pixel length corresponding to the point position information with the dimension annotation information (actual length) obtained by the primitive recognition module in step S20 to obtain the corresponding result of the dimension annotation information and the point position information.
[0107] As Figure 6 shown, in this embodiment, the steps of corresponding the point position information with the dimension annotation information to obtain the corresponding result include the following steps:
[0108] Step S610, obtain the endpoint coordinates of the primitive according to the dimension annotation information. In step S20, the primitive recognition module outputs the types and dimension annotation information of each primitive in the cross-section image, as well as the horizontal and vertical coordinates of the corresponding primitive endpoints.
[0109] Step S612, obtain the point position information according to the endpoint coordinates. After obtaining the horizontal and vertical coordinates of the two endpoints of the primitive, find the point position information closest to these two endpoints. For example, point position 1 and point position 2. Among them, the distance can be judged by the pixel distance.
[0110] Step S614, obtain the corresponding key points according to the point position information, correspond the point position information with the dimension annotation information to obtain the corresponding result. In step S50 above, the horizontal and vertical coordinates of the key points were merged. At this time, in the reverse process, obtain the corresponding key points through the point position information. At this time, obtain the drawing coordinate system length between the corresponding key points according to the text content of the dimension annotation information, that is, the drawing length. At this time, calculate the corresponding relationship between the pixel length between the point position information and the drawing coordinate system length in the dimension mark, for example, the specific ratio, to obtain the corresponding result of the drawing coordinate system between each point position information.
[0111] Step S616, traverse the dimension annotation information of the remaining primitive information to obtain multiple corresponding results. Multiple dimension annotation information was obtained in step S20, and multiple corresponding results are obtained according to the method of step S610 - step S614.
[0112] In addition, if the dimension annotation content in the cross-section image is insufficient, that is, the distance between some key points is not given, then according to the existing matching results, determine the drawing coordinate system length between the corresponding point position information according to the pixel ratio in the figure.
[0113] Furthermore, in this embodiment, the steps of corresponding the point position information with the dimension annotation information to obtain the corresponding result further include:
[0114] Obtain the horizontal coordinates and vertical coordinates of the two endpoints according to the dimensioning information.
[0115] Obtain the point position information closest to the endpoints according to the horizontal coordinates and vertical coordinates. The horizontal coordinates and vertical coordinates of the endpoints are obtained in the graphic element recognition module. Compare these coordinates with the obtained point position information above, and take the one closest to these coordinates as the point position information of these endpoints, and obtain the corresponding key points through the point position information.
[0116] Obtain the drawing length of the point position information according to the dimensioning information. The text content in the dimensioning information is the length in the drawing coordinate system between the key points, that is, the drawing length.
[0117] Calculate the pixel length between the point position information. At the same time, obtain the pixel length between the corresponding key points of the point position information.
[0118] Obtain the corresponding result according to the pixel length and the drawing length. Correspond the pixel length with the drawing length, and the length in the drawing coordinate system between the key points can be determined.
[0119] Step S70, draw the cross-section according to the corresponding result. After step S60, the coordinate system length between each point position information can be determined. Determine the coordinates of each key point in the drawing coordinate system through the point position information, and draw the outline of the entire cross-section. The schematic diagram drawn is as Figure 7 shown.
[0120] As Figure 8 shown, in this embodiment, the steps of drawing the cross-section according to the corresponding result include:
[0121] Step S710, establish the drawing coordinate system.
[0122] Step S712, obtain the drawing length of the key points according to the corresponding result.
[0123] Step S714, determine the coordinates of the key points in the drawing coordinate system according to the point position information. After establishing the drawing coordinate system in the drawing interface, according to the corresponding result obtained in step S60, determine the length in the drawing coordinate system between the two key points, that is, the drawing length. Then obtain the coordinates of the key points in the drawing coordinate system according to the point position information.
[0124] Step S716, draw the outline of the cross-section according to the coordinates and the drawing length. After determining the coordinates and the drawing length, draw the outline of the entire cross-section.
[0125] Furthermore, as Figure 9 and Figure 10As shown in the figure, the cross-section drawing method based on computer vision in this embodiment may further include a batch drawing step when it is necessary to batch draw multiple irregular cross-sections of the same type but with different distances between point position information. For example, Figure 9 and Figure 10 As shown in the figure, when it is necessary to batch draw 5 cross-sections of the same type but with different drawing lengths, the drawing can be carried out according to the following steps:
[0126] Obtain the distance between point position information. For example, the distance between each point position information can be obtained from Figure 9 According to the corresponding result of step six above, the drawing length between key points can be obtained through the distance between point position information.
[0127] Obtain the key point coordinates through the point position information. After obtaining the point position information, the corresponding key point coordinates can be obtained according to the point position information.
[0128] Draw the cross-section contour. According to the key point coordinates and the drawing length, the cross-sections are drawn on the drawing in sequence to achieve the rapid batch replication of irregular cross-sections. Embodiment 2
[0129] As Figure 11 shown, a system for a cross-section drawing method based on computer vision in an embodiment includes: an information acquisition module 10, a primitive recognition module 20, a recognizability determination module 30, a point position information acquisition module 40, a dimension annotation correspondence module 50, and a cross-section drawing module 60.
[0130] The information acquisition module 10 is used to acquire the image information of the cross-section to be drawn;
[0131] The primitive recognition module 20 is used to obtain the primitive information in the image information through a primitive recognition model, and the primitive information includes multiple key points and dimension annotation information;
[0132] The recognizability determination module 30 is used to determine whether the contour line of the cross-section to be drawn is a closed line shape according to the key points; if so, obtain the inner contour and the outer contour of the cross-section to be drawn, and the part between the inner contour and the outer contour is the range of the cross-section to be drawn;
[0133] The point position information acquisition module 40 is used to obtain the point position information of the cross-section to be drawn according to the key points of the inner contour and the outer contour;
[0134] The dimension annotation correspondence module 50 is used to correspond the point position information with the dimension annotation information to obtain a corresponding result;
[0135] The cross-section drawing module 60 is used to draw the cross-section according to the corresponding result.
[0136] The above computer vision-based cross-section drawing method and system have the following advantages:
[0137] (1) High drawing efficiency. The present invention utilizes a primitive recognition model based on computer vision, which can quickly extract the geometric features of a hand-drawn cross-section and draw them on the drawing according to the dimension annotation information, without manually drawing them on the drawing, improving the drawing efficiency and ensuring the accuracy of the drawing.
[0138] (2) Strong generalization. The present invention can automatically extract the characteristic lengths of special-shaped cross-sections and batch-draw multiple cross-sections of one type.
[0139] The technical features of the above-described embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the various technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0140] The above-described embodiments only represent several implementation manners of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the appended claims.
Claims
1. A cross-section drawing method based on computer vision, characterized in that: The steps include: Step 1, obtaining image information of the section to be drawn; Step 2: acquiring primitive information in the image information through a primitive recognition model, wherein the primitive information includes a plurality of key points and dimension annotation information; Step 3: judging whether the contour line of the cross section to be drawn is a closed line according to the key point; Step 4: if yes, obtain the inner contour and outer contour of the section to be drawn, and the portion between the inner contour and the outer contour is the range of the section to be drawn; Step 5, obtaining the point information of the cross section to be drawn according to the key points of the inner contour and the outer contour, including: step S510, obtaining the primitive information corresponding to the inner contour and the outer contour; step S512, calculating the inclination angle of the line connecting the starting point and the end point of each primitive; step S514, when the inclination angle is less than a first preset angle, setting the ordinates of the starting point and the end point of the primitive to be the same, and the obtained coordinate information is the point information of the primitive; step S516, when the inclination angle is greater than a second preset angle, setting the abscissas of the starting point and the end point of the primitive to be the same, and the obtained coordinate information is the point information of the primitive; traverse the straight line primitives according to the method of steps S512 to S516 to obtain a plurality of the point information; Step 6: Match the point information with the dimension information to obtain a corresponding result; Step seven: draw the cross section according to the corresponding result.
2. The cross-section drawing method based on computer vision according to claim 1, characterized in that: In the step 2, the step of obtaining the primitive information in the image information through the primitive recognition model, wherein the primitive information includes a plurality of key points and dimension annotation information, comprises: The graphic elements in the graphic element information include at least one of a straight line, an arc or a spline curve, the key points are at least two of the starting point, the end point, the center of the circle or the inflection point of the graphic element, and the dimensioning information includes the coordinate information and the dimension information of the key points.
3. The cross-section drawing method based on computer vision according to claim 2, characterized in that: After step 2, the method further includes the following steps: Step S210, determining whether the distance between the two key points is less than a preset value; Step S220: if yes, merge the two key points; Step S230, merging the remaining key points according to step S210 and step S220 to obtain a plurality of key points.
4. The cross-section drawing method based on computer vision according to claim 2, characterized in that: The step three, judging whether the contour line of the cross section to be drawn is a closed line according to the key point, comprises: Step S310, selecting a primitive, one end of which is a first key point and the other end of which is a second key point; Step S312, determining whether the second key point is connected to other primitives; Step S314, if yes, setting the end of the primitive away from the second key point as the third key point; Step S316, traversing the remaining primitives according to the method of step S312 and step S314, and determining whether it is possible to return to the first key point; Step S318: If yes, the contour line of the cross section to be drawn is a closed line.
5. The cross-section drawing method based on computer vision according to claim 2, characterized in that: The step five also includes: Step S518, calculating the inclination angle of the line connecting any two key points that are not in the same primitive, and merging the ordinates or abscissas of the key points according to the method of step S514 and step S516 to obtain the point information.
6. The cross-section drawing method based on computer vision according to claim 2, characterized in that: The step six of matching the point information with the dimensioning information, and obtaining the matching result includes: Step S610, obtaining the endpoint coordinates of the graphic element according to the dimensioning information; Step S612, acquiring the point information closest to the endpoint according to the endpoint coordinates; Step S614, acquiring the corresponding key point according to the point information, wherein the point information corresponds to the dimensioning information, and acquiring the corresponding result; Step S616, traverse the dimension annotation information of the remaining primitive information to obtain a plurality of corresponding results.
7. The cross-section drawing method based on computer vision according to claim 6, characterized in that: The dimensioning information includes the drawing length between the two key points; the point information includes the pixel length between the two key points, and the corresponding result includes the ratio of the pixel length to the drawing length.
8. The cross-section drawing method based on computer vision according to claim 7, characterized in that: The step seven, drawing the cross section according to the corresponding result, comprises: Step S710, establishing a drawing coordinate system; Step S712, obtaining the drawing length of the key point according to the corresponding result; Step S714, determining the coordinates of the key point in the drawing coordinate system according to the point information; Step S716: draw the outline of the cross section according to the coordinates and the drawing length.
9. The cross-section drawing method based on computer vision according to claim 1, characterized in that: After step seven, a batch drawing step is also included.
10. A system for a cross-section drawing method based on computer vision according to any one of claims 1 to 9, comprising: An information acquisition module, used to acquire image information of the section to be drawn; A primitive recognition module, which obtains primitive information in the image information through a primitive recognition model, wherein the primitive information includes a plurality of key points and dimension annotation information; an identifiability determination module, for determining whether the contour line of the section to be drawn is a closed line according to the key points; if so, obtaining the inner contour and the outer contour of the section to be drawn, and the portion between the inner contour and the outer contour is the range of the section to be drawn; A point information acquisition module, which acquires point information of the cross section to be drawn according to key points of the inner contour and the outer contour; A dimensioning corresponding module corresponds the point information with the dimensioning information to obtain a corresponding result; A cross-section drawing module is used to draw the cross-section according to the corresponding result.
Citation Information
Patent Citations
Digital real estate area measurement method with sketch becoming map directly
CN106482700A
Method for converting hand-painted geometric figure into standard printed body and medium
CN112489167A