Straight line segment identification and fitting method and system for random orthogonal structure point cloud

By projecting the point cloud onto the grid and converting it into a binary image, combining the adjacent trip voting method of the stroke encoding matrix, the straight line segments in the point cloud are identified and fitted, and the problems of poor identification of tilted orthogonal line segments and insufficient noise robustness in the prior art are solved, and efficient and stable recognition and fitting effects are achieved.

CN117218370BActive Publication Date: 2025-05-09SHANGHAI JIAOTONG UNIV
View PDF 5 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The prior art is difficult to identify and fit straight line segments of orthogonal line segments with a certain inclination angle in point cloud data and are not robust enough to noise.

Method used

By projecting the point cloud onto a grid composed of rectangular units, it is converted into a binary image, and the adjacent stroke voting method of the stroke encoding matrix is ​​used to identify and fit straight line segments.

Benefits of technology

Effective identification and fit of straight line segments in random orthogonal structure point clouds is achieved, which reduces the calculation amount and improves the stability and robustness of the recognition results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117218370B_ABST
    Figure CN117218370B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for recognizing and fitting straight line segments of random orthogonal structure point clouds, including: using grid projection to classify and index point cloud data, and then converting the point cloud into a binary image; using run length encoding to achieve efficient operation of binary images, detection of the characteristic direction of orthogonal structures, completing the recognition of all straight line segments and giving corresponding point cloud groups; and finally fitting all straight line segments according to the grouping results. The present invention has excellent stability and robustness, and the recognition results are consistent with the observation results of the human eye. It can save a lot of debugging time and cost in the research and development of visual systems that need to recognize orthogonal structures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a method and system for recognizing and fitting straight line segments of a random orthogonal structure point cloud. Background Art

[0002] The vast majority of visual algorithms are for images, and there is very little research on algorithms applicable to point cloud data.

[0003] Therefore, in the prior art, the invention patent with publication number CN108776776B discloses a method for identifying horizontal and vertical line segments in an image. This algorithm is only used for horizontal and vertical line segments and cannot be used for identifying orthogonal line segments with a certain inclination angle.

[0004] The invention patent with publication number CN102819743B discloses a method for quickly identifying straight line segments in digital images. This method is suitable for detecting straight line segments in binary images, but cannot process point cloud data. The method disclosed in this application converts binary images into run-length encoding format, compresses the image data volume, and has advantages in computing efficiency.

[0005] The invention patent with application number CN113793354B discloses an adaptive line detection method based on Hough transform, which can be used to identify straight line segments in images and cannot process point cloud data. However, the method disclosed in this application is more robust than Hough transform and can achieve better results in the presence of noise. Summary of the invention

[0006] In view of the defects in the prior art, the present invention provides a straight line segment recognition and fitting method and system for a random orthogonal structure point cloud.

[0007] According to a method and system for recognizing and fitting straight line segments of a random orthogonal structure point cloud provided by the present invention, the scheme is as follows:

[0008] In a first aspect, a method for identifying and fitting straight line segments of a random orthogonal structure point cloud is provided, the method comprising:

[0009] Step S1: Set the resolution, and construct a grid composed of rectangular units that can completely cover the random orthogonal structure point cloud according to the resolution, project the random orthogonal structure point cloud to the grid, and the point located in the rectangular unit becomes the corresponding point A of the rectangular unit. Record all the rectangular units and the corresponding point A to obtain the projection result A;

[0010] Step S2: converting the projection result A into a binary image A with the same size as the grid;

[0011] Step S3: performing connected domain segmentation on the binary image A, and obtaining connected domain grouping records to form connected domain grouping results;

[0012] Step S4: traverse the connected domain grouping results, perform run encoding on the connected domain, and obtain the corresponding feature direction through adjacent run voting statistics;

[0013] Step S5: traverse the connected domain grouping results, rotate the corresponding points A of the connected domain group by group according to the characteristic direction, align the characteristic direction with the coordinate axis as the corresponding point B, and then project the corresponding point B to the grid respectively to obtain the projection result B;

[0014] Step S6: traverse the projection result B, convert it into a binary image B, then perform run encoding, set a length threshold to filter the run, and generate a point cloud grouping result;

[0015] Step S7: traverse the point cloud grouping results, perform least squares fitting of straight line segments on the groups, and restore them to the corresponding positions of the random orthogonal structure point cloud according to the characteristic direction of each connected domain to generate straight line segment recognition and fitting results.

