Drawing table area detection method and device, storage medium and electronic equipment

By using point-by-point path finding and convolution operators to detect the nuclear power drawing table area, the problems of high cost and low efficiency in the existing technology are solved, and low-cost and high-precision drawing table area detection is achieved.

CN117218675BActive Publication Date: 2025-10-10CHINA NUCLEAR POWER ENGINEERING COMPANY LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311216105.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-19
Publication Date
2025-10-10
Estimated Expiration
2043-09-19

AI Technical Summary

Technical Problem

Existing technologies for nuclear power drawing and table inspection have the problems of huge manpower costs and easy misdetection and omission. In addition, existing methods consume large resources or the models are difficult to adapt to the inconsistencies and interferences of drawings and tables.

Method used

A drawing table area detection method is constructed. The original image is obtained for preprocessing, the initial point is selected, the inner border is detected by point-by-point path finding, and the table area is detected based on the inner border. The heuristic algorithm and convolution operator are used to accurately locate and extract the drawing table area.

Benefits of technology

It achieves low-cost, high-precision drawing and table area detection, avoids large amounts of data labeling and resource consumption in deep learning, is not disturbed by drawing content, and improves detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117218675B_ABST
    Figure CN117218675B_ABST
Patent Text Reader

Abstract

The present application relates to a drawing table area detection method, device, storage medium and electronic equipment, comprising the following steps: obtaining the original image of the drawing to be detected; preprocessing the original image of the drawing to be detected to obtain the binary image of the drawing to be detected; selecting an initial point in the binary image of the drawing to be detected; based on the initial point, using the point-by-point path finding method to detect the inner frame of the binary image of the drawing to be detected to obtain the inner frame of the drawing; based on the inner frame of the drawing, detecting the table area to obtain all the table areas in the drawing to be detected; extracting the table from all the table areas in the drawing to be detected to obtain all the tables in the drawing to be detected. The present application avoids the large amount of data labeling work in the deep learning method by pixel-level processing of the image, without the need for a large amount of resource consumption for model training, nor the need for AI team support, with low cost; moreover, the present application is not disturbed by the content of the drawing, with high precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of drawing table detection, and more specifically, to a drawing table area detection method, device, storage medium and electronic equipment. Background Art

[0002] Standardized nuclear power drawing files generally contain two types of information: drawing content information (various components and assembly drawings) and drawing file description information. The drawing content is generally distributed in the center of the drawing, and the drawing file description information is generally presented in the form of a table, including parts list, spare parts list, drawing file information, etc., attached to the inner border of the drawing. When performing a formal inspection of the file, it is necessary to rely on manual inspection of the table file information in the drawing. In some large projects, the number of drawings is very large. Manual identification of table information in the drawings usually requires huge manpower costs and is prone to mischecks and omissions. Drawing table recognition is divided into three subtasks: table area detection, table structure recognition, and table content recognition. The first step is to locate and extract the table, which is the basis for table structure recognition and table content recognition. Therefore, the efficiency and accuracy of positioning and extraction directly affect the subsequent structured extraction effect.

[0003] Currently, there are two common approaches to detecting tables in drawings. Option 1: Target tables in nuclear power drawings using a convolutional neural network model through extensive training to develop a model capable of automatically locating and identifying tables. This model is then used for generalized recognition of tables in drawings. Option 2: Based on an existing table document recognition model, fine-tune the model for domain-specific tables and then use the fine-tuned model for generalized recognition of tables in drawings.

[0004] In Option 1, as long as the training is appropriate, tables in any scenario can theoretically be located and recognized. However, this recognition process is complex and unexplainable, and consumes a lot of resources. Furthermore, its deployment and maintenance require the support of a professional AI team, which is very costly. In Option 2, while model fine-tuning technology can be trained with limited resources, existing table document recognition models are trained based on ordinary document tables. The trained tables are very regular, completely inconsistent with the unevenly arranged cell sizes of drawings. Furthermore, drawing tables are easily disturbed by the drawing content, making fine-tuning difficult. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a drawing table area detection method, device, storage medium and electronic equipment.

[0006] The technical solution adopted by the present invention to solve the technical problem is to construct a drawing table area detection method, which includes the following steps:

[0007] Obtain the original image of the drawing to be inspected;

[0008] Preprocessing the original image of the drawing to be detected to obtain a binary image of the drawing to be detected;

[0009] Selecting an initial point in the binary image of the drawing to be detected;

[0010] Based on the initial point, an inner frame detection is performed on the binary image of the drawing to be detected by adopting a point-by-point path finding method to obtain the inner frame of the drawing;

[0011] Performing table area detection based on the inner border of the drawing to obtain all table areas in the drawing to be detected;

[0012] Table extraction is performed on all table areas in the drawing to be detected to obtain all tables in the drawing to be detected.

[0013] In the drawing table area detection method of the present invention, preprocessing the original image of the drawing to be detected to obtain a binary image of the drawing to be detected includes:

[0014] Performing gamma transformation on the original image of the drawing to be inspected to obtain an enhanced image;

[0015] Performing grayscale processing on the enhanced image to obtain a grayscale image of the drawing to be inspected;

[0016] The grayscale image of the drawing to be detected is binarized, and the binarized image is inverted to obtain a binarized image of the drawing to be detected.

[0017] In the drawing table area detection method of the present invention, selecting an initial point in the binary image of the drawing to be detected includes:

[0018] Step a1. Randomly select a point in the binary image of the drawing to be detected as an anchor point;

[0019] Step a2. Obtain the scene convolution operator of the anchor point;

[0020] Step a3. Detect whether all element values ​​in the scene convolution operator of the anchor point are preset values;

[0021] Step a4. If yes, select the anchor point as the initial point;

[0022] Step a5. If not, move one pixel to the left and repeat steps a1 to a4 to reselect the initial point.

[0023] In the drawing table area detection method of the present invention, the inner border detection of the binary image of the drawing to be detected is performed in a point-by-point path finding manner based on the initial point to obtain the inner border of the drawing, which includes:

[0024] Step b1. Taking the initial point as the starting point, set the moving step size;

[0025] Step b2. After completing the setting of the moving step length, use the obstacle judgment algorithm to determine whether there will be an obstacle at the next position. If there is no obstacle, move at the moving step length; if there is an obstacle, execute step b3;

[0026] Step b3. Obstacle category determination algorithm is used to calculate the category to obtain the obstacle category; the obstacle category includes: flat angle obstacle, concave angle obstacle or convex angle obstacle;

[0027] Step b4. Based on the calculated obstacle category, use the path finding direction calculation algorithm to update the directional convolution operator of the previous step position to obtain the directional convolution operator after the previous step position update;

