Cross section drawing method and system based on computer vision
Through the cross-section drawing method based on computer vision, the geometric features of special-shaped cross-sections are quickly extracted using the element recognition model, which solves the problem of inefficiency of traditional drawing methods and achieves efficient and accurate cross-section drawing.
Patent Information
- Application Number
- CN202510193647.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2045-02-21
AI Technical Summary
Traditional methods are inefficient when drawing special-shaped cross-section drawings, which requires 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.
It improves the efficiency of drawing special sections, reduces the time and energy of manual drawing, and ensures the accuracy of drawing.
Smart Images

Figure CN119691876A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a cross-section drawing method and system based on computer vision, belonging to the field of intelligent construction of civil engineering. Background Art
[0002] In the construction process, the cross-section design of components and rods is a crucial link. Traditionally, this process may involve manually drawing the rough shape of the cross section on paper so that the staff can make preliminary ideas and plans. When the idea is completed, the outline of the cross section is manually drawn and marked on the CAD drawing.
[0003] For sections with regular shapes, such as rectangles and round tubes, it is relatively convenient to draw the section of the component. However, when it comes to special-shaped sections with non-standard or irregular shapes, the process of drawing the section sketch on paper is relatively convenient, but when these special-shaped sections are manually drawn on CAD drawings, it is more troublesome and requires a lot of time and effort, resulting in low efficiency in drawing drawings. Summary of the invention
[0004] In view of the problem of low efficiency of existing methods for drawing special-shaped cross-section drawings, the present invention provides a computer vision-based cross-section drawing method and system that can quickly extract the geometric features of hand-drawn cross-sections and draw them in the drawings according to graphical annotations.
[0005] In order to solve the above technical problems, the present invention includes the following technical solutions: A cross-section drawing method based on computer vision comprises the following steps: 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 point information of the cross section to be drawn according to the key points of the inner contour and the outer contour; Step 6: Match the point information with the dimensioning information primitive information to obtain a corresponding result; Step seven: draw the cross section according to the corresponding result.
[0006] Furthermore, 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.
[0007] Furthermore, after step 2, the method further comprises 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.
[0008] Furthermore, the step three of determining whether the contour line of the cross section to be drawn is a closed line according to the key point includes: 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.
[0009] Furthermore, the step five of acquiring the point information of the cross section to be drawn according to the key points of the inner contour and the outer contour includes: Step S510, obtaining the graphic element 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 of the graphic elements; Step S514, when the tilt angle is less than the first preset angle, the ordinates of the starting point and the end point of the graphic element are set to be the same, and the obtained coordinate information is the point position information of the graphic element; Step S516, when the tilt angle is greater than a second preset angle, the horizontal coordinates of the starting point and the end point of the graphic element are set to be the same, and the obtained coordinate information is the point position information of the graphic element; Traverse the line primitives according to the method of step S512 to step S516 to obtain a plurality of point position information; 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.
[0010] Furthermore, in step six, the step 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.
[0011] Furthermore, the dimensioning information includes a drawing length between two key points; the point information includes a pixel length between two key points, and the corresponding result includes a ratio of the pixel length to the drawing length.
[0012] Furthermore, in step seven, the step of drawing the cross section according to the corresponding result includes: 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.
[0013] Furthermore, after step seven, a batch drawing step is also included.
[0014] The system of the cross-section drawing method based on computer vision comprises: 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 primitive information to obtain a corresponding result; A cross-section drawing module is used to draw the cross-section according to the corresponding result.
[0015] Due to the adoption of the above technical scheme, compared with the prior art, the section drawing method and system based on computer vision of the present invention can quickly extract the geometric features of the section to be drawn by using the primitive recognition model through computer vision technology, and can draw it on the CAD drawing, thereby solving the cumbersome problems in the process of drawing special-shaped sections and improving the drawing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flow chart of a cross-section drawing method based on computer vision according to an embodiment; Figure 2 A hand-drawn schematic diagram of a special-shaped cross section of an embodiment; Figure 3 A flowchart combining key points of an embodiment; Figure 4 A flow chart of an embodiment of judging whether the contour line of a cross section to be drawn is a closed linear line according to key points; Figure 5 It is a flow chart of an embodiment of obtaining point information of a cross section to be drawn according to key points of an inner contour and an outer contour; Figure 6 A flowchart of an embodiment of the invention for matching point information with dimension information to obtain a corresponding result; Figure 7 A cross-sectional rendering of an embodiment; Figure 8 A flow chart of drawing a cross section according to corresponding results according to an embodiment; Fig. 9 It is point information of batch drawing cross sections of an embodiment; Fig.10 A batch rendering of an embodiment; Fig.11 A cross-section drawing system based on computer vision according to an embodiment of the present invention is provided. DETAILED DESCRIPTION
[0017] The following is a further detailed description of the computer vision-based cross-section drawing method and system provided by the present invention in conjunction with the accompanying drawings and specific embodiments. The advantages and features of the present invention will become clearer in conjunction with the following description. It should be noted that the accompanying drawings are all in a very simplified form and are not in precise proportions, and are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention.
[0018] The cross-section drawing method based on computer vision of the present invention can be used to draw a hand-drawn cross-section onto a CAD drawing, wherein the cross-section can be a relatively regular cross-section or an irregular, non-standard, special-shaped cross-section. Compared with the existing special-shaped cross-section drawing method, the present invention is more efficient in drawing special-shaped cross-sections. The cross-section drawing method based on computer vision of the present invention will be described below in conjunction with an embodiment. Embodiment 1
[0019] like Figure 1 As shown, a cross-section drawing method based on computer vision in one embodiment includes the following steps: Step 1 S10, obtaining image information of the section to be drawn. Figure 2 As shown in FIG. 1 , generally, the user draws the cross section to be drawn on the drawing. The cross section hand-drawn drawing can be converted into a picture format by photographing, scanning, etc., so as to facilitate subsequent computer vision recognition. Figure 2 As shown, when hand-drawing drawings, the size information of each section and line segment will be marked on the drawings, for example, the length of the line segment that constitutes the section, the width between the line segments, the arc, etc. That is, the hand-drawn drawings will be marked with dimensioning information to facilitate subsequent staff to accurately draw the drawings when drawing.
[0020] Step 2 S20, obtaining primitive information in the image information through a primitive recognition model, where the primitive information includes a plurality of key point information and dimension annotation information.
[0021] Special-shaped sections generally include various types of primitives, such as straight lines, curves, arcs, etc. Once the primitive types of the special-shaped section and the key points that constitute these primitives are determined, the shape of the special-shaped section can be determined.
[0022] In this embodiment, the primitives in the primitive information include at least one of a straight line, an arc or a spline curve, and the key points are at least two of the starting point, the end point, the center point or the inflection point of the primitive. Different types of primitives have different corresponding key point types. Key points refer to points in a cross section that can represent the entire cross section. By determining the coordinates of these key points, the cross section profile can be drawn.
[0023] If the cross section is a regular shape, such as a rectangle or a circle, the cross section outline is generally composed of one type of line, such as a straight line or an arc. If the cross section is an irregular shape, such as a special-shaped cross section, the cross section outline is composed of multiple lines. For different types of elements, the key points are set as follows: When the entity is a straight line, the key points include the start point and endpoint of the line.
[0024] When the primitive is an arc, the key points include the start point, endpoint, and center of the arc.
[0025] When the entity is a spline curve, the key points include the start point, endpoint, and inflection point of the spline curve.
[0026] Through the primitive recognition model, the primitive information in the cross-sectional image information can be obtained, including the primitive types included in the cross-sectional image, such as straight lines, arcs and spline curves, the coordinate information of the starting point, end point and inflection point of the straight line, arc and spline curve, and the dimensioning information of each primitive. The primitive recognition model can use a trained model or use an existing data set to train a deep learning model according to the following method.
[0027] Specifically, in this embodiment, the method for establishing the primitive recognition model includes the following steps: A data set is created, which contains a series of special-shaped cross-section images and the annotation information corresponding to these images. The corresponding labels are: the starting point, end point, center point and inflection point information of the straight line, arc and spline curve in each cross-section image, as well as the dimension label in the cross-section image and the two end points and values of the label. To ensure universality, when there is a circle in the cross section, the label of the circle is set to consist of two arcs.
[0028] The interface information recognition model is trained using the data set to obtain a model that can recognize graphic elements such as straight lines, arcs (including the center of the arcs), spline curves, etc., that is, a graphic element recognition model.
[0029] When the primitive recognition model is used, the upper left corner of the image can be defined as the coordinate origin, the horizontal rightward direction is the positive direction of the X axis, the vertical downward direction is the Y axis, and the coordinates of the identified key points are the pixel positions of the points on the X axis and the Y axis. The image information of the cross section obtained in step 1 S10 is input into the primitive recognition model, and the output result is the primitive information in the image information, including line type, key point coordinates, and corresponding dimensioning information.
[0030] Furthermore, if Figure 3As shown, in this embodiment, in step 2 S20, after obtaining the primitive information in the image information through the primitive recognition model, the primitive information includes a plurality of key points and dimensioning information, and further includes a step of merging the key points. Through the primitive recognition model, the primitives, the key points of the primitives, and the corresponding dimensioning information included in the cross-sectional image information can be obtained.
[0031] When two primitives are adjacent primitives, for example, line segment 1 and line segment 2 are adjacent and connected, and the connection point is point O, the primitive recognition model will recognize point O as the key point of line segment 1 when recognizing line segment 1, and will also recognize point O as the key point of line segment 2 when recognizing line segment 2. That is, point O is both the key point of line segment 1 and the key point of line segment 2. Merging the same key point can reduce the number of key points and improve recognition efficiency.
[0032] Please continue reading Figure 3 In this embodiment, the steps of merging key points are specifically as follows: Step S210, determine whether the distance between the two key points is less than a preset value. In step 2 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 calculated by calculating the Euclidean distance between the two points to obtain the length of the line segment.
[0033] Step S220, if yes, merge the two key points. If the distance between the two key points is less than the preset value, the two key points are considered to be the same key point. For example, the preset value is set to a distance of 5 pixels. If the distance between key point P1 and key point P2 is less than a distance of 5 pixels, P1 and P2 are considered to be the same key point. At this time, the two key points are merged, for example, the coordinates of P1 and P2 are merged into (Xa, Ya). When the coordinates of the key points are merged, the corresponding primitives are also merged along with the key points.
[0034] Step S230, merge the remaining key points according to step S210 and step S220 to obtain multiple key points. Merge all key points in sequence according to the above method to obtain a series of key points, the coordinates of which are (X1, Y1), (X2, Y2), (X3, Y3) ..., (Xn, Yn). It should be noted that the preset value can be selected according to actual needs and is not limited here.
[0035] Step S30, judging whether the contour line of the cross section to be drawn is a closed line according to the key points. The contour in the cross section is continuous, so each line in the cross section should be closed and non-intersecting, and the closed lines constitute the contour of the cross section.
[0036] like Figure 4 As shown, in this embodiment, the step of judging whether the contour line of the cross section to be drawn is a closed linear line according to the key points includes: Step S310, select a primitive, one end of which is the first key point and the other end is the second key point. For any primitive, the endpoints on both sides are key points, so for any key point, the number of primitives connected to it should not exceed two. For example, take a straight line as an example, the starting point of the straight line is the first key point and the end point is the second key point.
[0037] Step S312, determine whether the second key point is connected to other primitives. In step 2 S20, all key point coordinates in the cross-sectional image information and the corresponding primitive types have been obtained according to the primitive recognition model. At this time, the coordinates of the second key point and the corresponding primitive information are read. For example, if the second key point corresponds to both primitive A and primitive B, it is considered that the second key point is connected to other primitives.
[0038] Step S314, if yes, set the end of the primitive farthest 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 end point of primitive A and the starting point of primitive B, and the third key point is the end point of primitive B.
[0039] Step S316, traverse the remaining primitives according to the method of step S312 and step S314, and determine whether it is possible to return to the first key point. Taking the third key point as the starting point, traverse the remaining primitives.
[0040] Step S318: If yes, the contour line of the section to be drawn is a closed line. After traversing all the primitives and returning to the first key point, the contour line is determined to be a closed line, and the image of the section to be drawn is determined to be a recognizable image. If it is not possible to traverse to the next primitive or return to the first key point, the cross-sectional image is determined to be an unrecognizable cross-sectional image, and the recognition ends.
[0041] According to the method of the above steps S310 - S318 , a plurality of closed lines of the cross section to be drawn can be obtained.
[0042] Step 4 S40, if yes, obtain the inner contour and outer contour of the section to be drawn, and the part between the inner contour and the outer contour is the range of the section to be drawn. There are two types of closed lines, one is the inner contour of the contour section, and the other is the outer contour of the contour section. In step 3 S30, the line with the largest area among the identified closed lines is the outer contour, and the other closed lines are the inner contour. The part between the inner contour and the outer contour is the range of the section to be drawn.
[0043] Step 5 S50, obtaining the point information of the 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 primitives. Figure 2 Taking the hand-drawn section shown as an example, the inner contour includes 4 elements, which are 4 straight lines. The outer contour includes 12 elements, which are 12 straight lines. When the element is a straight line, when the two endpoints of the straight line are determined at the same time, the range between the inner contour and the outer contour can be determined.
[0044] like Figure 5 As shown, in this embodiment, obtaining the point 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: Step S510, obtaining the primitive information corresponding to the inner contour and the outer contour. According to step S20, the primitive information in the cross-sectional image has been identified. Figure 2 Taking the cross-sectional image information shown in FIG. 1 as an example, the inner contour includes 4 primitives, and the corresponding primitive information includes the coordinate information of 4 key points I1, I2, I3, and I4, which are (X I1 , Y I1 )、(X I2 , Y I2 )、(X I3 , Y I3 )、(X I4 , Y I4 ). At the same time, the outer contour includes 12 primitives, and the corresponding primitive information includes 12 key points E1, E2, E3...E 12 The coordinate information of E1 , Y E1 )、(X E2 , Y E2 )、(X E3 , Y E3 )......(X E12 , Y E12 ).
[0045] Step S512, calculating the tilt angle of the line connecting the starting point and the end point of each primitive. The tilt angle is the angle between the line connecting the starting point and the end point and the horizontal line, and the angle range is between 0° and 90°.
[0046] Step S514: When the inclination angle is less than the first preset angle, the ordinates of the starting point and the end point of the primitive are set to be the same, and the obtained coordinate information is the point information of the primitive. For example, when the inclination angle of the line connecting the starting point and the end point of a primitive is less than 10°, it is considered that the starting point and the end point of the primitive are on the same horizontal line. Figure 2 I1 (X I1 , Y I1 ) and I4 (X I4 , Y I4) as an example, I1 and I4 are the starting point and end 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 you can use (X I1 , b1) and (X I4 , b1) to replace the starting point and end point of the primitive G1, (X I1 , b1) and (X I4 , b1) is the point information of the primitive G1. The value of b1 can be related to Y I1 or Y I4 same.
[0047] It should be noted that the first preset angle can be selected according to actual conditions. For example, the first preset angle can be 10°. The value of the first preset angle is approximately close to 0, and the starting point and the end point of the graphic element are approximately on the same horizontal line.
[0048] Step S516, when the tilt angle is greater than the second preset angle, the horizontal coordinates of the starting point and the end point of the primitive are set to be the same, and the obtained coordinate information is the point information of the primitive. When the starting point and the end point of a certain primitive are greater than the second preset angle, it is considered that the starting point and the end point of the primitive are on the same vertical line. The second preset angle can be selected according to actual conditions. For example, the second preset angle can be 80°. The value of the second preset angle is approximately close to 90°, and the starting point and the end point of the primitive are approximately close to being on the same vertical line.
[0049] For example, Figure 2 I1 (X I1 , Y I1 ) and I2 (X I2 , Y I2 ) as an example, I1 and I2 are the starting point and end point of the straight line segment G2, and the inclination angle of the line connecting I1 and I2 is greater than 80°. At this time, it can be judged that I1 and I2 are on the same vertical line, that is, X I1 =X I2 , then we can use (a1, Y I1 ) and (a1, Y I2 ) to replace the starting point and end point of the primitive G2, (a1, Y I1 ) and (a1, Y I2 ) is the point information of the graphic element G2. Among them, the value of a1 can be I1 or X I2 same.
[0050] According to the method of step S512 to step S516, the linear primitives are traversed to obtain a plurality of the point information, and the starting point and the end point of all the primitives are replaced by new variables. When the horizontal or vertical coordinates of some key points cannot be merged, a variable of a or b sequence can be added. According to the above method, a series of point information is obtained: (a1, b1), (a1, b2), (a2, b3) ..., (a2, b1), etc.
[0051] Calculate the inclination angle of the line connecting any two key points that are not in the same primitive, merge the key points according to the method of step S512 to step S516, and obtain a series of point information: (c1, d1), (c1, d2), (c2, d3)..., (c2, d1), etc.
[0052] The purpose of step 5 S50 is to use as few variables as possible to correspond to the information in the entire cross section. After obtaining a series of point information, proceed to step 6 S60: Step 6 S60, correspond the point information with the dimension information and obtain the correspondence result. This step is to correspond the pixel length corresponding to the point information with the dimension information (actual length) obtained by the primitive recognition module in step 2 S20 to obtain the correspondence result between the dimension information and the point information.
[0053] like Figure 6 As shown, in this embodiment, the step of matching the point information with the dimensioning information and obtaining the matching result includes the following steps: Step S610, obtaining the endpoint coordinates of the primitive according to the dimensioning information. In step 2 S20, the primitive recognition module outputs the type and dimensioning information of each primitive in the cross-sectional image, as well as the horizontal and vertical coordinates of the corresponding primitive endpoints.
[0054] Step S612, obtaining point information according to the endpoint coordinates. After obtaining the horizontal coordinates and vertical coordinates of the two endpoints of the primitive, find the point information closest to the two endpoints. For example, point 1 and point 2. The distance can be determined by pixel distance.
[0055] Step S614, obtain the corresponding key points according to the point information, correspond the point information to the dimensioning information, and obtain the corresponding results. In the above step five S50, the horizontal coordinates and vertical coordinates of the key points are merged. At this time, according to the inverse process, the corresponding key points are obtained through the point information. At this time, the drawing coordinate system length between the corresponding key points is obtained according to the text content of the dimensioning information, that is, the drawing length. At this time, the correspondence between the pixel length between the point information and the drawing coordinate system length in the dimension mark is calculated, for example, a specific ratio, to obtain the corresponding results of the drawing coordinate system between each point information.
[0056] Step S616, traverse the dimensioning information of the remaining primitive information to obtain multiple corresponding results. In step 2 S20, multiple dimensioning information is obtained, and multiple corresponding results are obtained according to the method of steps S610 to S614.
[0057] In addition, if the dimension annotation content in the cross-sectional image is insufficient, that is, the distances between some key points are not given, the drawing coordinate system lengths between the corresponding point information are determined according to the existing matching results and the pixel ratio in the image.
[0058] Furthermore, in this embodiment, the step of matching the point information with the dimension information and obtaining the matching result further includes: Get the horizontal and vertical coordinates of the two endpoints based on the dimension information.
[0059] The point information closest to the endpoint is obtained based on the horizontal and vertical coordinates. The horizontal and vertical coordinates of the endpoint are obtained in the primitive recognition module. These coordinates are compared with the point information obtained above, and the point information closest to these coordinates is used as the point information of these endpoints, and the corresponding key points are obtained through the point information.
[0060] Get the drawing length of the point information according to the dimension information. The text content in the dimension information is the drawing coordinate system length between the key points, that is, the drawing length.
[0061] Calculate the pixel length between the point information. At the same time, obtain the pixel length between the key points corresponding to the point information.
[0062] Obtain the corresponding result based on the pixel length and the drawing length. By matching the pixel length with the drawing length, the drawing coordinate system length between the key points can be determined.
[0063] Step 7 S70, draw the cross section according to the corresponding result. After step S60, the coordinate system length between each point information can be determined, and the coordinates of each key point in the drawing coordinate system can be determined by the point information, and the outline of the entire cross section can be drawn. The schematic diagram is as follows: Figure 7 shown.
[0064] like Figure 8 As shown, in this embodiment, the step of drawing a cross section according to the corresponding result includes: Step S710, establishing a drawing coordinate system.
[0065] Step S712, obtaining the drawing length of the key point according to the corresponding result.
[0066] Step S714, determine the coordinates of the key points in the drawing coordinate system according to the point information. After the drawing coordinate system is established in the drawing interface, determine the drawing coordinate system length between the two key points, i.e., the drawing length, according to the corresponding result obtained in step six S60. Then, obtain the coordinates of the key points in the drawing coordinate system according to the point information.
[0067] Step S716, draw the outline of the cross section according to the coordinates and the drawing length. After the coordinates and the drawing length are determined, draw the outline of the entire cross section.
[0068] Furthermore, if Fig. 9 and Fig.10 As shown, the cross-section drawing method based on computer vision of this embodiment may also include a batch drawing step, when it is necessary to batch draw multiple special-shaped cross-sections of the same type but with different distances between point information. Fig. 9 and Fig.10 As shown in the figure, if you need to batch draw 5 sections of the same type but with different lengths, you can follow the steps below to draw them: Get point information distance, for example, from Fig. 9 The distance between each point information can be obtained in . According to the corresponding result of the above step 6, the drawing length between the key points can be obtained through the distance between the point information.
[0069] Obtain key point coordinates through point information. After obtaining the point information, the corresponding key point coordinates can be obtained according to the point information.
[0070] Draw the cross-section outline. Draw the cross-sections in the drawing in sequence according to the key point coordinates and drawing length, and realize the rapid batch copying of special-shaped cross-sections. Embodiment 2
[0071] like Fig.11 As shown, a system of a cross-section drawing method based on computer vision according to an embodiment includes: an information acquisition module 10 , a graphic element recognition module 20 , an identifiability determination module 30 , a point information acquisition module 40 , a dimensioning corresponding module 50 and a cross-section drawing module 60 .
[0072] An information acquisition module 10 is used to acquire image information of the section to be drawn; A primitive recognition module 20, used to obtain 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; The identifiability determination module 30 is used to determine whether the contour line of the cross section to be drawn is a closed line according to the key point; 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; A point information acquisition module 40 is used to acquire 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 50 is used to correspond the point information with the dimensioning information to obtain a corresponding result; The cross-section drawing module 60 is used to draw the cross-section according to the corresponding result.
[0073] The above-mentioned cross-section drawing method and system based on computer vision have the following advantages: (1) High drawing efficiency. The present invention uses a primitive recognition model based on computer vision to quickly extract the geometric features of the hand-drawn section and draw it on the drawing according to the dimensioning information. There is no need to draw it manually on the drawing, which improves the drawing efficiency and ensures the accuracy of the drawing.
[0074] (2) Strong generalization. The present invention can automatically extract the characteristic length of special-shaped cross-sections and batch draw multiple cross-sections of the same type.
[0075] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0076] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached 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 point information of the cross section to be drawn according to the key points of the inner contour and the outer contour; Step 6: Match the point information with the dimensioning information primitive 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 of acquiring the point information of the cross section to be drawn according to the key points of the inner contour and the outer contour comprises: Step S510, obtaining the graphic element 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 of the graphic elements; Step S514, when the tilt angle is less than the first preset angle, the ordinates of the starting point and the end point of the graphic element are set to be the same, and the obtained coordinate information is the point position information of the graphic element; Step S516, when the tilt angle is greater than a second preset angle, the horizontal coordinates of the starting point and the end point of the graphic element are set to be the same, and the obtained coordinate information is the point position information of the graphic element; Traverse the line primitives according to the method of step S512 to step S516 to obtain a plurality of point position information; 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 primitive 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
DXF format-based house type image information extraction and vectorization method and device
CN114092952A
Shape recognition and correction method and device based on hand-drawn track and storage medium
CN115100321A
DXF drawing extraction method and device and electronic equipment
CN119004706A