[0016] Preferably, step S3 includes: performing connected domain segmentation on the binary image A, and traversing all connected domains with an area greater than a threshold, counting corresponding points of rectangular units constituting the connected domains, which are called connected domain grouping records, and all connected domain grouping records with an area greater than the threshold constitute the connected domain grouping result.

[0017] Preferably, step S4 comprises:

[0018] Step S4.1: Select a connected domain group record, decompose the connected domain column by column into a column run A composed of continuous pixels, and record the starting row number and the ending row number of all column runs A;

[0019] Step S4.2: traverse all column runs A, check the adjacent column runs A adjacent to the current column run A, calculate the difference between the starting row number and the ending row number of the current column run A and the adjacent column run A, the calculation result is the number of column steps, and record all non-zero column step numbers;

[0020] Step S4.3: Count the frequency of each non-zero column step number × the absolute value of the step number, take the largest calculated result as the column trip voting result, and calculate the inverse cotangent function value of its column step number, which is the angle between the characteristic direction and the vertical coordinate axis;

[0021] Step S4.4: Keep the current connected domain grouping record, decompose the connected domain row by row into row runs A composed of continuous pixels, and record the starting column number and the ending column number of all row runs A;

[0022] Step S4.5: traverse all row runs A, check the adjacent row runs A adjacent to the current row run, calculate the difference between the starting column number and the ending column number of the current row run and the adjacent row run A, the calculation result is the number of row steps, and record all non-zero row step numbers;

[0023] Step S4.6: Count the frequency of each non-zero row step number × the absolute value of the step number, take the largest calculated result as the row voting result, and calculate the inverse cotangent function value of its row step number, which is the angle between the characteristic direction and the horizontal coordinate axis;

[0024] Step S4.7: Compare the column-run voting result with the row-run voting result, and retain the result with a larger absolute value of frequency × number of steps as the characteristic direction of the connected domain;

[0025] Step S4.8: Select the next connected domain grouping record and repeat step S4.1 until all connected domain grouping results are traversed.

[0026] Preferably, step S6 includes: traversing the projection result B, converting each group of corresponding points B into a binary image B, performing run encoding on the binary image B, recording the run that is greater than or equal to a user-set length threshold, grouping the point cloud according to the rectangular units corresponding to the run, and generating a point cloud grouping result corresponding to the straight line segments in the point cloud image.

[0027] Preferably, step S6 comprises:

[0028] Step S6.1: Select a set of projection results B of corresponding points B and convert them into a binary image B in the same way as step S2;

[0029] Step S6.2: decompose the binary image B column by column into column runs B composed of continuous pixels, and record all column runs B whose lengths are greater than or equal to the length threshold;

[0030] Step S6.3: traverse all column runs B, and record the corresponding points of each column run B as a point cloud group;

[0031] Step S6.4: decompose the binary image B column by column into row runs B consisting of continuous pixels, and record all row runs B whose length is greater than or equal to the length threshold;

[0032] Step S6.5: traverse all the rows B, and record the corresponding points of each row B as a point cloud group;

[0033] Step S6.6: Select the next set of corresponding points B and repeat step S6.1 until all corresponding points B are traversed and all point cloud grouping records constitute the point cloud grouping result.

[0034] In a second aspect, a straight line segment recognition and fitting system for a random orthogonal structure point cloud is provided, the system comprising:

[0035] Module M1: Set the resolution, and construct a grid composed of rectangular units that can completely cover the random orthogonal structure point cloud according to the resolution, project the random orthogonal structure point cloud to the grid, and the point located in the rectangular unit becomes the corresponding point A of the rectangular unit. Record all the rectangular units and the corresponding point A to obtain the projection result A;

[0036] Module M2: converting the projection result A into a binary image A with the same size as the grid;

[0037] Module M3: performing connected domain segmentation on the binary image A, and obtaining connected domain grouping records to form connected domain grouping results;

[0038] Module M4: traverse the connected domain grouping results, perform run encoding on the connected domain, and obtain the corresponding feature direction through adjacent run voting statistics;

[0039] Module M5: traverse the connected domain grouping results, rotate the corresponding points A of the connected domain group by group according to the characteristic direction, align the characteristic direction with the coordinate axis as the corresponding point B, and then project the corresponding point B to the grid respectively to obtain the projection result B;

[0040] Module M6: traverse the projection result B, convert it into a binary image B, then perform run encoding, set a length threshold to filter the run, and generate a point cloud grouping result;

