A method and system for extracting bitmap format steel bar drawing data

By identifying and correcting text boxes and straight lines in bitmap format steel drawings, and distinguishing steel lines and text, the problem of identification errors and low accuracy in the existing technology is solved, efficient data extraction and conversion is achieved, and construction efficiency is improved. .

CN115512385BActive Publication Date: 2024-09-27CCCC SECOND HARBOR ENGINEERING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211210705.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2024-09-27
Estimated Expiration
2042-09-30

AI Technical Summary

Technical Problem

In the existing technology, during the data extraction process of steel bar drawings, steel bar lines and text are easily recognized as lines, and the accuracy of text recognition is low, resulting in duplication of work and low efficiency.

Method used

By identifying text boxes and straight lines in bitmap format drawings, the characteristic value hc is obtained, correcting and merging straight lines, distinguishing steel lines and text areas, using high-definition image processing and OCR technology for accurate identification, and improving the recognition accuracy of lines and text.

Benefits of technology

Effectively distinguish and identify steel bar lines and text, improve the accuracy and efficiency of data extraction, reduce duplication of work, and provide structured vector data for steel bar measurement and sample copying business.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115512385B
    Figure CN115512385B
Patent Text Reader

Abstract

The present invention discloses a method and system for extracting steel bar drawing data in bitmap format. The method performs full image recognition on a picture containing steel bar drawing data to obtain text boxes and straight lines in the drawing data. The characteristic value hc in the steel bar drawing data is obtained according to the height of all recognized text boxes. The area of ​​the steel bar list in the steel bar drawing data is obtained according to the characteristic value hc and the recognized horizontal straight line. For the area of ​​the steel bar list, the text therein is recognized. For the area outside the steel bar list, the steel bar lines and other text are recognized. The system and method of the present invention solve the problem that both steel bar lines and text will be recognized as lines in the existing steel bar data extraction process, and at the same time improve the accuracy of text recognition. By converting the bitmap into steel bar vector lines and text, a large amount of repeated work can be reduced, work efficiency can be improved, and subsequent data analysis and application are convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of building construction, and in particular relates to a method and system for extracting steel bar drawing data in a bitmap format. Background Art

[0002] Bitmap steel bar drawings are a commonly used file format in engineering construction. They are usually printed in vector format into bitmap format or scanned and saved from engineering white drawings and blueprints. Therefore, the steel bar lines, steel bar markings, and steel bar schedules in the construction drawings are all composed of pixels, not valid data information. If you need to extract relevant information from the drawings, such as steel bar samples or steel bar schedules, you can only redraw them in CAD software or manually enter data in Excel. This process involves a lot of repetitive labor and is time-consuming and labor-intensive.

[0003] In the current existing technology, graphic recognition technologies such as OpenCV can be used to identify the lines in the drawings, but during the recognition process, there may be problems that both the steel bar lines and text will be identified as single lines, double lines, or short lines; OCR technology can also be used for text extraction, but in this scenario, the steel bar marking information is scattered in various places in the drawings, and may be interfered by the lines near the text, resulting in low accuracy of text recognition. Summary of the invention

[0004] In order to solve the problem that both steel bar lines and text will be recognized as lines and the problem of low accuracy of text recognition in the existing steel bar data extraction process, the present invention proposes a bitmap format steel bar drawing data extraction method and system, which recognizes steel bar lines and text in bitmap format drawings and converts them into structured vector data, providing a basic data source for businesses such as steel bar quantity calculation and steel bar sample making, thereby improving work efficiency.

[0005] A method for extracting bitmap format steel bar drawing data to achieve one of the purposes of the present invention comprises the following steps:

[0006] S1. Performing full image recognition on a bitmap format image containing steel bar drawing data to obtain text boxes and straight lines in the drawing data, obtaining a characteristic value hc of the steel bar drawing data according to the height of all recognized text boxes; obtaining an area of ​​a steel bar list in the steel bar drawing data according to the characteristic value hc and the recognized horizontal straight line; the document box is the range of the text area;