[0028] Step b5. Using the directional convolution operator after the previous position update, and calculating the coordinate information of the next position point according to the point coordinate calculation algorithm after the move, and moving to the next position point;

[0029] Step b6. Repeat steps b2 to b5 to search for a path, and stop searching when the path that has been searched is met during the search process to obtain the inner frame of the drawing.

[0030] In the drawing table area detection method of the present invention, the step b2 of using an obstacle judgment algorithm to judge whether an obstacle will be encountered in the next step includes:

[0031] Perform matrix dot multiplication on the directional convolution operator and the scene convolution operator at the previous step to obtain a result matrix;

[0032] Determine whether the result matrix is ​​a 0 matrix;

[0033] If the result matrix is ​​a 0 matrix, it is determined that there is an obstacle at the next step;

[0034] If the result matrix is ​​not a 0 matrix, it is determined that there is no obstacle in the next step.

[0035] In the drawing table area detection method of the present invention, the obstacle category determination algorithm used to calculate the obstacle category in step b3 includes:

[0036] If the result matrix is ​​a 0 matrix, obtain the number of 0 elements in the 0 matrix;

[0037] If the number of 0 elements in the 0 matrix is ​​the first value, it is a straight angle obstacle;

[0038] If the number of 0 elements in the 0 matrix is ​​the second value, it is a concave corner obstacle;

[0039] If the number of 0 elements in the 0 matrix is ​​a third value, it is a convex corner obstacle.

[0040] In the drawing table area detection method of the present invention, in step b4, based on the calculated obstacle category, a path finding direction calculation algorithm is used to update the directional convolution operator of the previous position, and obtaining the directional convolution operator after the updated previous position includes:

[0041] If the calculated obstacle type is a straight angle or a concave angle, the directional convolution operator of the previous position is rotated clockwise by a preset angle to obtain the updated directional convolution operator of the previous position;

[0042] If the calculated obstacle type is a convex corner, the directional convolution operator of the previous position is rotated counterclockwise by a preset angle to obtain the updated directional convolution operator of the previous position.

[0043] In the drawing table area detection method of the present invention, the step b5 uses the directional convolution operator after the position update in the previous step, and calculates the coordinate information of the next position point according to the point coordinate calculation algorithm after the movement, including:

[0044] Perform matrix dot multiplication on the coordinate convolution operator of the initial point and the directional convolution operator after the position update in the previous step to obtain a dot product result matrix;

[0045] Extracting non-zero elements in the dot product result matrix;

[0046] Using the subscript of the non-zero element in the dot product result matrix as the index, search in the coordinate convolution operator at the previous step to obtain the corresponding element in the coordinate convolution operator at the previous step;

[0047] The coordinate convolution operator of the next step position point is reconstructed based on the corresponding elements to obtain the coordinate information of the next step position point.

[0048] In the drawing table area detection method of the present invention, performing table area detection based on the inner border of the drawing to obtain all table areas in the drawing to be detected includes:

[0049] Perform detection based on the inner border of the drawing to obtain a valid inflection point set;

[0050] Table area detection is performed based on the valid inflection point set to obtain all table areas in the drawing to be detected.

[0051] In the drawing table form area detection method, the detection based on the inner frame of the drawing obtains an effective inflection point set, which includes:

[0052] Step c1. A moving straight line is drawn at the origin of the coordinate axis and perpendicular to the horizontal axis, and the origin is moved along the horizontal axis to the right by one pixel step;

[0053] Step c2. After each movement, the number of intersection points of the moving straight line and the inner frame of the drawing is calculated, and it is judged whether the number of intersection points is greater than a threshold value. If the number of intersection points is greater than the threshold value, step c3 is executed, otherwise the moving straight line is moved back to step c1.

[0054] Step c3. The intersection of the first straight line on the left side of the moving straight line and the inner frame of the drawing and the intersection of the second straight line on the right side of the moving straight line and the inner frame of the drawing are calculated respectively to obtain a first intersection point set and a second intersection point set. The first intersection point set is all intersection points of the first straight line on the left side of the moving straight line and the inner frame of the drawing, and the second intersection point set is all intersection points of the second straight line on the right side of the moving straight line and the inner frame of the drawing.

[0055] Step c4. The first judgment value and the second judgment value are obtained based on the first intersection point set and the second intersection point set, and the effective inflection point is obtained based on the calculation of the first judgment value and the second judgment value.

[0056] Step c5. Steps c2 to c4 are repeatedly executed until the moving straight line moves to the rightmost frame of the inner frame of the drawing.

[0057] In the drawing table form area detection method, the first judgment value and the second judgment value are obtained based on the first intersection point set and the second intersection point set, and the effective inflection point is obtained based on the calculation of the first judgment value and the second judgment value, which includes:

[0058] The first minimum ordinate and the first maximum ordinate are obtained based on the first intersection point set;

[0059] The second minimum ordinate and the second maximum ordinate are obtained based on the second intersection point set;

[0060] The first judgment value is obtained according to the calculation of the first minimum ordinate and the second minimum ordinate;

[0061] The second judgment value is obtained according to the calculation of the first maximum ordinate and the second maximum ordinate;

[0062] It is judged whether the first judgment value or the second judgment value is greater than or equal to a judgment threshold value;

[0063] If the first judgment value is greater than or equal to the judgment threshold, then respectively calculating the intersection points of the first vertical line and the second vertical line with the moving straight line; the intersection point of the first vertical line with the moving straight line and the intersection point of the second vertical line with the moving straight line are valid inflection points;

[0064] And / or, if the second judgment value is greater than or equal to the judgment threshold, the intersection points of the third vertical line and the fourth vertical line with the moving straight line are calculated respectively; the intersection point of the third vertical line with the moving straight line and the intersection point of the fourth vertical line with the moving straight line are valid inflection points.

[0065] In the drawing table area detection method of the present invention, performing table area detection based on the valid inflection point set to obtain all table areas in the drawing to be detected includes:

[0066] Constructing an ordered set based on the valid inflection point set;

[0067] Table area detection is performed based on the ordered set to obtain all table areas in the drawing to be detected.

[0068] In the drawing table area detection method of the present invention, constructing an ordered set based on the valid inflection point set includes:

[0069] Searching based on the valid inflection point set to obtain a valid inflection point with a vertical coordinate of 0;

[0070] The valid inflection points with a vertical coordinate of 0 are arranged in descending order according to the horizontal coordinates and indexed to form the ordered set.

[0071] In the drawing table area detection method of the present invention, performing table area detection based on the ordered set to obtain all table areas in the drawing to be detected includes:

[0072] According to the ordered set, the diagonal vertex method is used to determine the first and last table areas of the upper boundary of the inner border of the drawing and the first and last table areas of the lower boundary of the inner border of the drawing;