[0041] Module M7: Traverse the point cloud grouping results, perform least squares fitting of straight line segments in groups, and restore them to the corresponding positions of the random orthogonal structure point cloud according to the characteristic direction of each connected domain to generate straight line segment recognition and fitting results.

[0042] Preferably, the module M3 comprises: performing connected domain segmentation on the binary image A, and traversing all connected domains whose areas are larger than a threshold, counting corresponding points of rectangular units constituting the connected domains, which are called connected domain grouping records, and all connected domain grouping records whose areas are larger than the threshold constitute connected domain grouping results;

[0043] The module M4 comprises:

[0044] Module M4.1: Select a connected domain group record, decompose the connected domain column by column into a column run A composed of continuous pixels, and record the starting row number and the ending row number of all column runs A;

[0045] Module M4.2: traverse all column runs A, check the adjacent column runs A adjacent to the current column run A, calculate the difference between the starting row number and the ending row number of the current column run A and the adjacent column run A, calculate the result as the number of column steps, and record all non-zero column step numbers;

[0046] Module M4.3: Count the frequency of each non-zero column step number × the absolute value of the step number, take the largest calculated result as the column trip voting result, and calculate the inverse cotangent function value of its column step number, which is the angle between the characteristic direction and the vertical coordinate axis;

[0047] Module M4.4: Keep the current connected domain grouping record, decompose the connected domain row by row into row runs A composed of continuous pixels, and record the starting column number and the ending column number of all row runs A;

[0048] Module M4.5: traverse all row runs A, check the adjacent row runs A adjacent to the current row run, calculate the difference between the starting column number and the ending column number of the current row run and the adjacent row run A, the calculation result is the number of row steps, and record all non-zero row step numbers;

[0049] Module M4.6: Count the frequency of each non-zero row step number × the absolute value of the step number, take the largest calculated result as the row trip voting result, and calculate the inverse cotangent function value of its row step number, which is the angle between the characteristic direction and the horizontal coordinate axis;

[0050] Module M4.7: Compare the column-stroke voting results with the row-stroke voting results, and retain the result with a larger absolute value of frequency × number of steps as the characteristic direction of the connected domain;

[0051] Module M4.8: Select the next connected domain grouping record and repeatedly trigger module M4.1 until all connected domain grouping results are traversed.

[0052] Preferably, the module M6 comprises: traversing the projection result B, converting each group of corresponding points B into a binary image B, performing run encoding on the binary image B, recording the run that is greater than or equal to the length threshold set by the user, grouping the point cloud according to the rectangular units corresponding to the run, and generating a point cloud grouping result corresponding to the straight line segment in the point cloud image;

[0053] The module M6 comprises:

[0054] Module M6.1: Select a set of projection results B of corresponding points B and convert them into binary image B in the same way as module M2;

[0055] Module M6.2: Decompose the binary image B column by column into column runs B consisting of continuous pixels, and record all column runs B whose length is greater than or equal to the length threshold;

[0056] Module M6.3: Traverse all column runs B, and record the corresponding points of each column run B as a point cloud group;

[0057] Module M6.4: Decompose the binary image B column by column into row runs B consisting of continuous pixels, and record all row runs B whose length is greater than or equal to the length threshold;

[0058] Module M6.5: Traverse all the rows B, and record the corresponding points of each row B as a point cloud group;

[0059] Module M6.6: Select the next set of corresponding points B and repeatedly trigger module M6.1 until all corresponding points B are traversed and all point cloud grouping records constitute the point cloud grouping result.

[0060] In a third aspect, a computer-readable storage medium storing a computer program is provided, and when the computer program is executed by a processor, the steps in the method for identifying and fitting straight line segments of a random orthogonal structure point cloud are implemented.

[0061] In a fourth aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps in the method for identifying and fitting straight line segments of a random orthogonal structure point cloud.

[0062] Compared with the prior art, the present invention has the following beneficial effects:

[0063] 1. By projecting the point cloud onto a grid composed of matrix units, the problem that point cloud data cannot be used for graphics operations is solved, and the effect of using binary images instead of point cloud data to participate in the operation is achieved, which significantly reduces the amount of calculation;

[0064] 2. By adopting the method of adjacent stroke voting of the stroke coding matrix, the problem that the straight line segment detection algorithm is susceptible to noise interference and the results are unstable is solved, and the recognition results of random orthogonal structures are consistent with the results observed by the human eye.