[0007] S2. For the area in the steel bar list, identify the text therein; for the area outside the steel bar list, identify the steel bar lines and text therein.

[0008] A further technical solution includes: the method of obtaining the characteristic value hc in the steel bar drawing data according to the identified text box in step S1 includes: taking the median value of the height of all identified text boxes as the characteristic value hc.

[0009] A further technical solution includes: the method for identifying straight lines in step S1 includes: converting the image into a grayscale image, setting a suitable Canny threshold, and using a straight line detection method to obtain all straight lines. The parameters of the straight line detection method include: setting the degree, minimum length, and maximum gap, wherein the preferred value of the maximum gap is the characteristic value hc.

[0010] A further technical solution includes: in order to further improve the accuracy of line recognition, the step S1 also includes straightening the recognized lines. When the difference dx between the horizontal coordinates of the two endpoints of a straight line is less than the sixth set multiple of the eigenvalue hc, the line is straightened into a vertical line; when the difference dy between the vertical coordinates of the two endpoints of a straight line is less than the sixth set multiple of the eigenvalue hc, the line is straightened into a horizontal line; the straightening method can be performed based on any endpoint of a straight line.

[0011] A further technical solution includes: the step S1 also includes merging the identified straight lines, the method is as follows:

[0012] Traverse all adjacent parallel lines. When two adjacent parallel lines L A and L B The spacing is less than the first set multiple of the characteristic value hc, and from L A Any end point of L B Draw a perpendicular with the foot point at L B Between the two endpoints, delete L A and L B For shorter lines, set L A and L B The longer line is extended to get a total length line L AB The total length line L AB The coordinates of the two endpoints are L A Projection to L B The two endpoints after synthesis.

[0013] The technical effect of this step is: since the lines in the steel bar drawing data are generally thick outlines, that is, double lines, and may be intermittent, line merging can turn double lines into single lines and discontinuous lines into continuous lines, thereby obtaining a vector single line drawing consistent with the original drawing content.

[0014] A further technical solution includes: the method for obtaining the area of ​​the steel bar list in step S1 is as follows:

[0015] S1.1. Perform double-line comparison on all identified horizontal lines in a loop, and find three adjacent lines that meet the following condition 1;

[0016] Condition 1: The lengths are all greater than the second set multiple of the eigenvalue hc; the spacing is less than the third set multiple of the eigenvalue hc; the length difference is less than the fourth set multiple of the eigenvalue hc; the difference in the horizontal coordinates of the left endpoints is less than the fifth set multiple of the eigenvalue hc;

[0017] S1.2, based on the topmost line and the bottommost line of the three adjacent lines, continuously search upward and downward for adjacent lines that meet condition 1;

[0018] S1.3. The area determined by the left endpoint coordinates of the top line and the right endpoint coordinates of the bottom line among all adjacent lines that meet condition 1 is the reinforcement table area;

[0019] A further technical solution includes: in step S2, it also includes converting the original bitmap resolution of the steel bar drawing data into a high-definition image, and its magnification factor is denoted as f.

[0020] A further technical solution includes: in step S2, for the area of ​​the steel bar list, the method of identifying the text therein includes:

[0021] S201.1. Obtain the positioning coordinate value of each text box in the steel bar list area, which is used to remove the blank area at the edge of the text and tighten the border line of the text box to the text boundary. The specific method includes the following steps:

[0022] For each text box, traverse the pixels of the text box from left to right and find the position of the leftmost pixel as a black dot, which is the horizontal coordinate value L of the left side of the text box. L , remove the extra blank area on the left; traverse the pixels of the text box from right to left, and find the position of the rightmost pixel as a black dot, which is the horizontal coordinate value L of the right position of the text box. R , remove the extra blank area on the right; traverse the pixels of the text box from top to bottom, and find the position where the top pixel is a black dot, which is the vertical coordinate value L of the top position of the text box U , remove the extra blank area at the top; traverse the pixels in the text box from bottom to top, and find the position where the horizontally lowest pixel is a black dot, which is the vertical coordinate value L of the bottom position of the text box D , remove the redundant blank area at the bottom; the horizontal coordinate value L L and L R , vertical coordinate value L U and L D It is the positioning coordinate value of the text box;