[0073] After completing the detection of the first and last table areas of the upper boundary and the first and last table areas of the lower boundary, grouping the remaining valid inflection points in the ordered set according to the index parity principle;

[0074] After the teaming is completed, the diagonal vertex method is used to determine the middle table area of ​​the upper boundary of the inner border of the drawing and the middle table area of ​​the lower boundary of the inner border of the drawing.

[0075] The present invention also provides a drawing table area detection device, comprising:

[0076] An acquisition unit, used for acquiring an original image of a drawing to be inspected;

[0077] A preprocessing unit, configured to preprocess the original image of the drawing to be detected to obtain a binary image of the drawing to be detected;

[0078] A selection unit, configured to select an initial point in the binary image of the drawing to be inspected;

[0079] a frame detection unit, configured to perform inner frame detection on the binary image of the drawing to be detected by adopting a point-by-point path finding method based on the initial point to obtain the inner frame of the drawing;

[0080] A table area detection unit, configured to detect table areas based on the inner border of the drawing, and obtain all table areas in the drawing to be detected;

[0081] The table extraction unit is used to extract tables from all table areas in the drawing to be detected to obtain all tables in the drawing to be detected.

[0082] The present invention also provides a storage medium storing a computer program, wherein the computer program is suitable for being loaded by a processor to execute the steps of the drawing table area detection method as described above.

[0083] The present invention also provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps of the drawing table area detection method described above by calling the computer program stored in the memory.

[0084] The drawing table area detection method, device, storage medium and electronic device implemented in the present invention have the following beneficial effects: comprising the following steps: obtaining the original image of the drawing to be detected; pre-processing the original image of the drawing to be detected to obtain a binary image of the drawing to be detected; selecting an initial point in the binary image of the drawing to be detected; performing inner frame detection on the binary image of the drawing to be detected using a point-by-point path finding method based on the initial point to obtain the inner frame of the drawing; performing table area detection based on the inner frame of the drawing to obtain all table areas in the drawing to be detected; performing table extraction on all table areas in the drawing to be detected to obtain all tables in the drawing to be detected. The present invention avoids a large amount of data annotation work based on deep learning methods by performing pixel-level processing on the image, does not require a large amount of resources for model training, does not require support from an AI team, and has low cost; moreover, the present invention is not affected by the content of the drawing and has high accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0086] Figure 1It is a flow chart of the drawing table area detection method provided by the present invention;

[0087] Figure 2 It is a schematic diagram of the inner frame of the drawing provided by the present invention;

[0088] Figure 3 is a schematic diagram of the obstacle categories provided by the present invention;

[0089] Figure 4 It is a schematic diagram of the inflection point provided by the present invention;

[0090] Figure 5 Schematic diagram of effective inflection points and invalid inflection points provided by the present invention;

[0091] Figure 6 Schematic diagram of obtaining effective inflection points provided by the present invention;

[0092] Figure 7 It is a schematic diagram of all valid inflection points of the drawings provided by the present invention;

[0093] Figure 8 It is a schematic diagram of the first and last table areas of the upper boundary provided by the present invention;

[0094] Figure 9 is a schematic diagram of the middle table area of ​​the upper boundary provided by the present invention;

[0095] Figure 10 It is a logic block diagram of the drawing table area detection device provided by the present invention. DETAILED DESCRIPTION

[0096] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0097] Figure 1A preferred embodiment of the drawing table area detection method provided by the present invention is shown. The drawing table area detection method is a drawing table area detection method based on a heuristic algorithm and a convolution operator, and is a table area detection method based on image processing. Among them, the drawing table area detection method can be applied to the table area detection in nuclear power drawings. Specifically, the image direction convolution operator, the scene convolution operator and the coordinate convolution operator of the present invention use these three operators to control the search direction, and combined with the idea of ​​the heuristic greedy algorithm, the inner border of the drawing (referring to the largest area containing the drawing content) can be optimally found. Then, by calculating the pixel inflection point, the table in the nuclear power drawing is accurately located, and finally the drawing is image cut through the inflection point to extract all the tables in the drawing.

[0098] The convolution operator is: a fixed-size matrix whose central element is called the anchor point.

[0099] The directional convolution operator is: a convolution operator used to control the search direction when identifying drawings and tables. Specifically, in this embodiment, the directional convolution operator can be represented by a 3*3 matrix, which represents the direction in which the point moves in the process of the point following the path, where the direction of movement is determined by the orientation of the element 1 relative to the anchor point. When the four elements above, below, left, and right of the anchor point are 1, it indicates that the path search direction is upward, downward, left, and right, respectively. In the directional convolution operator, there is only one element 1, and the rest of the elements are 0. The directional convolution operators designed and used in this patent are shown as D1 to D4. In the nuclear power drawing table area detection method, the directional convolution operator of the initial point is set to D3 by default.

[0100]

[0101] The scene convolution operator is a convolution operator used to represent the information of the pixels around a pixel when performing drawing recognition. Specifically, in this embodiment, the scene convolution operator is represented by a 3*3 matrix, which represents the environmental information around the current position of the point (i.e., the position of the anchor point). In the scene convolution operator, the element value is 0 or 255. Among them, 255 is defined to represent the background point of the drawing, and 0 represents the border point of the drawing. The following is an example of a typical drawing scene convolution operator.

[0102]

[0103]

[0104] Among them, E1 means that the 9 pixels around the node are background points, and E2 means that the three pixels to the left of the node are border points and cannot be passed.

[0105] The coordinate convolution operator is a convolution operator used to represent pixel coordinate information during drawing recognition. Specifically, in this embodiment, the coordinate convolution operator is represented by a 3*3 matrix, which represents the coordinate information of the elements around the anchor point, as shown in the following example.

[0106]

[0107] Among them, P i Represents the coordinate convolution operator of anchor point i, where the coordinates of point i are (x, y).

[0108] Specifically, such as Figure 1 As shown, the drawing table area detection method includes the following steps:

[0109] Step S101: Obtain the original image of the drawing to be inspected.

[0110] Specifically, in this step, the original image of the drawing to be inspected can be obtained in any existing manner, such as directly calling it from a database, or directly importing it by a user, etc. The present invention does not impose any specific limitation.

[0111] Step S102: Preprocess the original image of the drawing to be inspected to obtain a binary image of the drawing to be inspected.

[0112] In this embodiment, preprocessing the original image of the drawing to be inspected to obtain a binarized image of the drawing to be inspected includes: performing gamma transformation on the original image of the drawing to be inspected to obtain an enhanced image; performing grayscale processing on the enhanced image to obtain a grayscale image of the drawing to be inspected; and binarizing the grayscale image of the drawing to be inspected, and inverting the binarized image to obtain a binarized image of the drawing to be inspected.