[0065] Other beneficial effects of the present invention will be explained in the specific implementation manner through the introduction of specific technical features and technical solutions. Through the introduction of these technical features and technical solutions, those skilled in the art should be able to understand the beneficial technical effects brought about by the technical features and technical solutions. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0067] Figure 1 It is the overall flow chart of the present invention;

[0068] Figure 2 This is a schematic diagram of the process of step S1 of the present invention;

[0069] Figure 3 This is a schematic diagram of the process of step S2 of the present invention;

[0070] Figure 4 This is a schematic diagram of the process of step S3 of the present invention;

[0071] Figure 5 This is a schematic diagram of the process of step S4 of the present invention;

[0072] Figure 6 This is a schematic diagram of the process of step S5 of the present invention;

[0073] Figure 7 This is a schematic diagram of the process of step S6 of the present invention;

[0074] Figure 8 This is a flow chart of step S7 of the present invention. DETAILED DESCRIPTION

[0075] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0076] The embodiment of the present invention provides a method for identifying and fitting straight line segments of a random orthogonal structure point cloud, which uses grid projection to classify and index point cloud data, and then converts the point cloud into a binary image; uses run length encoding to achieve efficient binary image calculations, detect the direction of orthogonal structure features, complete the identification of all straight line segments and give corresponding point cloud groups; and finally achieves fitting of all straight line segments based on the grouping results. Figure 1 As shown, the present invention specifically includes the following contents:

[0077] Step S1: Figure 2 As shown, according to the resolution set by the user, a grid composed of rectangular units that can completely cover the random orthogonal structure point cloud is constructed, and the random orthogonal structure point cloud is projected onto the grid. The points located in the rectangular unit become the corresponding points A of the rectangular unit. All rectangular units and corresponding points A are recorded, which is called the projection result A.

[0078] Step S2: Figure 3 As shown, the rectangular units with corresponding points higher than the threshold are regarded as black pixels, and the rectangular units with corresponding points lower than the threshold are regarded as white pixels, and the projection result A is converted into a binary image A with the same grid size.

[0079] Step S3: Figure 4 As shown, the connected domain segmentation is performed on the binary image A, and all connected domains with an area greater than a threshold are traversed, and the corresponding points of the rectangular units that make up the connected domains are counted, which are called connected domain grouping records. All connected domain grouping records with an area greater than the threshold constitute the connected domain grouping result.

[0080] Step S4: Figure 5As shown, the connected domain grouping results are traversed, the connected domain is run-length encoded, and the corresponding feature direction is obtained through adjacent run voting statistics.

[0081] The step S4 specifically includes the following steps:

[0082] Step S4.1: Select a connected domain group record, decompose the connected domain column by column into a column run A composed of continuous pixels, and record the starting row number and the ending row number of all column runs A;

[0083] Step S4.2: traverse all column runs A, check the adjacent column runs A adjacent to the current column run A, calculate the difference between the starting row number and the ending row number of the current column run A and the adjacent column run A, the calculation result is the number of column steps, and record all non-zero column step numbers;

[0084] Step S4.3: Count the frequency of each non-zero column step number × the absolute value of the step number, take the largest calculated result as the column trip voting result, and calculate the inverse cotangent function value of its column step number, which is the angle between the characteristic direction and the vertical coordinate axis;

[0085] Step S4.4: Keep the current connected domain grouping record, decompose the connected domain row by row into row runs A composed of continuous pixels, and record the starting column number and the ending column number of all row runs A;

[0086] Step S4.5: traverse all row runs A, check the adjacent row runs A adjacent to the current row run, calculate the difference between the starting column number and the ending column number of the current row run and the adjacent row run A, the calculation result is the number of row steps, and record all non-zero row step numbers;

[0087] Step S4.6: Count the frequency of each type of non-zero row step number × the absolute value of the step number, take the largest calculated result as the row voting result, and calculate the inverse cotangent function value of its row step number, which is the angle between the feature direction and the horizontal coordinate axis; among them, the calculated inverse cosine function value of the step number is the angle between the connected domain feature and the coordinate axis.

[0088] Step S4.7: Compare the column-run voting result with the row-run voting result, and retain the result with a larger absolute value of frequency × number of steps as the characteristic direction of the connected domain;

[0089] Step S4.8: Select the next connected domain grouping record and repeat step S4.1 until all connected domain grouping results are traversed.