[0023] S201.2. Modify the text box, and the modification includes border removal operation, frame outer frame removal and frame merging operation; the specific method includes: removing text boxes whose height or width is less than a set distance, and the set distance is a set multiple of the characteristic value hc and the magnification factor f of the high-definition image; removing the outer frame of the text box, that is, if the upper left part and the lower right part of a smaller text box are respectively within the range of the upper left part and the lower right part of a larger text box, then the larger text box is removed; merge the text boxes, that is, when the upper left part or the lower right part of a text box is within the range of the upper left part or the lower right part of another box, the text boxes are merged, and the coordinates of the merged text box take the envelope value of the coordinates of the two boxes.

[0024] S201.3. Take screenshots of each text box range one by one to identify the text content.

[0025] A further technical solution includes: in step S2, for the area outside the steel bar list, the method for identifying the steel bar lines includes:

[0026] S202.1. Traverse the straight lines outside the steel bar list area, obtain all straight lines whose lengths are greater than the seventh set multiple of the characteristic value hc, and obtain a set S;

[0027] The technical effect of this step is: the steel bar drawing contains lines and text, where the lines are divided into steel bar lines, steel bar list lines and drawing frame lines. Compared with the redundant text stroke lines generated by recognition, these lines have the following characteristics: any steel bar line is composed of 1 to n segments, and the longest segment is generally greater than the set length, such as 1.5*hc, so that it can be reflected that this steel bar line is emphasized. The above characteristics can distinguish steel bar lines from text;

[0028] S202.2, traverse each line in the set S, and use the following algorithm to identify the steel bar lines; wherein the technical effect of the first three steps is: correcting the position of the line to make it consistent with the position in the original bitmap;

[0029] S202.2.1. Obtain three points a1, a2, a3 spaced apart on the line L, L∈S;

[0030] S202.2.2. The straight line formed by the three points a1, a2, and a3 is translated perpendicularly to the straight line L by a plurality of set distances, to obtain a plurality of straight lines;

[0031] S202.2.3. Calculate the sum of the pixel values ​​of each of the plurality of straight lines pixel by pixel, and take the straight line with the smallest sum as the median line L of the straight line L. m ;

[0032] S202.2.4, the center line L mExtend pixel by pixel to both ends until a white point is found and straight line L is obtained m ';

[0033] S202.2.5, continue on straight line L m The two endpoints of ' use 360-degree rays to find continuous black pixels, ending at white pixels, and obtain the continuous length of black pixels on each degree ray, and take the longest ray L m,r , L m,r The far end point continues to use the 360-degree ray algorithm until no associated line is found;

[0034] S202.2.6, extension line L m ', ray L m,r This is the desired reinforcement line.

[0035] Since step S1 cannot obtain all text boxes, the online and offline texts are further accurately found according to the position of the line. Therefore, a further technical solution includes: after step S2, the following steps are also included:

[0036] S203, search for non-white pixels within the height range of (0.5 to 2) hc*f and the width range of hc*f of the perpendicular bisector of the horizontal and vertical lines identified in step S201. If so, expand the text box to the entire text box using the up, down, left, and right text extension algorithm based on the height and width range of the perpendicular bisector and identify the content of the text box; for oblique lines, straighten them according to the oblique line angle within the set up, down, left, and right distance range of the center point of the oblique line and identify the straightened text.

[0037] The technical effect of the above steps is: to recognize the remaining text that has not been recognized. This step is to invest a small square box and expand it pixel by pixel to the text box. It is very accurate but relatively slow, and is suitable for 100% recognition of the text at the target location.