[0113] Specifically, after obtaining the original image of the drawing to be inspected, a gamma transform is first performed on the original image to adjust the image brightness, increase contrast, eliminate noise, and improve visual effects, thereby enhancing the image. The enhanced image is then grayscaled to obtain a grayscale image of the drawing. This grayscale image is then binarized, and the binarized image is inverted to obtain a binary image of the drawing to be inspected. In this binary image, points with a pixel value of 255 represent the drawing background, and points with a pixel value of 0 represent the drawing border.

[0114] Step S103: Select an initial point in the binary image of the drawing to be inspected.

[0115] In this embodiment, selecting an initial point in the binary image of the drawing to be inspected includes the following steps:

[0116] Step a1. Randomly select a point in the binary image of the drawing to be detected as an anchor point.

[0117] Step a2. Obtain the scene convolution operator of the anchor point.

[0118] Step a3: Check whether all element values ​​in the scene convolution operator of the anchor point are preset values.

[0119] Step a4. If yes, select the anchor point as the initial point.

[0120] Step a5. If not, randomly move a pixel distance and repeat steps a1 to a4 to reselect the initial point.

[0121] Specifically, a point is randomly selected from the binary image of the drawing to be inspected as an anchor point, which serves as the starting point for path finding. The scene convolution operator for this anchor point is then obtained, and the values ​​of all elements in the scene convolution operator for this anchor point are checked to see if they are all 255. If so, this point is selected as the initial point. If not, it is moved one pixel to the left and then reselected according to the above rules.

[0122] Step S104: Based on the initial point, the inner frame of the binary image of the drawing to be inspected is detected by using a point-by-point path finding method to obtain the inner frame of the drawing.

[0123] In this embodiment, the inner frame detection is performed on the binary image of the drawing to be inspected by using a point-by-point path finding method based on the initial point, and obtaining the inner frame of the drawing includes the following steps:

[0124] Step b1: Using the initial point as the starting point, set the moving step length, where the moving step length can be set to one pixel.

[0125] Step b2. After completing the setting of the moving step length, use the obstacle judgment algorithm to determine whether there will be an obstacle in the next position. If there is no obstacle, move at the moving step length; if there is an obstacle, execute step b3.

[0126] Among them, the obstacle judgment algorithm used in step b2 to judge whether the next position will encounter an obstacle includes: performing matrix dot multiplication on the directional convolution operator and the scene convolution operator of the previous step position to obtain a result matrix; judging whether the result matrix is ​​a 0 matrix; if the result matrix is ​​a 0 matrix, it is judged that there is an obstacle in the next position; if the result matrix is ​​not a 0 matrix, it is judged that there is no obstacle in the next position. Specifically, let point A be the initial point, and the directional convolution operator, scene convolution operator and coordinate convolution operator of point A are respectively represented as A D 、A E and A P ; Let the new point after point A moves one step be A′, and the direction convolution operator, scene convolution operator and coordinate convolution operator of point A′ are represented as A′ respectively. D, A′ E and A′ P .

[0127] Point A uses directional convolution operator A D When performing mobile path finding, it is necessary to determine whether the position after moving is an obstacle. If the next position point is an obstacle, the directional convolution operator needs to be adjusted. D and scene convolution operator A E Perform a matrix multiplication and then determine whether the resulting matrix R is a zero matrix (all elements in the matrix are zero). If the resulting matrix is ​​a zero matrix, the next point is an obstacle; if not, the next point is a background element. The specific formula is as follows. The returned result y indicates an obstacle, and n indicates no obstacle.

[0128] A D ⊙A E =R=0?y:n;

[0129] Step b3. Use the obstacle category determination algorithm to perform category calculation to obtain the obstacle category; the obstacle category includes: flat angle obstacle, concave angle obstacle or convex angle obstacle.

[0130] In this embodiment, calculating the obstacle category using the obstacle category determination algorithm in step b3 includes: if the result matrix is ​​a 0 matrix, obtaining the number of 0 elements in the 0 matrix; if the number of 0 elements in the 0 matrix is ​​a first value, the obstacle is a straight angle obstacle; if the number of 0 elements in the 0 matrix is ​​a second value, the obstacle is a concave angle obstacle; if the number of 0 elements in the 0 matrix is ​​a third value, the obstacle is a convex angle obstacle. The first value is 3, the second value is 5, and the third value is 1.

[0131] In this embodiment, a flat angle obstacle is defined as a horizontal line and a vertical line with an angle of 180°. Figure 3 As shown in point A; concave angle obstacle: the angle between the horizontal line and the vertical line is equal to 90°, this obstacle is called a concave angle obstacle, such as Figure 3 As shown in point B; convex angle obstacle: the angle between the horizontal line and the vertical line is equal to 270°, this obstacle is called a convex angle obstacle, such as Figure 3 As shown in point C.

[0132] Step b4. Based on the calculated obstacle category, a path-finding direction calculation algorithm is used to update the directional convolution operator of the previous step position to obtain the directional convolution operator after the previous step position update.

[0133] In this embodiment, in step b4, based on the calculated obstacle category, the path-finding direction calculation algorithm is used to update the directional convolution operator at the previous position. Obtaining the updated directional convolution operator at the previous position includes: if the calculated obstacle category is a straight angle or a concave angle, rotating the directional convolution operator at the previous position clockwise by a preset angle to obtain the updated directional convolution operator at the previous position; if the calculated obstacle category is a convex angle, rotating the directional convolution operator at the previous position counterclockwise by a preset angle to obtain the updated directional convolution operator at the previous position. The preset angle is 90°.

[0134] Specifically, when encountering obstacles during path finding, the directional convolution operator of the current point A needs to be updated in real time. Let the updated directional convolution operator be First determine whether A′ is an obstacle. If not, then If it is an obstacle, calculate the obstacle category according to step b3; if it is a right-angle obstacle, rotate AD 90° clockwise to obtain If it is a concave angle obstacle, then A D Rotate 90° clockwise to get If it is a convex obstacle, then A D Rotate 90° counterclockwise to get Finally, As the directional convolution operator of the current point A, continue path finding.

[0135] Step b5. Use the directional convolution operator after the initial point is updated, and calculate the coordinate information of the next position point according to the point coordinate calculation algorithm after the movement, and move to the next position point.

[0136] In this embodiment, step b5 uses the directional convolution operator after the previous step position update, and calculates the coordinate information of the next step position point according to the point coordinate calculation algorithm after the move, including: performing matrix dot multiplication on the coordinate convolution operator of the previous step position and the directional convolution operator after the previous step position update to obtain the dot product result matrix; extracting the non-zero elements in the dot product result matrix; searching in the coordinate convolution operator of the previous step position with the subscript of the non-zero element in the dot product result matrix as the index to obtain the corresponding element in the coordinate convolution operator of the previous step position; reconstructing the coordinate convolution operator of the next step position point based on the corresponding element to obtain the coordinate information of the next step position point.