[0090] Step S5: Figure 6 As shown, the connected domain grouping results are traversed, and according to the characteristic direction of the connected domain calculated in step S4, the corresponding points A of the connected domain are rotated group by group to align the characteristic direction with the coordinate axis as corresponding points B, and then the corresponding points B are projected to the grid respectively to obtain the projection result B.

[0091] Step S6: Figure 7 As shown, the projection result B is traversed, each group of corresponding points B is converted into a binary image B, the binary image B is run-length encoded, the run length greater than or equal to the user-set length threshold is recorded, the point cloud is grouped according to the rectangular units corresponding to the run length, and the point cloud grouping result corresponding to the straight line segment in the point cloud image is generated.

[0092] The step S6 specifically includes the following steps:

[0093] Step S6.1: Select a set of projection results B of corresponding points B and convert them into a binary image B in the same way as step S2;

[0094] Step S6.2: decompose the binary image B column by column into column runs B composed of continuous pixels, and record all column runs B whose lengths are greater than or equal to the length threshold;

[0095] Step S6.3: traverse all column runs B, and record the corresponding points of each column run B as a point cloud group;

[0096] Step S6.4: decompose the binary image B column by column into row runs B consisting of continuous pixels, and record all row runs B whose length is greater than or equal to the length threshold;

[0097] Step S6.5: traverse all the rows B, and record the corresponding points of each row B as a point cloud group;

[0098] Step S6.6: Select the next set of corresponding points B, and repeat step S6.1 until all corresponding points B are traversed, and all point cloud grouping records constitute the point cloud grouping result;

[0099] Step S7: Figure 8 As shown, the point cloud grouping results are traversed, and the least squares method is used to fit the straight line segments in the groups. The characteristic direction of each connected domain is restored to the corresponding position of the random orthogonal structure point cloud to generate the straight line segment recognition and fitting results.

[0100] The present invention also provides a straight line segment recognition and fitting system for a random orthogonal structure point cloud, which can be implemented by executing the process steps of the straight line segment recognition and fitting method for a random orthogonal structure point cloud, that is, those skilled in the art can understand the straight line segment recognition and fitting method for a random orthogonal structure point cloud as a preferred implementation of the straight line segment recognition and fitting system for a random orthogonal structure point cloud. The system specifically includes:

[0101] Module M1: Figure 2As shown, according to the resolution set by the user, a grid composed of rectangular units that can completely cover the random orthogonal structure point cloud is constructed, and the random orthogonal structure point cloud is projected onto the grid. The points located in the rectangular unit become the corresponding points A of the rectangular unit. All rectangular units and corresponding points A are recorded, which is called the projection result A.

[0102] Module M2: Figure 3 As shown, the rectangular units with the number of corresponding points higher than the threshold are regarded as black pixels, and the rectangular units with the number of corresponding points lower than the threshold are regarded as white pixels, and the projection result A is converted into a binary image A with the same grid size.

[0103] Module M3: Figure 4 As shown, the connected domain segmentation is performed on the binary image A, and all connected domains with an area greater than a threshold are traversed, and the corresponding points of the rectangular units that make up the connected domains are counted, which are called connected domain grouping records. All connected domain grouping records with an area greater than the threshold constitute the connected domain grouping result.

[0104] Module M4: Figure 5 As shown, the connected domain grouping results are traversed, the connected domain is run-length encoded, and the corresponding feature direction is obtained through adjacent run voting statistics.

[0105] The module M4 specifically includes the following steps:

[0106] Module M4.1: Select a connected domain group record, decompose the connected domain column by column into a column run A composed of continuous pixels, and record the starting row number and the ending row number of all column runs A;

[0107] Module M4.2: traverse all column runs A, check the adjacent column runs A adjacent to the current column run A, calculate the difference between the starting row number and the ending row number of the current column run A and the adjacent column run A, calculate the result as the number of column steps, and record all non-zero column step numbers;

[0108] Module M4.3: Count the frequency of each non-zero column step number × the absolute value of the step number, take the largest calculated result as the column trip voting result, and calculate the inverse cotangent function value of its column step number, which is the angle between the characteristic direction and the vertical coordinate axis;

[0109] Module M4.4: Keep the current connected domain grouping record, decompose the connected domain row by row into row runs A composed of continuous pixels, and record the starting column number and the ending column number of all row runs A;

[0110] Module M4.5: traverse all row runs A, check the adjacent row runs A adjacent to the current row run, calculate the difference between the starting column number and the ending column number of the current row run and the adjacent row run A, the calculation result is the number of row steps, and record all non-zero row step numbers;