[0038] A method system for extracting steel bar drawing data in bitmap format to achieve the second purpose of the present invention is characterized by comprising a steel bar detailed list area acquisition module, a text recognition module and a steel bar line recognition module;

[0039] The steel bar detailed list area acquisition module is used to perform full-image recognition on the steel bar drawing data to obtain text boxes and straight lines in the drawing data, obtain characteristic values ​​hc in the steel bar drawing data according to all recognized text boxes; and obtain the area of ​​the steel bar detailed list in the steel bar drawing data according to the characteristic values ​​hc and the recognized horizontal straight lines;

[0040] The text recognition module is used to recognize the text in the steel bar drawing data;

[0041] The steel bar line recognition module is used to recognize steel bar lines in steel bar drawing data.

[0042] A further technical solution includes: the bitmap format steel bar drawing data extraction system also includes a straight line merging module, which is used to merge all adjacent parallel lines that meet the set conditions, and the method is as follows:

[0043] Traverse all adjacent parallel lines. When two adjacent parallel lines L A and L B The spacing is less than the first set multiple of the characteristic value hc, and from L A Any end point of L B Draw a perpendicular with the foot point at L B Between the two endpoints, delete L A and L B For shorter lines, set L A and L B The longer line is extended to get a total length line L AB The total length line L AB The coordinates of the two endpoints are L A Projection to L B The two endpoints after synthesis.

[0044] A further technical solution includes: the bitmap format steel bar drawing data extraction system also includes a horizontal line and vertical line straightening module, which is used to straighten the identified lines, and the straightening method is as follows: when the difference dx of the horizontal coordinates of the two endpoints of a straight line is less than the sixth set multiple of the eigenvalue hc, the line is straightened into a vertical line; when the difference dy of the vertical coordinates of the two endpoints of a straight line is less than the sixth set multiple of the eigenvalue hc, the line is straightened into a horizontal line.

[0045] By utilizing the system and method described in the present invention, the problem that both steel bar lines and text will be recognized as lines in the existing steel bar data extraction process in data vectorization is solved, while the accuracy of text recognition is improved; by converting the bitmap into steel bar vector lines and text, a large amount of repetitive work can be reduced, work efficiency can be improved, and subsequent data analysis and application are facilitated. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is a schematic diagram of the process of the method of the present invention;

[0047] Figure 2 Steel bar drawing list and large-scale drawing area diagram;

[0048] Figure 3 is a schematic diagram of a method for merging adjacent lines in an embodiment of the method of the present invention;

[0049] Figure 4 It is a screenshot of the text area of ​​the steel bar list in the embodiment of the method of the present invention;

[0050] Figure 5 is a schematic diagram of a line position correction algorithm of an embodiment of the method of the present invention;

[0051] Figure 6 is a schematic diagram of an algorithm for extracting correlation lines according to an embodiment of the method of the present invention;

[0052] Figure 7 It is a schematic diagram of finding continuous characters by a character extension algorithm in an embodiment of the method described in the present invention. DETAILED DESCRIPTION

[0053] The following specific implementations are used to explain the technical solutions of the claims of the present invention so that those skilled in the art can understand the claims. The protection scope of the present invention is not limited to the following specific implementation structures. The technical solutions of the claims of the present invention made by those skilled in the art but different from the following specific implementations are also within the protection scope of the present invention.

[0054] In the description of the present invention, the terms "first", "second", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0055] The following is combined with Figures 1 to 7 An embodiment of the method of the present invention is described.

[0056] S1. For rebar drawing and quantity calculation, focus on the rebar list and large drawing area, such as Figure 2 As shown in the figure, the bitmap format steel bar drawing is fully recognized to obtain the text box and straight line in the drawing data; the characteristic value hc is calculated; the straight lines are straightened and merged, and the horizontal line analysis is performed to obtain the steel bar table area, as follows:

[0057] S101, identifying all horizontal lines and text boxes in a bitmap format image containing steel bar drawing data; converting the image containing steel bar drawing data into a grayscale image, with a Canny threshold value of (5, 250); using Chinese and English fonts, and using the image_to_data function of pytesseract to identify the steel bar drawing data, the height of the text box can be obtained;

[0058] The HoughLineP function is used with parameters of 1 degree, minimum length 0, and maximum gap hc to identify and obtain a straight line.

[0059] S102, sort the text box heights and take the median value hc;

[0060] S103, straightening and merging are performed to correct the straight lines. In order to improve the accuracy of line recognition, the recognized lines are straightened. When the difference dx between the horizontal coordinates of the two end points of a straight line is less than 0.2*hc, the line is corrected to a vertical line; when the difference dy between the vertical coordinates of the two end points of a straight line is less than 0.2*hc, the line is corrected to a horizontal line;

[0061] Preferably, since the lines in the steel bar drawing data are generally thick outlines, i.e., double lines, and may be intermittent, in order to merge the double lines into single lines and merge the discontinuous lines into continuous lines to obtain a vector single line drawing consistent with the original drawing content, the following steps are also included:

[0062] Traverse all adjacent parallel lines. When two adjacent parallel lines L A and L B The distance is less than 0.6*hc, and from L A Any end point of L B Draw a perpendicular with the foot point at L B Between the two endpoints, delete L A and L B For shorter lines, set L A and L B The longer line is extended to get a total length line L AB The total length line L AB The coordinates of the two endpoints are L A Projection to L B The two endpoints after synthesis, such as Figure 3 shown.

[0063] S104, obtaining the area of ​​the steel bar list in the steel bar drawing data according to the characteristic value hc and the identified horizontal straight line; the method is as follows:

[0064] S1.1. Perform double-line comparison on all identified horizontal lines in a loop, and find three adjacent lines that meet the following condition 1;

[0065] Condition 1: The length of the two lines is greater than 15*hc, the horizontal distance of the two lines is less than 8*hc, the difference in the length of the two lines is less than hc, and the difference in the horizontal coordinates of the left endpoints of the two lines is less than hc;

[0066] S1.2, based on the topmost line and the bottommost line of the three adjacent lines, continuously search upward and downward for adjacent lines that meet condition 1;

[0067] S1.3. The area determined by the left endpoint coordinates of the top line and the right endpoint coordinates of the bottom line among all adjacent lines that meet condition 1 is the reinforcement table area.

[0068] S2. Convert the image into a high-definition image, and identify the text in the area of ​​the steel bar list; and identify the steel bar lines and other text in the area outside the steel bar list.

[0069] S200. Use the resize function of OpenCV to convert the resolution of the bitmap format image containing the steel bar drawing data to 150dpi to obtain a high-definition image, whose image magnification factor is recorded as f, to improve the subsequent OCR recognition quality.

[0070] In this embodiment, the following two calculation methods are then executed synchronously, wherein method 1 is used to identify the text in the steel bar list; method 2 is used to identify the straight lines and texts except the steel bar list. The specific algorithms of each method are as follows:

[0071] Method 1: Identify the text in the steel bar schedule

[0072] S201.1. For the converted high-definition image, the steel bar list area is intercepted for separate recognition. The Chinese and English fonts are used to perform a recognition on the entire image based on pytesseract's image_to_data to obtain the text box.

[0073] S201.2, modify the text box, including edge removal, frame removal and frame merging operations;

[0074] The method of performing edge removal operation on the text box includes: finding the end of the vertical black point from left to right, removing the redundant blank area on the left, and similarly finding the calculation method of black pixels in the four directions of up, down, left and right to remove the redundant white edges of each word, and removing the text box with Min (box height, box width) less than 0.2*hc*f;

[0075] Methods for removing the outer frame of a frame include: if the upper left vertex and the lower right vertex of a small frame are within the upper left and lower right range of a large frame, then the large frame is removed;