[0137] Specifically, in this embodiment, the calculation process of the coordinate scene convolution operator of the next position point A′ is as follows:

[0138] First, calculate the updated directional convolution operator of point A according to step b4 As shown in the following formula. 01 , a 13 , a21 , a 10 There is only one value of 1.

[0139]

[0140] Next, convolve the coordinates of A with the operator A P and Do the matrix dot product, take out the subscript i, j of the only non-zero element in the matrix of the dot product result, and use this subscript as the index to get A P The corresponding element p in the matrix ij =(px ij ,py ij ), (px ij ,py ij ) as the anchor point, and reconstruct the coordinate convolution operator of A′ according to formula (1), that is, the coordinates of the new point A′ after the move are obtained.

[0141]

[0142]

[0143] Among them, A′ P Represents the coordinates of the new point A′ after movement.

[0144] Step b6. Repeat steps b2 to b5 to search for a path until the path is found and the search stops, and the inner frame of the drawing is obtained. Figure 2 shown.

[0145] Step S105: Perform table area detection based on the inner border of the drawing to obtain all table areas in the drawing to be detected.

[0146] In this embodiment, performing table area detection based on the inner border of the drawing to obtain all table areas in the drawing to be detected includes: performing detection based on the inner border of the drawing to obtain a valid inflection point set; performing table area detection based on the valid inflection point set to obtain all table areas in the drawing to be detected.

[0147] The file information table, parts list, spare parts list, etc. in the drawing are called tables, and other cells attached to the border are called noise. Figure 4 Furthermore, the inflection point refers to the convex and concave points where the forward direction changes when encountering obstacles during the path finding process. Figure 4 The black dots in the table are all inflection points. Among them, the inflection points attached to the inner border of the table are called effective inflection points, such as Figure 4 The A / B / C points in , the inflection points above the noise inner border are called invalid inflection points, such as Figure 4 Points D / E / F in the diagram.

[0148] In this embodiment, by finding valid inflection points within the inner border of the drawing, a basis is provided for subsequent determination of the drawing table area. Specifically, based on the inner border of the drawing, detection and obtaining a valid inflection point set include the following steps:

[0149] Step c1. Draw a moving straight line perpendicular to the horizontal axis at the origin of the coordinate axis, and move the straight line along the horizontal axis to the right with a step length of one pixel.

[0150] Step c2. After each movement, calculate the number of intersections between the moving line and the inner border of the drawing, and determine whether the number of intersections is greater than the threshold. If the number of intersections is greater than the threshold, execute step c3, otherwise return to step c1 to continue moving the moving line.

[0151] Step c3. Calculate the intersection points of the first straight line located on the left side of the moving straight line and the inner border of the drawing, and the intersection points of the second straight line located on the right side of the moving straight line and the border of the drawing, respectively, to obtain a first intersection point set and a second intersection point set; the first intersection point set is all the intersection points of the first straight line located on the left side of the moving straight line and the inner border of the drawing, and all the intersection points of the second straight line located on the right side of the moving straight line and the border of the drawing.

[0152] Step c4. Obtain a first judgment value and a second judgment value based on the first intersection point set and the second intersection point set, and perform calculation based on the first judgment value and the second judgment value to obtain a valid inflection point. Among them, the first judgment value and the second judgment value are obtained based on the first intersection set and the second intersection set, and calculation is performed based on the first judgment value and the second judgment value to obtain the effective inflection point, including: obtaining the first minimum vertical coordinate and the first maximum vertical coordinate based on the first intersection set; obtaining the second minimum vertical coordinate and the second maximum vertical coordinate based on the second intersection set; calculating according to the first minimum vertical coordinate and the second minimum vertical coordinate to obtain the first judgment value; calculating according to the first maximum vertical coordinate and the second maximum vertical coordinate to obtain the second judgment value; judging whether the first judgment value or the second judgment value is greater than or equal to the judgment threshold; if the first judgment value is greater than or equal to the judgment threshold, respectively calculating the intersection of the first vertical line and the second vertical line with the moving straight line; the intersection of the first vertical line and the moving straight line and the intersection of the second vertical line with the moving straight line are effective inflection points; and / or, if the second judgment value is greater than or equal to the judgment threshold, respectively calculating the intersection of the third vertical line and the fourth vertical line with the moving straight line; the intersection of the third vertical line and the moving straight line and the intersection of the fourth vertical line with the moving straight line are effective inflection points.

[0153] Step c5. Repeat steps c2 to c4 until the moving straight line reaches the rightmost border of the inner border of the drawing.

[0154] Furthermore, before executing step c1, an effective inflection point array may be set, denoted as M, and the effective inflection point array M is used to store all effective inflection points obtained by the above method. In addition, the inflection points on the inner borders on the left and right sides of the position drawing are defaulted as effective inflection points and added to the array M. Among them, the effective inflection points and the invalid inflection points are as follows: Figure 5 shown.

[0155] Specifically, such as Figure 6 As shown:

[0156] Step 1: Set the valid inflection point array M.

[0157] Step 2: At the origin of the coordinate axis (assuming the upper left corner of the inner border of the drawing is the origin of the coordinate axis), draw a moving straight line L (x = 0) and move it to the right along the horizontal axis, moving one pixel to the right each time.

[0158] Step 3: After each move, calculate the number of intersections between the moving line L (x=l in this case, the specific value of l is the distance moved) and the inner border of the drawing. If the number of intersections is greater than or equal to the threshold (i.e. NUM ε (Generally, NUM ε =16)), then execute step 4; if the number of intersections is less than a certain threshold NUM ε , then jump to the second step and continue moving until it moves to the rightmost frame of the drawing;

[0159] Step 4: Calculate the intersection of the first straight line L1: x = lk (generally, the distance between the first straight line and the moving straight line (i.e., k) is at least 2 pixels. Of course, in some other embodiments, it can also be 3 pixels, 4 pixels, or more. In order to ensure the detection accuracy and reliability, k is preferably 2, that is, the distance between the first straight line and the moving straight line is preferably 2 pixels.) and the inner frame. Let the intersection set be LEFT = {(l-2, y i )|i=1, 2, ..., n}; calculate the intersection of the second straight line L2: x=l+2 (similarly, the distance between the second straight line and the moving straight line (i.e., k) is at least 2 pixels. Of course, in some other embodiments, it can also be 3 pixels, 4 pixels, or more. In order to ensure the detection accuracy and reliability, k is preferably 2, that is, the distance between the second straight line and the moving straight line is preferably 2 pixels.) and the inner frame, and the intersection set is RIGHT={(l+2,y j )|j=1, 2, ..., m}.