[0111] Module M4.6: Count the frequency of each non-zero row step number × the absolute value of the step number, take the largest calculated result as the row voting result, and calculate the inverse cotangent function value of its row step number, which is the angle between the feature direction and the horizontal coordinate axis; among them, the calculated inverse cosine function value of the step number is the angle between the connected domain feature and the coordinate axis.

[0112] Module M4.7: Compare the column-stroke voting results with the row-stroke voting results, and retain the result with a larger absolute value of frequency × number of steps as the characteristic direction of the connected domain;

[0113] Module M4.8: Select the next connected domain grouping record and repeatedly trigger module M4.1 until all connected domain grouping results are traversed.

[0114] Module M5: Figure 6 As shown, the connected domain grouping results are traversed, and according to the characteristic direction of the connected domain calculated in module M4, the corresponding points A of the connected domain are rotated group by group to align the characteristic direction with the coordinate axis as the corresponding points B, and then the corresponding points B are projected to the grid respectively to obtain the projection results B.

[0115] Module M6: Figure 7 As shown, the projection result B is traversed, each group of corresponding points B is converted into a binary image B, the binary image B is run-length encoded, the run length greater than or equal to the user-set length threshold is recorded, the point cloud is grouped according to the rectangular units corresponding to the run length, and the point cloud grouping result corresponding to the straight line segment in the point cloud image is generated.

[0116] The module M6 specifically includes the following steps:

[0117] Module M6.1: Select a set of projection results B of corresponding points B and convert them into binary image B in the same way as module M2;

[0118] Module M6.2: Decompose the binary image B column by column into column runs B consisting of continuous pixels, and record all column runs B whose length is greater than or equal to the length threshold;

[0119] Module M6.3: Traverse all column runs B, and record the corresponding points of each column run B as a point cloud group;

[0120] Module M6.4: Decompose the binary image B column by column into row runs B consisting of continuous pixels, and record all row runs B whose length is greater than or equal to the length threshold;

[0121] Module M6.5: Traverse all the rows B, and record the corresponding points of each row B as a point cloud group;

[0122] Module M6.6: Select the next set of corresponding points B and repeat module M6.1 until all corresponding points B are traversed and all point cloud grouping records constitute the point cloud grouping result;

[0123] Module M7: Figure 8 As shown, the point cloud grouping results are traversed, and the least squares method is used to fit the straight line segments in the groups. The characteristic direction of each connected domain is restored to the corresponding position of the random orthogonal structure point cloud to generate the straight line segment recognition and fitting results.

[0124] The embodiments of the present invention provide a method and system for recognizing and fitting straight line segments of a random orthogonal structure point cloud, which has excellent stability and robustness, and the recognition results are consistent with the observation results of the human eye. A large amount of debugging time and cost can be saved in the research and development of visual systems that need to recognize orthogonal structures.

[0125] Those skilled in the art know that, in addition to realizing the system and its various devices, modules, and units provided by the present invention in a purely computer-readable program code, it is entirely possible to realize the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a hardware component, and the devices, modules, and units included therein for realizing various functions can also be regarded as structures within the hardware component; the devices, modules, and units for realizing various functions can also be regarded as both software modules for realizing the method and structures within the hardware component.

[0126] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A straight line segment recognition and fitting method for random orthogonal structure point cloud, characterized in that: include: Step S1: Set the resolution, and construct a grid composed of rectangular units that can completely cover the random orthogonal structure point cloud according to the resolution, project the random orthogonal structure point cloud to the grid, and the point located in the rectangular unit becomes the corresponding point A of the rectangular unit. Record all the rectangular units and the corresponding point A to obtain the projection result A; Step S2: converting the projection result A into a binary image A with the same size as the grid; Step S3: performing connected domain segmentation on the binary image A, and obtaining connected domain grouping records to form connected domain grouping results; Step S4: traverse the connected domain grouping results, perform run encoding on the connected domain, and obtain the corresponding feature direction through adjacent run voting statistics; Step S5: traverse the connected domain grouping results, rotate the corresponding points A of the connected domain group by group according to the characteristic direction, align the characteristic direction with the coordinate axis as the corresponding point B, and then project the corresponding point B to the grid respectively to obtain the projection result B; Step S6: traverse the projection result B, convert it into a binary image B, then perform run encoding, set a length threshold to filter the run, and generate a point cloud grouping result; Step S7: traverse the point cloud grouping results, perform least squares fitting of straight line segments on the groups, and restore them to the corresponding positions of the random orthogonal structure point cloud according to the characteristic direction of each connected domain to generate straight line segment recognition and fitting results.