[0076] The method for performing frame merging calculation includes: when the upper left vertex or lower right vertex of a frame is within the upper left and lower right range of another frame, taking the coordinate envelope value of the two frames;

[0077] S201.3. Take screenshots of each text box and use the easyOCR Chinese and English libraries to recognize the text content. Figure 4 shown.

[0078] Method 2: Identify the steel bar lines and text outside the steel bar schedule

[0079] S202.1. Traverse the straight lines outside the steel bar list area, obtain all straight lines whose length is greater than 1.5*hc, obtain a set S, perform position correction and length correction on each line, and find associated lines;

[0080] S202.2, traverse each line in the set S, and use the following algorithm to identify the steel bar lines;

[0081] S202.2.1. Correct the position of the line, i.e. obtain the midpoint, 1 / 4 and 3 / 4 points a1, a2, a3 on the straight line L, L∈S;

[0082] Preferably, a1, a2, and a3 are simultaneously translated perpendicularly to the straight line L by plus or minus one pixel to obtain three groups of points (a1, a2, a3), (b1, b2, b3), and (c1, c2, c3). If all the pixels of one group of points in the three groups are black, it is considered that the long line really exists, and the operation of the subsequent steps is continued; otherwise, the process returns to step S201.2.1, and the next line in the set S is taken to continue the subsequent steps;

[0083] S202.2.2. Shift the straight line formed by the three points a1, a2, and a3 perpendicularly to the straight line L three times in positive and negative directions, and obtain a total of seven straight lines, with the spacing between adjacent lines being the distance of three pixels.

[0084] S202.2.3. Calculate the sum of the pixel values ​​of the three points on each of the seven straight lines on the corresponding straight line, pixel by pixel. In this embodiment, the pixel value is a grayscale value. Take the straight line with the smallest sum as the midline L of the straight line L. m ,like Figure 5 As shown;

[0085] S202.2.4, correct the length of the line, and change the center line L m Extend the line pixel by pixel towards both ends until a white pixel is found, and then the line L is obtained. m ', the first straight line search is completed;

[0086] S202.2.5, continue on straight line L m The two endpoints of ' use 360-degree rays to find black points, ending at white points, and obtain the continuous length of black pixels on each degree ray, and take the longest ray L m,r , L m,r The far end point continues to use the 360-degree ray algorithm until no associated line is found;

[0087] S202.2.6, extension line L m ', L m,r The desired reinforcement line is Figure 6 shown.

[0088] S3, divide the steel bar lines identified in step S2 for the area outside the steel bar list into horizontal lines, vertical lines and oblique lines; for horizontal lines and vertical lines, place a rectangle within the (0.5-2)hc*f height range and hc*f width range of the perpendicular bisector of the horizontal or vertical lines, first verify whether there are black spots in the rectangle, if there are black spots, continue, use the up, down, left, and right text extension algorithm to expand the rectangle to the full text box, easyOCR recognizes the content and erases the text on the picture; for oblique lines, take a screenshot with the up, down, left, and right distance 2*hc*f of the center point of the line, then turn the rectangle to the right according to the oblique angle, and use easyOCR to recognize the turned text. This step is to recognize the remaining useful text that has not been recognized. This step is to invest a small box to expand it pixel by pixel to the text box, which is very accurate and suitable for 100% recognition of the text at the target position.

[0089] Further explanation of the text extension algorithm considering the gap between characters to find continuous characters, such as Figure 7 As shown, the left and right boxes are extended to the vertical white point respectively and the text border line ends at the point where the distance from the nearest black dot vertical line is greater than 0.5hc*f, indicating that there is no continuous text; and easyOCR Chinese and English libraries are used to recognize text content, and after recognition, the text box range is whitened out on the high-definition image.

[0090] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0091] The present application also provides an embodiment of a bitmap format steel bar drawing data extraction system, including a steel bar list area acquisition module, a text recognition module and a steel bar line recognition module;