[0160] Step 5: Set the effective inflection point judgment threshold to NUM φ , record a=min y i (first minimum ordinate), b = min y j(second smallest ordinate), c = max y i (first maximum ordinate), d = max y j (Second maximum vertical coordinate), calculate the first judgment value and the second judgment value, wherein the first judgment value is Δ1, and its calculation formula is: Δ1=|ab|, and the first judgment value is Δ2, and its calculation formula is: Δ2=|cd|, if Δ1≥NUM φ , then calculate the intersection of the straight line y=a, the straight line y=b and the straight line L:x=l respectively. This intersection (i.e. Figure 6 Points A and B in the equation are valid inflection points, and the valid inflection points are added to the valid inflection point array M; if Δ2≥NUM φ , then calculate the intersection of the straight line y=c, the straight line y=d and the straight line L:x=l respectively, and the intersection is the valid inflection point, and add the valid inflection point to the valid inflection point array M. For example, Figure 6 As shown, in this example, k = 2, at this time, LEFT = {C1, C2}, RIGHT = {D1, D2}, a = C1, b = D1, c = C2, d = D2, Δ1 = |C1-D1|, Δ2 = |C2-D2|.

[0161] Step 6: Continue to move the straight line L, repeat steps 2 to 3, until it moves to the rightmost frame of the drawing and stops, and then you can get the valid inflection point array M. Among them, all the valid inflection points in the drawing are as follows Figure 7 shown.

[0162] In this embodiment, performing table area detection based on the valid inflection point set to obtain all table areas in the drawing to be detected includes: constructing an ordered set based on the valid inflection point set; performing table area detection based on the ordered set to obtain all table areas in the drawing to be detected.

[0163] Specifically, constructing an ordered set based on the valid inflection point set includes: searching based on the valid inflection point set to obtain valid inflection points with a vertical coordinate of 0; arranging the valid inflection points with a vertical coordinate of 0 in descending order according to the horizontal coordinate, and indexing them to form an ordered set.

[0164] In this embodiment, table area detection is performed based on an ordered set to obtain all table areas in the drawing to be detected, including: according to the ordered set, the diagonal vertex method is used to determine the first and last table areas of the upper boundary of the inner border of the drawing and the first and last table areas of the lower boundary of the inner border of the drawing; after completing the detection of the first and last table areas of the upper boundary and the first and last table areas of the lower boundary, the remaining valid inflection points in the ordered set are grouped according to the index parity principle; after completing the grouping, the diagonal vertex method is used to determine the middle table area of ​​the upper boundary of the inner border of the drawing and the middle table area of ​​the lower boundary of the inner border of the drawing.

[0165] Specifically, when locating the table area, since drawing tables are all rectangular and are distributed on the upper and / or lower boundaries of the drawing, it is only necessary to determine a pair of diagonal vertices of the rectangle to achieve the positioning of the table area. Therefore, after obtaining the valid inflection point set M, the table area is located using the following method:

[0166] Step 1: Find all valid inflection points on the upper boundary of the inner border of the drawing (i.e., find the valid inflection points with ordinate 0), sort the valid inflection points with ordinate 0 in descending order according to the abscissa, and index them, starting from 0, to form an ordered set MX = {(x i ,0)|x i <x i+1 , i=0,1,2,...,n)}. Among them, the ordered set MX is as follows Figure 8 shown.

[0167] Step 2: Determine the first and last table areas of the upper boundary line. Let the valid inflection point with index 0 be A(x0,y0), and find the point with x=x0 in the set MX to form the set MX0. Take the point with the largest ordinate in MX0 and set it as B(x0,y1). Find the point with the ordinate y1 in the set M to form the set MY0, and take the point C with the smallest abscissa in MY0. The first table area on the upper boundary can be determined by the diagonal vertices A and C (such as Figure 8 The same method can be used to determine the last table area on the upper border (such as Figure 8 table in the upper right corner).

[0168] Step 3: Determine the table area in the middle of the upper boundary line. For the remaining points in the set MX (excluding the points with indexes 0 and n), group them according to the index "odd-even" principle:

[0169] <(x1,0), (x2,0)>, <(x3,0), (x4,0)>,..., <(x i ,0),(x i+1 ,0)>,...,<(x n-2 ,0),(x n-1 ,0)>

[0170] From point E(x i ,0) and point F(x i+1 ,0) must belong to the i-th table on the upper boundary line. According to the method of determining the diagonal coordinates of the point in the second step, the point E(x i+1 ,0), the diagonal point coordinate K, E and K can be used to determine the i-th table on the upper boundary line. Figure 9 shown.

[0171] Step 4: Using the same method as in steps 2 and 3, all table areas on the lower boundary can be determined, thereby obtaining all table areas in the drawing to be inspected.

[0172] Step S106: extract all the table areas in the drawing to be inspected to obtain all the tables in the drawing to be inspected. Specifically, after all the table areas are located, they are cropped according to the coordinates of all the table areas to obtain all the tables in the drawing to be inspected.

[0173] Figure 10 The present invention provides a drawing table area detection device. Figure 10 As shown, the drawing table area detection device includes:

[0174] The acquisition unit 11 is used to acquire the original image of the drawing to be inspected.

[0175] The pre-processing unit 12 is used to pre-process the original image of the drawing to be inspected to obtain a binary image of the drawing to be inspected.

[0176] The selection unit 13 is used to select an initial point in the binary image of the drawing to be detected.

[0177] The frame detection unit 14 is used to perform inner frame detection on the binary image of the drawing to be detected by adopting a point-by-point path finding method based on the initial point to obtain the inner frame of the drawing.

[0178] The table area detection unit 15 is used to detect the table area based on the inner border of the drawing to obtain all the table areas in the drawing to be detected.

[0179] The table extraction unit 16 is used to extract tables from all table areas in the drawing to be inspected, and obtain all tables in the drawing to be inspected.

[0180] Specifically, the specific coordination operation process between the various units in the drawing and table area detection device here can refer to the above-mentioned drawing and table area detection method, and will not be repeated here.

[0181] The method and device for detecting areas in drawings and tables provided by this invention, by performing pixel-level image processing, avoids the extensive data labeling required by deep learning methods. This eliminates the need for resource-intensive model training, while also meeting the performance requirements for engineering applications. Furthermore, each step of the algorithm is interpretable. Testing using this method on 50 nuclear power plant drawings revealed an average detection time of 0.7 seconds and 100% accuracy, meeting engineering application standards.

[0182] In addition, an electronic device of the present invention includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program to implement a drawing table area detection method such as any one of the above. Specifically, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed by an electronic device and, when executed, performs the above-mentioned functions defined in the method of the embodiment of the present invention. The electronic device in the present invention can be a terminal such as a notebook, desktop, tablet computer, smart phone, or a server.

[0183] In addition, the present invention provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-mentioned drawing table area detection methods. Specifically, it should be noted that the storage medium of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present invention, a computer-readable signal medium can include a data signal transmitted in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0184] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0185] The various embodiments described in this specification are presented by way of example, and each embodiment describes a specific feature or combination of features that can be included in one or more embodiments of the present application. Each embodiment is intended to be limiting only to the extent recited in the specific embodiment description. In the description of the embodiments, any reference to a method comprising two or more steps, is intended to mean that the method can comprise the disclosed steps in any order, unless otherwise explicitly provided. Any reference to a method comprising two or more steps, is intended to mean that the method can comprise the disclosed steps in any order, unless otherwise explicitly provided.

