Method and device for extracting point cloud boundary, storage medium and electronic equipment
1. A method for extracting a point cloud boundary is characterized by comprising the following steps:
acquiring a contour point cloud of a target surface, and removing outliers in the contour point cloud to obtain an intermediate point cloud;
performing row retrieval on the intermediate point cloud, and extracting an initial boundary point of each row;
taking an initial boundary point as a starting point, performing adjacent point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all lines of the intermediate point cloud to obtain an ordered point set, wherein the ordered point set comprises ordered sub-point sets of all boundaries;
outputting the ordered set of points as a point cloud boundary of the contour point cloud.
2. The method of claim 1, wherein obtaining a contour point cloud of a target surface comprises:
acquiring laser scanning point cloud data transmitted by a line laser scanner, wherein data points in the ith row and the jth column are represented as follows:,fx ,fythe resolution ratios of the line laser scanner in the x-axis direction and the y-axis direction are respectively, z is the height of the point, and i and j are integers larger than 0;
and determining the laser scanning point cloud data as a contour point cloud.
3. The method of claim 1, wherein performing a row search on the intermediate point cloud, extracting initial boundary points for each row comprises:
aiming at the i rows, carrying out row retrieval on the intermediate point cloud to obtain a point set of the i rows
Wherein n is the maximum number of columns;
for the Pi,rowEach point cloud P ini,jObtaining the adjacent point cloud Pi-1,jAnd Pi+1,jAnd according to said Pi,j,Pi-1,jAnd Pi+1,jObtaining an initial boundary point set P of i rowsc i,row。
4. The method of claim 3, wherein P is the basis of the quantity of Pi,j,Pi-1,jAnd Pi+1,jObtaining an initial boundary point set P of i rowsc i,rowThe method comprises the following steps:
respectively determine Pi,j,Pi-1,jAnd Pi+1,jWhether it is a valid point;
if Pi,jIs a significant point, and Pi-1,jAnd Pi+1,jIf there is one and only one is invalid point, then the P is determinedi,jPoint is initial boundary point, go through Pi,rowObtaining a boundary point set of i rows as P by all point clouds in the (A)c i,row。
5. The method of claim 1, wherein the step of performing adjacent point search on the intermediate point cloud line by using an initial boundary point as a starting point to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially completing search of all lines of the intermediate point cloud to obtain an ordered point set of all boundaries comprises the steps of:
taking the initial boundary point as a starting point, and performing clockwise adjacent point retrieval on the intermediate point cloud line by line;
obtained by searching adjacent pointsPutting all points into a point set P in sequencevecAnd obtaining an ordered sub-point set of the boundary where the point is located, and sequentially searching all rows of the intermediate point cloud to obtain the ordered point set.
6. The method of claim 5, wherein performing clockwise neighboring point search on the intermediate point cloud line by line with an initial boundary point as a starting point comprises:
taking an initial boundary point as a starting point, and according to a downlink sequence:and clockwise adjacent point retrieval is carried out on the intermediate point cloud line by line, wherein the floor () is a floor function.
7. The method of claim 1, wherein the step of performing the neighboring point search on the intermediate point cloud line by using an initial boundary point as a starting point to obtain an ordered sub-point set of a boundary where the starting point is located comprises:
searching point P by using first initial boundary point as starting pointstartTaking P in both the row and column directionsstartAdjacent 2N points, wherein N is an integer greater than 1;
counting the adjacent point sequence with the longest continuous effective points in the 2N points, and putting the tail point of the adjacent point sequence in the clockwise direction into a point set PvecAnd updating the search point P with the tail pointstartContinuing iterative retrieval until the retrieved tail point is coincided with the first initial boundary point again, and collecting the current point set PvecDetermining an ordered sub-point set which is the boundary where the first initial boundary point is located;
judging whether a second initial boundary point adjacent to the first initial boundary point has a point set P of the first initial boundary pointvecIf yes, skipping the second initial boundary point and continuing to obtain the next initial boundary point until the initial boundary point of the current line is searched.
8. An apparatus for extracting a point cloud boundary, comprising:
the acquisition module is used for acquiring the contour point cloud of the target surface and eliminating outliers in the contour point cloud to obtain an intermediate point cloud;
the extraction module is used for carrying out row retrieval on the intermediate point cloud and extracting the initial boundary point of each row;
the retrieval module is used for carrying out adjacent point retrieval on the intermediate point cloud line by taking an initial boundary point as a starting point to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all the lines of the intermediate point cloud to obtain an ordered point set, wherein the ordered point set comprises the ordered sub-point sets of all the boundaries;
and the output module is used for outputting the ordered point set as a point cloud boundary of the contour point cloud.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein the program is operative to perform the method steps of any of the preceding claims 1 to 7.
10. An electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; wherein:
a memory for storing a computer program;
a processor for performing the method steps of any of claims 1 to 7 by executing a program stored on a memory.
Background
In the related art, the boundary is not only used for expressing the important geometric characteristics of the curved surface and solving the definition domain of the curved surface, but also plays an important role in reconstructing the quality and the precision of the curved surface model.
In the related technology, the extraction algorithm of the point cloud boundary divides the point cloud into a plurality of sub-clusters through k-means clustering, detects the boundary cluster according to a three-dimensional grid division method, and extracts boundary points in the boundary cluster through quadrant identification. The specific method comprises the following steps: 1) selecting k points uniformly distributed in the point cloud data as initial clustering centers, initializing the clustering centers, and distributing the rest point cloud data to clustering clusters of each clustering center according to a standard k-means clustering method; 2) detecting the boundary cluster by counting the number of the adjacent cluster center points of the cluster center in the neighborhood with the radius of r; 3) and (4) taking the coordinate difference value between the adjacent point and the clustering center point as a judgment standard, and counting the distribution condition of the coordinate difference value between the point in each boundary and other points to judge whether the point is a boundary point. The method in the related art has a large amount of clustering and plane fitting operations, low operation efficiency and failure to obtain an ordered point set for describing a boundary curve.
In view of the above problems in the related art, no effective solution has been found at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for extracting a point cloud boundary, a storage medium and electronic equipment.
According to an aspect of an embodiment of the present application, there is provided a method for extracting a point cloud boundary, including: acquiring a contour point cloud of a target surface, and removing outliers in the contour point cloud to obtain an intermediate point cloud; performing row retrieval on the intermediate point cloud, and extracting an initial boundary point of each row; taking an initial boundary point as a starting point, performing adjacent point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all lines of the intermediate point cloud to obtain an ordered point set, wherein the ordered point set comprises ordered sub-point sets of all boundaries; outputting the ordered set of points as a point cloud boundary of the contour point cloud.
Further, acquiring the contour point cloud of the target surface includes:
acquiring laser scanning point cloud data transmitted by a line laser scanner, wherein data points in the ith row and the jth column are represented as follows:,fx ,fythe resolution ratios of the line laser scanner in the x-axis direction and the y-axis direction are respectively, z is the height of the point, and i and j are integers larger than 0; and determining the laser scanning point cloud data as a contour point cloud.
Further, performing row retrieval on the intermediate point cloud, and extracting an initial boundary point of each row comprises:
aiming at the i rows, carrying out row retrieval on the intermediate point cloud to obtain a point set of the i rows
Wherein n is the maximum number of columns;
for the Pi,rowEach point cloud P ini,jObtaining the adjacent point cloud Pi-1,jAnd Pi+1,jAnd according to said Pi,j,Pi-1,jAnd Pi+1,jObtaining an initial boundary point set P of i rowsc i,row。
Further, according to the Pi,j,Pi-1,jAnd Pi+1,jObtaining an initial boundary point set P of i rowsc i,rowThe method comprises the following steps: respectively determine Pi,j,Pi-1,jAnd Pi+1,jWhether it is a valid point; if Pi,jIs a significant point, and Pi-1,jAnd Pi+1,jIf there is one and only one is invalid point, then the P is determinedi,jPoint is initial boundary point, go through Pi,rowObtaining a boundary point set of i rows as P by all point clouds in the (A)c i,row。
Further, with an initial boundary point as a starting point, performing adjacent point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all lines of the intermediate point cloud to obtain ordered point sets of all boundaries, including: taking the initial boundary point as a starting point, and performing clockwise adjacent point retrieval on the intermediate point cloud line by line; all the points obtained by searching the adjacent points are sequentially put into a point set PvecAnd obtaining an ordered sub-point set of the boundary where the point is located, and sequentially searching all rows of the intermediate point cloud to obtain the ordered point set.
Further, with the initial boundary point as a starting point, performing clockwise neighboring point retrieval on the intermediate point cloud line by line comprises:
taking an initial boundary point as a starting point, and according to a downlink sequence:and clockwise adjacent point retrieval is carried out on the intermediate point cloud line by line, wherein the floor () is a floor function.
Further, with an initial boundary point as a starting point, performing adjacent point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located, including: searching point P by using first initial boundary point as starting pointstartTaking P in both the row and column directionsstartAdjacent 2N points, wherein N is an integer greater than 1; counting the adjacent point sequence with the longest continuous effective points in the 2N points, and putting the tail point of the adjacent point sequence in the clockwise direction into a point set PvecAnd updating the search point P with the tail pointstartContinuing iterative retrieval until the retrieved tail point is coincided with the first initial boundary point again, and collecting the current point set PvecDetermining an ordered sub-point set which is the boundary where the first initial boundary point is located; judging whether a second initial boundary point adjacent to the first initial boundary point exists in the first initial boundary point or notPoint set P ofvecIf yes, skipping the second initial boundary point and continuing to obtain the next initial boundary point until the initial boundary point of the current line is searched.
According to another aspect of the embodiments of the present application, there is also provided an apparatus for extracting a point cloud boundary, including: the acquisition module is used for acquiring the contour point cloud of the target surface and eliminating outliers in the contour point cloud to obtain an intermediate point cloud; the extraction module is used for carrying out row retrieval on the intermediate point cloud and extracting the initial boundary point of each row; the retrieval module is used for carrying out adjacent point retrieval on the intermediate point cloud line by taking an initial boundary point as a starting point to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all the lines of the intermediate point cloud to obtain an ordered point set, wherein the ordered point set comprises the ordered sub-point sets of all the boundaries; and the output module is used for outputting the ordered point set as a point cloud boundary of the contour point cloud.
Further, the obtaining module includes: the acquisition unit is used for acquiring laser scanning point cloud data transmitted by a line laser scanner, wherein data points in the ith row and the jth column are represented as follows:,fx ,fythe resolution ratios of the line laser scanner in the x-axis direction and the y-axis direction are respectively, z is the height of the point, and i and j are integers larger than 0; and the determining unit is used for determining the laser scanning point cloud data as a contour point cloud.
Further, the extraction module comprises: a retrieval unit, configured to perform row retrieval on the intermediate point cloud for the i rows to obtain a point set of the i rows
Wherein n is the maximum number of columns; a processing unit for aiming at the Pi,rowEach point cloud P ini,jObtaining the adjacent point cloud Pi-1,jAnd Pi+1,jAnd according to said Pi,j,Pi-1,jAnd Pi+1,jGet i rowsIs set of initial boundary points Pc i,row。
Further, the processing unit includes: a judgment subunit for respectively judging Pi,j,Pi-1,jAnd Pi+1,jWhether it is a valid point; a processing subunit for processing if Pi,jIs a significant point, and Pi-1,jAnd Pi+1,jIf there is one and only one is invalid point, then the P is determinedi,jPoint is initial boundary point, go through Pi,rowObtaining a boundary point set of i rows as P by all point clouds in the (A)c i,row。
Further, the retrieval module includes: the retrieval unit is used for carrying out clockwise adjacent point retrieval on the intermediate point cloud line by taking the initial boundary point as a starting point; a first processing unit, configured to put all the points obtained by neighboring point search into a point set P in sequencevecAnd obtaining an ordered sub-point set of the boundary where the point is located, and sequentially searching all rows of the intermediate point cloud to obtain the ordered point set.
Further, the retrieval unit includes: a retrieval subunit, configured to use the initial boundary point as a starting point, and according to the downlink sequence:and clockwise adjacent point retrieval is carried out on the intermediate point cloud line by line, wherein the floor () is a floor function.
Further, the retrieval module includes: a positioning unit for searching the point P with the first initial boundary point as a starting pointstartTaking P in both the row and column directionsstartAdjacent 2N points, wherein N is an integer greater than 1; an iteration unit, configured to count an adjacent point sequence with the longest continuous effective points among the 2N points, and put a tail point of the adjacent point sequence in the clockwise direction into the point set PvecAnd updating the search point P with the tail pointstartContinuing iterative retrieval until the retrieved tail point is coincided with the first initial boundary point again, and collecting the current point set PvecDetermining an ordered sub-point set which is the boundary where the first initial boundary point is located; a second processing unit for judging the phase of the first initial boundary pointWhether a point set P of the first initial boundary point exists in a neighboring second initial boundary pointvecIf yes, skipping the second initial boundary point and continuing to obtain the next initial boundary point until the initial boundary point of the current line is searched.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program that executes the above steps when the program is executed.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus; wherein: a memory for storing a computer program; a processor for executing the steps of the method by running the program stored in the memory.
Embodiments of the present application also provide a computer program product containing instructions, which when run on a computer, cause the computer to perform the steps of the above method.
According to the invention, the contour point cloud of the target surface is obtained, outliers in the contour point cloud are removed to obtain the intermediate point cloud, the intermediate point cloud is retrieved, the initial boundary point of each line is extracted, the adjacent point retrieval is performed on the intermediate point cloud line by taking the initial boundary point as the initial point to obtain the ordered sub-point set of the boundary where the initial point is located, all the lines of the intermediate point cloud are sequentially retrieved to obtain the ordered point set, the ordered point set comprises the ordered sub-point sets of all the boundaries, the ordered point set is output as the point cloud boundary of the contour point cloud, the retrieval efficiency is improved through the boundary point retrieval, the ordered point set in the point cloud is extracted through the adjacent point retrieval, the clear, accurate and continuous boundary line is generated through the ordered point set, and the technical problem of low efficiency of related technology for generating the boundary is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a block diagram of a hardware configuration of a computer according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for extracting a point cloud boundary according to an embodiment of the invention;
FIG. 3 is a schematic illustration of a laser scanning point cloud in an embodiment of the invention;
FIG. 4 is a diagram illustrating neighbor search according to an embodiment of the present invention;
fig. 5 is a block diagram of an apparatus for extracting a point cloud boundary according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
The method provided by the embodiment one of the present application may be executed in a server, a computer, or a similar computing device. Taking an example of the present invention running on a computer, fig. 1 is a block diagram of a hardware structure of a computer according to an embodiment of the present invention. As shown in fig. 1, the computer may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and optionally, a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those of ordinary skill in the art that the configuration shown in FIG. 1 is illustrative only and is not intended to limit the configuration of the computer described above. For example, a computer may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program and a module of application software, such as a computer program corresponding to a method for extracting a point cloud boundary in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, so as to implement the method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
In this embodiment, a method for extracting a point cloud boundary is provided, and fig. 2 is a flowchart of the method for extracting a point cloud boundary according to the embodiment of the present invention, as shown in fig. 2, the process includes the following steps:
step S202, contour point clouds of the target surface are obtained, outliers in the contour point clouds are removed, and intermediate point clouds are obtained;
the contour point cloud of the present embodiment is generated by scanning the target surface using a line laser scanner.
Step S204, searching the intermediate point cloud, and extracting the initial boundary point of each line;
in this embodiment, each row includes a number of initial boundary points, which form an initial boundary point set.
Step S206, taking the initial boundary point as a starting point, performing adjacent point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all lines of the intermediate point cloud to obtain an ordered point set, wherein the ordered point set comprises the ordered sub-point sets of all the boundaries;
and S208, outputting the ordered point set as a point cloud boundary of the contour point cloud.
Optionally, after the point cloud boundary is output, an image of the target surface may be further rendered by using the point cloud boundary.
Through the steps, the contour point cloud of the target surface is obtained, outliers in the contour point cloud are removed, the intermediate point cloud is obtained, the intermediate point cloud is retrieved, initial boundary points of each line are extracted, adjacent point retrieval is conducted on the intermediate point cloud line by taking the initial boundary points as starting points, an ordered sub-point set of the boundary where the starting points are located is obtained, all lines of the intermediate point cloud are sequentially retrieved, an ordered point set is obtained, the ordered point set comprises ordered sub-point sets of all the boundaries, the ordered point set is output as the point cloud boundary of the contour point cloud, retrieval efficiency is improved through boundary point retrieval, the ordered point set in the point cloud is extracted through the adjacent point retrieval, clear, accurate and continuous boundary lines are generated through the ordered point set, and the technical problem that the efficiency of generating the boundary lines in the related technology is low is solved.
In one embodiment of this embodiment, acquiring the contour point cloud of the target surface includes: acquiring laser scanning point cloud data transmitted by a line laser scanner, wherein data points in the ith row and the jth column are represented as follows:,fx ,fythe resolution of the line laser scanner in the x-axis direction and the y-axis direction is respectively, z is the height of the point, i and j are integers greater than 0, and the line number and the column number of data points in the point cloud are respectively represented in the embodiment; and determining the laser scanning point cloud data as a contour point cloud.
According to the line scanning laser principle, the point cloud data of the laser scanning is uniformly distributed on the XOY plane of the coordinate axis, and the ith row and the jth column pointWherein f isx ,fyResolution of the scanner in the x and y directions, respectively, and z is height information at that point. The scanning data generally includes a large number of valid points and invalid points, the valid points actually record object surface contour information, the invalid points are generally distributed in areas, such as holes and backgrounds of the object, which exceed the height range of the scanner, the point cloud boundary is a boundary between the valid points and the invalid points, in this embodiment, whether the height range of the scanner is exceeded or not is judged by comparing the height z of the data points, and if the height range of the data points is exceeded, the data points are the invalid points, fig. 3 is a schematic diagram of laser scanning point cloud in the embodiment of the present invention, wherein a point with a larger radius represents a valid point, a point with a smaller radius represents an invalid point, and a short line represents a boundary line.
In one embodiment of this embodiment, retrieving the intermediate point cloud, and extracting the initial boundary point of each line includes: aiming at the i rows, performing row retrieval on the intermediate point cloud to obtain a point set of the i rowsWherein n is the maximum number of columns; for the Pi,rowEach point cloud P ini,jObtaining the adjacent point cloud Pi-1,jAnd Pi+1,jAnd according to said Pi,j,Pi-1,jAnd Pi+1,jObtaining an initial boundary point set P of i rowsc i,row。
In one example, according to said Pi,j,Pi-1,jAnd Pi+1,jObtaining an initial boundary point set P of i rowsc i,rowThe method comprises the following steps: respectively determine Pi,j,Pi-1,jAnd Pi+1,jWhether it is a valid point; if Pi,jIs a significant point, and Pi-1,jAnd Pi+1,jIf there is one and only one is invalid point, then the P is determinedi,jPoint is initial boundary point, go through Pi,rowObtaining a boundary point set of i rows as P by all point clouds in the (A)c i,row. In some examples, except for judging Pi,j,Pi-1,jAnd Pi+1,jIn addition, to prevent errors and improve accuracy, P can be further determinedi,j-1,Pi,j+1Whether it is a valid point; if Pi,jIs a significant point, and Pi-1,jAnd Pi+1,jOf which and only one is a null point, Pi,j-1,Pi,j+1If there is one and only one is invalid point, then the P is determinedi,jPoint is initial boundary point, go through Pi,rowThe boundary point set of the obtained lines is Pc i,row。
In this embodiment, with the initial boundary point as the starting point, performing neighboring point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all lines of the intermediate point cloud to obtain an ordered point set of all boundaries, including: taking the initial boundary point as a starting point, and performing clockwise adjacent point retrieval on the intermediate point cloud line by line; all the points obtained by searching the adjacent points are sequentially put into a point set PvecAnd sequentially searching all the lines of the intermediate point cloud to obtain an ordered point set.
In one embodiment, with the initial boundary point as a starting point, performing clockwise neighboring point retrieval on the intermediate point cloud line by line comprises: taking an initial boundary point as a starting point, and according to a downlink sequence:
and clockwise adjacent point retrieval is carried out on the intermediate point cloud line by line, wherein the floor () is a floor function and is used for rounding down. I.e., first scan line 0, then line 4, then line 9, until the last element of the line sequence.
In one embodiment, taking the initial boundary point as a starting point, performing neighbor point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located includes: searching point P by using first initial boundary point as starting pointstartTaking P in both the row and column directionsstartAdjacent 2N points, wherein N is an integer greater than 1; counting the adjacent point sequence with the longest continuous effective points in the 2N points, and putting the tail point of the adjacent point sequence in the clockwise direction into a point set PvecAnd updating the search point P with the tail pointstartContinuing iterative retrieval until the retrieved tail point is coincided with the first initial boundary point again, and collecting the current point set PvecDetermining an ordered sub-point set which is the boundary where the first initial boundary point is located; judging whether a second initial boundary point adjacent to the first initial boundary point has a point set P of the first initial boundary pointvecIf yes, skipping the second initial boundary point and continuing to obtain the next initial boundary point until the initial boundary point of the current line is searched.
In one example, N =4, take PstartEight adjacent points (up, down, left, right, and four oblique angles) were processed, N =2, and P was takenstartThe adjacent four points (up, down, left, and right) are processed.
In the embodiment, a line laser scanner is used for generating a target surface contour point cloud, and Gaussian filtering is performed to remove outliers; and then searching the point cloud row, marking the boundary point of the row, and searching the ordered point set of the boundary in an adjacent point searching mode by taking the marked boundary point as a starting point. And sequentially searching all the lines of the point cloud to obtain all the boundary ordered point sets. And recording the point cloud P as a contour point cloud obtained by line laser scanning.
In a specific example, the boundary extraction method of the laser scanning point cloud data P (m rows and n columns) is as follows:
1) line searching point cloud, extracting elements of the point cloud P line i to obtain a line point set;
For point Pi,jWhen P isi,jIs a significant point, and Pi-1,jAnd Pi+1,jIf there is one and only one is invalid point, then the point P is judgedi,jAre preliminary boundary points. Calculating the line boundary point set as Pc i,row;
2) By a set of boundary points Pc i,rowTaking one point in the search list as a starting point, and performing clockwise adjacent point search. Using the boundary points;
element point P in the seti,jFor example, all the points of the neighboring point search are put into the point set P in turnvecIn, then PvecI.e. an ordered set of points of the boundary at which the point is located. InitialWith Pi,jThe clockwise neighborhood search process for the starting point is as follows:
a)Pi,jas a search point PstartTaking P in the row-column directionstartEight neighboring points, FIG. 4 is a schematic diagram of the neighboring point search according to the embodiment of the present invention, PstartThe eight adjacent points are Pi-1,j-1,P i-1,j,P i-1,j+1,P i,j+1,P i+1,j+1,P i+1,j,P i-1,j+1,P i-1,j(ii) a At the first clockwise search, P i-1,j+1,P i,j+1,P i+1,j+1,P i+1,jIs a valid point, and the others are invalid points, and in the second clockwise search, P i-1,j+1,P i-1,j,Pi-1,j-1The other are valid points and invalid points.
b) Counting the longest adjacent point sequence of continuous effective points, and searching clockwise for the first timeThen, the lengths of the continuous effective points of the adjacent point sequences are respectively 4,3,2 and 1, when the clockwise search is carried out for the second time, the lengths of the adjacent point sequences are respectively 3,2 and 1, the longest adjacent point sequence is selected, and the tail point of the sequence in the clockwise direction is placed into a point set PvecAnd using the point as a search point PstartAnd repeating the retrieval. Until the search point again matches the point Pi,jAnd stopping searching for superposition. At this time point set PvecIs the point Pi,jAn ordered set of points of the boundary at which it is located;
3) in sequence to Pi,rowAll the points in the search process carry out clockwise neighbor point search. In order to avoid the repetition of the same boundary, retrieval is carried out for multiple times, a retrieval starting point is compared with all obtained boundary ordered point sets, if the starting point exists in a certain ordered point set, the retrieval of adjacent points of the starting point is skipped, and the next point is continued;
4) in turn toAnd (4) executing the retrieval processes (1), (2) and (3) by a row (floor is a floor function) to obtain all boundary ordered point sets of the point cloud.
According to the scheme of the embodiment, a boundary point retrieval mode is designed according to the characteristics of scanning the point cloud by the laser line, and the operation efficiency is greatly improved. Moreover, most of the boundary information extracted in the existing method is scattered point cloud, which is not beneficial to subsequent feature processing, and the ordered point set based on the boundary line is finally extracted in an adjacent point retrieval mode, so that a clear, accurate and continuous boundary line can be generated based on the ordered point set.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
The present embodiment further provides an apparatus and a system for extracting a point cloud boundary, which are used to implement the foregoing embodiments and preferred embodiments, and are not described again after being described. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of an apparatus for extracting a point cloud boundary according to an embodiment of the present invention, as shown in fig. 5, the apparatus includes: an acquisition module 50, an extraction module 52, a retrieval module 54, an output module 56, wherein,
the acquisition module 50 is used for acquiring the contour point cloud of the target surface and eliminating outliers in the contour point cloud to obtain an intermediate point cloud;
an extracting module 52, configured to perform row retrieval on the intermediate point cloud, and extract an initial boundary point of each row;
a retrieval module 54, configured to perform neighboring point retrieval on the intermediate point cloud line by using an initial boundary point as a starting point to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieve all the lines of the intermediate point cloud to obtain an ordered point set, where the ordered point set includes ordered sub-point sets of all the boundaries;
an output module 56 for outputting the ordered set of points as a point cloud boundary of the contour point cloud.
Optionally, the obtaining module includes: the acquisition unit is used for acquiring laser scanning point cloud data transmitted by a line laser scanner, wherein data points in the ith row and the jth column are represented as follows:,fx ,fythe resolution ratios of the line laser scanner in the x-axis direction and the y-axis direction are respectively, z is the height of the point, and i and j are integers larger than 0;and the determining unit is used for determining the laser scanning point cloud data as a contour point cloud.
Optionally, the extracting module includes: a retrieval unit, configured to perform row retrieval on the intermediate point cloud for the i rows to obtain a point set of the i rows
Wherein n is the maximum number of columns; a processing unit for aiming at the Pi,rowEach point cloud P ini,jObtaining the adjacent point cloud Pi-1,jAnd Pi+1,jAnd according to said Pi,j,Pi-1,jAnd Pi+1,jObtaining an initial boundary point set P of i rowsc i,row。
Optionally, the processing unit includes: a judgment subunit for respectively judging Pi,j,Pi-1,jAnd Pi+1,jWhether it is a valid point; a processing subunit for processing if Pi,jIs a significant point, and Pi-1,jAnd Pi+1,jIf there is one and only one is invalid point, then the P is determinedi,jPoint is initial boundary point, go through Pi,rowObtaining a boundary point set of i rows as P by all point clouds in the (A)c i,row。
Optionally, the retrieving module includes: the retrieval unit is used for carrying out clockwise adjacent point retrieval on the intermediate point cloud line by taking the initial boundary point as a starting point; a first processing unit, configured to put all the points obtained by neighboring point search into a point set P in sequencevecAnd obtaining an ordered sub-point set of the boundary where the point is located, and sequentially searching all rows of the intermediate point cloud to obtain the ordered point set.
Optionally, the retrieving unit includes: a retrieval subunit, configured to use the initial boundary point as a starting point, and according to the downlink sequence:and clockwise adjacent point retrieval is carried out on the intermediate point cloud line by line, wherein the floor () is a floor function.
Optionally, theThe retrieval module comprises: a positioning unit for searching the point P with the first initial boundary point as a starting pointstartTaking P in both the row and column directionsstartAdjacent 2N points, wherein N is an integer greater than 1; an iteration unit, configured to count an adjacent point sequence with the longest continuous effective points among the 2N points, and put a tail point of the adjacent point sequence in the clockwise direction into the point set PvecAnd updating the search point P with the tail pointstartContinuing iterative retrieval until the retrieved tail point is coincided with the first initial boundary point again, and collecting the current point set PvecDetermining an ordered sub-point set which is the boundary where the first initial boundary point is located; a second processing unit, configured to determine whether a second initial boundary point adjacent to the first initial boundary point has a point set P of the first initial boundary pointvecIf yes, skipping the second initial boundary point and continuing to obtain the next initial boundary point until the initial boundary point of the current line is searched.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Example 3
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring contour point cloud of the target surface, and eliminating outliers in the contour point cloud to obtain intermediate point cloud;
s2, performing row retrieval on the intermediate point cloud, and extracting initial boundary points of each row;
s3, taking an initial boundary point as a starting point, performing adjacent point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all lines of the intermediate point cloud to obtain an ordered point set, wherein the ordered point set comprises ordered sub-point sets of all boundaries;
s4, outputting the ordered point set as the point cloud boundary of the contour point cloud.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic device may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring contour point cloud of the target surface, and eliminating outliers in the contour point cloud to obtain intermediate point cloud;
s2, performing row retrieval on the intermediate point cloud, and extracting initial boundary points of each row;
s3, taking an initial boundary point as a starting point, performing adjacent point retrieval on the intermediate point cloud line by line to obtain an ordered sub-point set of the boundary where the starting point is located, and sequentially retrieving all lines of the intermediate point cloud to obtain an ordered point set, wherein the ordered point set comprises ordered sub-point sets of all boundaries;
s4, outputting the ordered point set as the point cloud boundary of the contour point cloud.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.