[0092] The steel bar detailed list area acquisition module is used to perform full-image recognition on the steel bar drawing data to obtain text boxes and straight lines in the drawing data, obtain the characteristic value hc in the steel bar drawing data based on all the recognized text boxes; and obtain the area of ​​the steel bar detailed list in the steel bar drawing data based on the characteristic value hc and the recognized horizontal straight line;

[0093] The text recognition module is used to recognize the text in the reinforcement drawing data;

[0094] The rebar line recognition module is used to recognize rebar lines in rebar drawing data.

[0095] In another embodiment, a straight line merging module is further included, which is used to merge all adjacent parallel lines that meet the set conditions, and the method is as follows:

[0096] Traverse all adjacent parallel lines. When two adjacent parallel lines L A and LB The spacing is less than the first set multiple of the characteristic value hc, and from L A Any end point of L B Draw a perpendicular with the foot point at L B Between the two endpoints, delete L A and L B For shorter lines, set L A and L B The longer line is extended to get a total length line L AB The total length line L AB The coordinates of the two endpoints are L A Projection to L B The two endpoints after synthesis.

[0097] In another embodiment, it also includes a straight line straightening module for straightening the identified lines, and the correction method is as follows: when the difference dx between the horizontal coordinates of the two endpoints of a straight line is less than the sixth set multiple of the eigenvalue hc, the line is straightened into a vertical line; when the difference dy between the vertical coordinates of the two endpoints of a straight line is less than the sixth set multiple of the eigenvalue hc, the line is straightened into a horizontal line.

[0098] The contents not described in detail in this specification belong to the prior art known to professional and technical personnel in this field.

Claims

1. A method for extracting steel bar drawing data in bitmap format, characterized in that: The steps include: S1. Performing full image recognition on a bitmap format image containing steel bar drawing data to obtain text boxes and straight lines in the drawing data, obtaining a characteristic value hc of the steel bar drawing data according to the heights of all recognized text boxes; and obtaining an area of ​​a steel bar list in the steel bar drawing data according to the characteristic value hc and the recognized horizontal straight line; S2. Recognize the text in the area of ​​the steel bar list; recognize the steel bar lines and text in the area outside the steel bar list; The method for obtaining the area of ​​the steel bar list in step S1 is as follows: S1.

1. Perform double-line comparison on all identified horizontal lines and find three adjacent lines that meet the following condition 1; Condition 1: The lengths are all greater than the second set multiple of the eigenvalue hc; the spacing is less than the third set multiple of the eigenvalue hc; the length difference is less than the fourth set multiple of the eigenvalue hc; the difference in the horizontal coordinates of the left endpoints is less than the fifth set multiple of the eigenvalue hc; S1.2, based on the topmost line and the bottommost line of the three adjacent lines, continuously search upward and downward for adjacent lines that meet condition 1; S1.

3. The area determined by the left endpoint coordinates of the top line and the right endpoint coordinates of the bottom line among all adjacent lines that meet condition 1 is the reinforcement table area.

2. The method for extracting bitmap format steel bar drawing data as claimed in claim 1, characterized in that: The step S1 also includes merging the identified straight lines in the following method: Traverse all adjacent parallel lines. When two adjacent parallel lines L A and L B The spacing is less than the first set multiple of the characteristic value hc, and from L A Any end point of L B Draw a perpendicular with the foot point at L B Between the two endpoints, delete L A and L B For shorter lines, set L A and L B The longer line is extended to get a total length line L AB The total length line L AB The coordinates of the two endpoints are L A Projection to L B The two endpoints after synthesis.

3. The method for extracting bitmap format steel bar drawing data as claimed in claim 1, characterized in that: The step S1 also includes straightening the identified lines. When the difference dx between the horizontal coordinates of the two endpoints of a straight line is less than the sixth set multiple of the eigenvalue hc, the line is straightened into a vertical line; when the difference dy between the vertical coordinates of the two endpoints of a straight line is less than the sixth set multiple of the eigenvalue hc, the line is straightened into a horizontal line.