[0186] Those skilled in the art will further appreciate that the units and algorithms described in connection with the examples disclosed herein can be embodied directly in hardware, in software, or in a combination of the two. For ease of understanding, descriptions of the examples have been generally presented in the context of software instructions being executed by a processor. Those skilled in the art will recognize that the described examples can be embodied directly in hardware, in software, or in a combination of the two. Any resulting implementation, whether software or hardware, will encompass all such variations other implementations are also within the scope of the claims.

[0187] The steps of a method or algorithm described in connection with the examples disclosed herein can be embodied directly in hardware, in software, or in a combination of the two. Software implementations can be stored in any computer-readable medium, which can be any memory or storage device such as RAM, ROM, EEPROM, flash memory or the like, and can be accessed by a processor of a general purpose computer or special purpose computer. Any of the described examples can be implemented in the form of control logic using hardware or a combination of hardware and software.

[0188] The embodiments described above are only for illustrating the technical concepts and features of the present application, and the purpose is to enable those skilled in the art to understand the content of the present application and to implement it accordingly, and cannot limit the protection scope of the present application. Any equivalent changes and modifications made within the scope of the claims of the present application shall be within the scope of the claims of the present application.

Claims

1. A drawing table area detection method, characterized in that: The following steps are involved: Obtain the original image of the drawing to be inspected; Preprocessing the original image of the drawing to be detected to obtain a binary image of the drawing to be detected; Selecting an initial point in the binary image of the drawing to be detected; Based on the initial point, an inner frame detection is performed on the binary image of the drawing to be detected by adopting a point-by-point path finding method to obtain the inner frame of the drawing; The step of performing inner frame detection on the binary image of the drawing to be detected by adopting a point-by-point path finding method based on the initial point to obtain the inner frame of the drawing includes: Step b1. Taking the initial point as the starting point, set the moving step size; Step b2. After completing the setting of the moving step length, use the obstacle judgment algorithm to determine whether there will be an obstacle at the next position. If there is no obstacle, move at the moving step length; if there is an obstacle, execute step b3; Step b3. Obstacle category determination algorithm is used to calculate the category to obtain the obstacle category; the obstacle category includes: flat angle obstacle, concave angle obstacle or convex angle obstacle; Step b4. Based on the calculated obstacle category, use the path finding direction calculation algorithm to update the directional convolution operator of the initial point to obtain the directional convolution operator after the position update in the previous step; Step b5. Using the directional convolution operator after the previous position update, and calculating the coordinate information of the next position point according to the point coordinate calculation algorithm after the move, and moving to the next position point; Step b6. Repeat steps b2 to b5 to search for a path, stopping the search when the path meets a previously searched path, and obtaining the inner frame of the drawing; Performing table area detection based on the inner border of the drawing to obtain all table areas in the drawing to be detected; Table extraction is performed on all table areas in the drawing to be detected to obtain all tables in the drawing to be detected.

2. The drawing table area detection method according to claim 1, characterized in that: The preprocessing of the original image of the drawing to be detected to obtain a binary image of the drawing to be detected includes: Performing gamma transformation on the original image of the drawing to be inspected to obtain an enhanced image; Performing grayscale processing on the enhanced image to obtain a grayscale image of the drawing to be inspected; The grayscale image of the drawing to be detected is binarized, and the binarized image is inverted to obtain a binarized image of the drawing to be detected.

3. The drawing table area detection method according to claim 1, characterized in that: The selecting of the initial point in the binary image of the drawing to be detected comprises: Step a1. Randomly select a point in the binary image of the drawing to be detected as an anchor point; Step a2. Obtain the scene convolution operator of the anchor point; Step a3. Detect whether all element values ​​in the scene convolution operator of the anchor point are preset values; Step a4. If yes, select the anchor point as the initial point; Step a5. If not, move one pixel to the left and repeat steps a1 to a4 to reselect the initial point.

4. The drawing table area detection method according to claim 1, characterized in that: In step b2, the obstacle judgment algorithm is used to judge whether an obstacle will be encountered in the next step, including: Perform matrix dot multiplication on the directional convolution operator of the initial point and the scene convolution operator to obtain a result matrix; Determine whether the result matrix is ​​a 0 matrix; If the result matrix is ​​a 0 matrix, it is determined that there is an obstacle at the next step; If the result matrix is ​​not a 0 matrix, it is determined that there is no obstacle in the next step.

5. The drawing table area detection method according to claim 4, characterized in that: Calculating the obstacle category using the obstacle category determination algorithm in step b3 includes: If the result matrix is ​​a 0 matrix, obtain the number of 0 elements in the 0 matrix; If the number of 0 elements in the 0 matrix is ​​the first value, it is a flat angle obstacle; If the number of 0 elements in the 0 matrix is ​​the second value, it is a concave corner obstacle; If the number of 0 elements in the 0 matrix is ​​a third value, it is a convex corner obstacle.

6. The drawing table area detection method according to claim 1, characterized in that: In step b4, based on the calculated obstacle category, a path finding direction calculation algorithm is used to update the directional convolution operator of the previous position, and obtaining the updated directional convolution operator of the previous position includes: If the calculated obstacle type is a straight angle or a concave angle, the directional convolution operator of the previous position is rotated clockwise by a preset angle to obtain the updated directional convolution operator of the previous position; If the calculated obstacle type is a convex corner, the directional convolution operator of the previous position is rotated counterclockwise by a preset angle to obtain the updated directional convolution operator of the previous position.