2. The straight line segment recognition and fitting method of random orthogonal structure point cloud according to claim 1, characterized in that: The step S3 includes: performing connected domain segmentation on the binary image A, and traversing all connected domains whose areas are larger than a threshold, counting corresponding points of rectangular units constituting the connected domains, which are called connected domain grouping records, and all connected domain grouping records whose areas are larger than the threshold constitute connected domain grouping results.

3. The straight line segment identification and fitting method of random orthogonal structure point cloud according to claim 1, characterized in that: The step S4 comprises: Step S4.1: Select a connected domain group record, decompose the connected domain column by column into a column run A composed of continuous pixels, and record the starting row number and the ending row number of all column runs A; Step S4.2: traverse all column runs A, check the adjacent column runs A adjacent to the current column run A, calculate the difference between the starting row number and the ending row number of the current column run A and the adjacent column run A, the calculation result is the number of column steps, and record all non-zero column step numbers; Step S4.3: Count the frequency of each non-zero column step number × the absolute value of the step number, take the largest calculated result as the column trip voting result, and calculate the inverse cotangent function value of its column step number, which is the angle between the characteristic direction and the vertical coordinate axis; Step S4.4: Keep the current connected domain grouping record, decompose the connected domain row by row into row runs A composed of continuous pixels, and record the starting column number and the ending column number of all row runs A; Step S4.5: traverse all row runs A, check the adjacent row runs A adjacent to the current row run, calculate the difference between the starting column number and the ending column number of the current row run and the adjacent row run A, the calculation result is the number of row steps, and record all non-zero row step numbers; Step S4.6: Count the frequency of each non-zero row step number × the absolute value of the step number, take the largest calculated result as the row voting result, and calculate the inverse cotangent function value of its row step number, which is the angle between the characteristic direction and the horizontal coordinate axis; Step S4.7: Compare the column-run voting result with the row-run voting result, and retain the result with a larger absolute value of frequency × number of steps as the characteristic direction of the connected domain; Step S4.8: Select the next connected domain grouping record and repeat step S4.1 until all connected domain grouping results are traversed.

4. The straight line segment identification and fitting method of random orthogonal structure point cloud according to claim 1, characterized in that: The step S6 includes: traversing the projection result B, converting each group of corresponding points B into a binary image B, performing run encoding on the binary image B, recording the run that is greater than or equal to the length threshold set by the user, grouping the point cloud according to the rectangular units corresponding to the run, and generating a point cloud grouping result corresponding to the straight line segments in the point cloud image.

5. The straight line segment recognition and fitting method of random orthogonal structure point cloud according to claim 4, characterized in that: The step S6 comprises: Step S6.1: Select a set of projection results B of corresponding points B and convert them into a binary image B in the same way as step S2; Step S6.2: decompose the binary image B column by column into column runs B composed of continuous pixels, and record all column runs B whose lengths are greater than or equal to the length threshold; Step S6.3: traverse all column runs B, and record the corresponding points of each column run B as a point cloud group; Step S6.4: decompose the binary image B column by column into row runs B consisting of continuous pixels, and record all row runs B whose length is greater than or equal to the length threshold; Step S6.5: traverse all the rows B, and record the corresponding points of each row B as a point cloud group; Step S6.6: Select the next set of corresponding points B and repeat step S6.1 until all corresponding points B are traversed and all point cloud grouping records constitute the point cloud grouping result.

6. A straight line segment recognition and fitting system for random orthogonal structure point clouds, characterized in that: include: Module M1: Set the resolution, and construct a grid composed of rectangular units that can completely cover the random orthogonal structure point cloud according to the resolution, project the random orthogonal structure point cloud to the grid, and the point located in the rectangular unit becomes the corresponding point A of the rectangular unit. Record all the rectangular units and the corresponding point A to obtain the projection result A; Module M2: converting the projection result A into a binary image A with the same size as the grid; Module M3: performing connected domain segmentation on the binary image A, and obtaining connected domain grouping records to form connected domain grouping results; Module M4: traverse the connected domain grouping results, perform run encoding on the connected domain, and obtain the corresponding feature direction through adjacent run voting statistics; Module M5: traverse the connected domain grouping results, rotate the corresponding points A of the connected domain group by group according to the characteristic direction, align the characteristic direction with the coordinate axis as the corresponding point B, and then project the corresponding point B to the grid respectively to obtain the projection result B; Module M6: traverse the projection result B, convert it into a binary image B, then perform run encoding, set a length threshold to filter the run, and generate a point cloud grouping result; Module M7: Traverse the point cloud grouping results, perform least squares fitting of straight line segments in groups, and restore them to the corresponding positions of the random orthogonal structure point cloud according to the characteristic direction of each connected domain to generate straight line segment recognition and fitting results.