4. The method for extracting bitmap format steel bar drawing data according to any one of claims 1 to 3, characterized in that: The step S2 also includes converting the original bitmap resolution of the steel bar drawing data into a high-definition image, and the magnification factor thereof is denoted as f.

5. The method for extracting bitmap format steel bar drawing data as claimed in claim 4, characterized in that: In step S2, for the area of ​​the steel bar list, the method for identifying the text therein includes: S201.

1. Obtain the positioning coordinate value of each text box in the steel bar list area; S201.2, modifying the text box, the modification including border removal operation, frame outer frame removal and frame merging operation; S201.

3. Take screenshots of each text box range one by one to identify the text content.

6. The method for extracting bitmap format steel bar drawing data according to any one of claims 1 to 3 and 5, characterized in that: In step S2, for the area outside the steel bar list, the method for identifying steel bar lines includes: S202.

1. Traverse the straight lines outside the steel bar list area, obtain all straight lines whose lengths are greater than the seventh set multiple of the characteristic value hc, and obtain a set S; S202.2, traverse each line in the set S, and use the following algorithm to identify the steel bar lines; S202.2.

1. Obtain three points a1, a2, a3 spaced apart on the line L, L∈S; S202.2.

2. The straight line formed by the three points a1, a2, and a3 is translated perpendicularly to the straight line L by a plurality of set distances, to obtain a plurality of straight lines; S202.2.

3. Calculate the sum of the pixel values ​​of the three points on each of the plurality of straight lines on a pixel-by-pixel basis, and take the straight line with the smallest sum as the median line L of the straight line L. m ; S202.2.4, the center line L m Extend pixel by pixel to both ends until a white point is found and a straight line L is obtained. m '; S202.2.5, continue on straight line L m The two endpoints of ' use 360-degree rays to find continuous black pixels, ending at white pixels, and obtain the continuous length of black pixels on each degree ray, and take the longest ray L m,r , L m,r The far end point continues to use the 360-degree ray algorithm until no associated line is found; S202.2.6, extension line L m ', ray L m,r This is the desired reinforcement line.

7. The method for extracting bitmap format steel bar drawing data as claimed in claim 4, characterized in that: After step S2, the following step S3 is also included: S3, dividing the steel bar lines for the area outside the steel bar list identified in step S2 into horizontal lines, vertical lines and oblique lines; for the horizontal lines and vertical lines, placing a rectangle within the height range of (0.5~2)hc*f and the width range of hc*f of the perpendicular bisector of the horizontal or vertical lines, searching whether there are non-white pixels within the rectangular range, if so, using the up, down, left, and right text extension algorithm based on the height and width range of the perpendicular bisector to expand to the full text box and identify the content of the text box; for the oblique line, taking a screenshot with the up, down, left, and right distance of 2*hc*f from the center point of the oblique line, then straightening the rectangular screenshot according to the oblique line angle, and identifying the straightened text.

8. A bitmap format steel bar drawing data extraction system according to the method of claim 1, characterized in that: It includes a steel bar list area acquisition module, a text recognition module and a steel bar line recognition module; The steel bar detailed list area acquisition module is used to perform full-image recognition on the steel bar drawing data to obtain text boxes and straight lines in the drawing data, obtain characteristic values ​​hc in the steel bar drawing data according to all recognized text boxes; and obtain the area of ​​the steel bar detailed list in the steel bar drawing data according to the characteristic values ​​hc and the recognized horizontal straight lines; The text recognition module is used to recognize the text in the steel bar drawing data; The steel bar line recognition module is used to recognize steel bar lines in steel bar drawing data.

9. The bitmap format steel bar drawing data extraction system according to claim 8, characterized in that: It also includes a straight line merging module for merging all adjacent parallel lines that meet set conditions.