7. The drawing table area detection method according to claim 1, characterized in that: In step b5, the directional convolution operator after the position update in the previous step is used, and the coordinate information of the next position point is calculated according to the point coordinate calculation algorithm after the movement, including: Perform matrix dot multiplication on the coordinate convolution operator of the previous step position and the directional convolution operator after the previous step position update to obtain a dot product result matrix; Extracting non-zero elements in the dot product result matrix; Using the subscript of the non-zero element in the dot product result matrix as the index, search in the coordinate convolution operator at the previous step to obtain the corresponding element in the coordinate convolution operator at the previous step; The coordinate convolution operator of the next step position point is reconstructed based on the corresponding elements to obtain the coordinate information of the next step position point.

8. The drawing table area detection method according to claim 1, characterized in that: Detecting the table area based on the inner border of the drawing to obtain all the table areas in the drawing to be detected includes: Detecting the inner border of the drawing to obtain a valid inflection point set; Table area detection is performed based on the valid inflection point set to obtain all table areas in the drawing to be detected.

9. The drawing table area detection method according to claim 8, characterized in that: The detecting based on the inner border of the drawing to obtain a valid inflection point set includes: Step c1. Draw a moving line perpendicular to the horizontal axis at the origin of the coordinate axis, and move it rightward along the horizontal axis in steps of one pixel. Step c2. After each movement, calculate the number of intersections between the moving line and the inner border of the drawing, and determine whether the number of intersections is greater than a threshold. If the number of intersections is greater than the threshold, execute step c3; otherwise, return to step c1 and continue moving the moving line. Step c3. Calculate the intersection points of a first line located to the left of the moving line and the inner border of the drawing, and the intersection points of a second line located to the right of the moving line and the inner border of the drawing, respectively, to obtain a first intersection point set and a second intersection point set; the first intersection point set is composed of all the intersection points of the first line located to the left of the moving line and the inner border of the drawing, and the second intersection points located to the right of the moving line and the inner border of the drawing; Step c4. Obtaining a first judgment value and a second judgment value based on the first intersection point set and the second intersection point set, and performing calculation based on the first judgment value and the second judgment value to obtain a valid inflection point; Step c5. Repeat steps c2 to c4 until the moving straight line moves to the rightmost frame of the inner frame of the drawing and stops.

10. The drawing table area detection method according to claim 9, characterized in that: The obtaining of a first judgment value and a second judgment value based on the first intersection point set and the second intersection point set, and performing calculation based on the first judgment value and the second judgment value to obtain a valid inflection point includes: Obtaining a first minimum ordinate and a first maximum ordinate based on the first intersection point set; Obtaining a second minimum ordinate and a second maximum ordinate based on the second intersection point set; Perform calculation based on the first minimum vertical coordinate and the second minimum vertical coordinate to obtain the first judgment value; Calculating according to the first maximum vertical coordinate and the second maximum vertical coordinate to obtain the second judgment value; Determining whether the first judgment value or the second judgment value is greater than or equal to a judgment threshold; If the first judgment value is greater than or equal to the judgment threshold, then respectively calculating the intersection points of the first vertical line and the second vertical line with the moving straight line; the intersection point of the first vertical line with the moving straight line and the intersection point of the second vertical line with the moving straight line are valid inflection points; And / or, if the second judgment value is greater than or equal to the judgment threshold, the intersection points of the third vertical line and the fourth vertical line with the moving straight line are calculated respectively; the intersection point of the third vertical line with the moving straight line and the intersection point of the fourth vertical line with the moving straight line are valid inflection points.

11. The drawing table area detection method according to claim 8, characterized in that: The performing table area detection based on the valid inflection point set to obtain all table areas in the drawing to be detected includes: Constructing an ordered set based on the valid inflection point set; Table area detection is performed based on the ordered set to obtain all table areas in the drawing to be detected.

12. The drawing table area detection method according to claim 11, characterized in that: The constructing an ordered set based on the valid inflection point set comprises: Searching based on the valid inflection point set to obtain a valid inflection point with a vertical coordinate of 0; The valid inflection points with a vertical coordinate of 0 are arranged in descending order according to the horizontal coordinates and indexed to form the ordered set.

13. The drawing table area detection method according to claim 11, characterized in that: The performing table area detection based on the ordered set to obtain all table areas in the drawing to be detected includes: According to the ordered set, the diagonal vertex method is used to determine the first and last table areas of the upper boundary of the inner border of the drawing and the first and last table areas of the lower boundary of the inner border of the drawing; After completing the detection of the first and last table areas of the upper boundary and the first and last table areas of the lower boundary, grouping the remaining valid inflection points in the ordered set according to the index parity principle; After the teaming is completed, the diagonal vertex method is used to determine the middle table area of ​​the upper boundary of the inner border of the drawing and the middle table area of ​​the lower boundary of the inner border of the drawing.

14. A drawing table area detection device, characterized in that: include: An acquisition unit, used for acquiring an original image of a drawing to be inspected; A preprocessing unit, configured to preprocess the original image of the drawing to be detected to obtain a binary image of the drawing to be detected; A selection unit, configured to select an initial point in the binary image of the drawing to be inspected; a frame detection unit, configured to perform inner frame detection on the binary image of the drawing to be detected by adopting a point-by-point path finding method based on the initial point to obtain the inner frame of the drawing; The step of performing inner frame detection on the binary image of the drawing to be detected by adopting a point-by-point path finding method based on the initial point to obtain the inner frame of the drawing includes: Step b1. Taking the initial point as the starting point, set the moving step size; Step b2. After completing the setting of the moving step length, use the obstacle judgment algorithm to determine whether there will be an obstacle at the next position. If there is no obstacle, move at the moving step length; if there is an obstacle, execute step b3; Step b3. Obstacle category determination algorithm is used to calculate the category to obtain the obstacle category; the obstacle category includes: flat angle obstacle, concave angle obstacle or convex angle obstacle; Step b4. Based on the calculated obstacle category, use the path finding direction calculation algorithm to update the directional convolution operator of the initial point to obtain the directional convolution operator after the position update in the previous step; Step b5. Using the directional convolution operator after the previous position update, and calculating the coordinate information of the next position point according to the point coordinate calculation algorithm after the move, and moving to the next position point; Step b6. Repeat steps b2 to b5 to search for a path, stopping the search when the path meets a previously searched path, and obtaining the inner frame of the drawing; A table area detection unit, configured to detect table areas based on the inner border of the drawing, and obtain all table areas in the drawing to be detected; The table extraction unit is used to extract tables from all table areas in the drawing to be detected to obtain all tables in the drawing to be detected.

15. A storage medium, characterized in that: The storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the steps of the drawing table area detection method according to any one of claims 1 to 13.

16. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the steps of the drawing table area detection method according to any one of claims 1 to 13 by calling the computer program stored in the memory.

Citation Information

Patent Citations

  • Table recognition overprinting method, computer equipment and computer readable storage medium

    CN112183038A

  • Straight line detection method and device, equipment and storage medium

    CN116309660A