7. The straight line segment recognition and fitting system of random orthogonal structure point cloud according to claim 6, characterized in that: The module M3 includes: performing connected domain segmentation on the binary image A, and traversing all connected domains whose areas are larger than a threshold, counting corresponding points of rectangular units constituting the connected domains, which are called connected domain grouping records, and all connected domain grouping records whose areas are larger than the threshold constitute connected domain grouping results; The module M4 comprises: Module M4.1: Select a connected domain group record, decompose the connected domain column by column into a column run A composed of continuous pixels, and record the starting row number and the ending row number of all column runs A; Module M4.2: traverse all column runs A, check the adjacent column runs A adjacent to the current column run A, calculate the difference between the starting row number and the ending row number of the current column run A and the adjacent column run A, calculate the result as the number of column steps, and record all non-zero column step numbers; Module M4.3: Count the frequency of each non-zero column step number × the absolute value of the step number, take the largest calculated result as the column trip voting result, and calculate the inverse cotangent function value of its column step number, which is the angle between the characteristic direction and the vertical coordinate axis; Module M4.4: Keep the current connected domain grouping record, decompose the connected domain row by row into row runs A composed of continuous pixels, and record the starting column number and the ending column number of all row runs A; Module M4.5: traverse all row runs A, check the adjacent row runs A adjacent to the current row run, calculate the difference between the starting column number and the ending column number of the current row run and the adjacent row run A, the calculation result is the number of row steps, and record all non-zero row step numbers; Module M4.6: Count the frequency of each non-zero row step number × the absolute value of the step number, take the largest calculated result as the row trip voting result, and calculate the inverse cotangent function value of its row step number, which is the angle between the characteristic direction and the horizontal coordinate axis; Module M4.7: Compare the column-stroke voting results with the row-stroke voting results, and retain the result with a larger absolute value of frequency × number of steps as the characteristic direction of the connected domain; Module M4.8: Select the next connected domain grouping record and repeatedly trigger module M4.1 until all connected domain grouping results are traversed.

8. The straight line segment recognition and fitting system of random orthogonal structure point cloud according to claim 6, characterized in that: The module M6 comprises: traversing the projection result B, converting each group of corresponding points B into a binary image B, performing run encoding on the binary image B, recording the run that is greater than or equal to the length threshold set by the user, grouping the point cloud according to the rectangular units corresponding to the run, and generating a point cloud grouping result corresponding to the straight line segment in the point cloud image; The module M6 comprises: Module M6.1: Select a set of projection results B of corresponding points B and convert them into binary image B in the same way as module M2; Module M6.2: Decompose the binary image B column by column into column runs B consisting of continuous pixels, and record all column runs B whose length is greater than or equal to the length threshold; Module M6.3: Traverse all column runs B, and record the corresponding points of each column run B as a point cloud group; Module M6.4: Decompose the binary image B column by column into row runs B consisting of continuous pixels, and record all row runs B whose length is greater than or equal to the length threshold; Module M6.5: Traverse all the rows B, and record the corresponding points of each row B as a point cloud group; Module M6.6: Select the next set of corresponding points B and repeatedly trigger module M6.1 until all corresponding points B are traversed and all point cloud grouping records constitute the point cloud grouping result.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for identifying and fitting straight line segments of a random orthogonal structure point cloud as described in any one of claims 1 to 5 are implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the computer program is executed by a processor, the steps of the method for identifying and fitting straight line segments of a random orthogonal structure point cloud as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Detection method for quickly identifying straight-line segments in digital image

    CN102819743B

  • A method for identifying horizontal and vertical line segments in an image.

    CN108776776B

  • An Adaptive Line Detection Method Based on Hough Transform

    CN113793354B

  • Method for calculating straightness and method for calculating difference between maximum diameter and minimum diameter of section

    CN109341626A

  • Indoor modeling method and device and terminal equipment

    CN111210501A