Cylindrical point cloud parameter optimization method and device, electronic equipment and readable storage medium
By synthesizing and projecting the cylindrical point cloud, building a loss function and optimizing it using a gradient descent algorithm, the problems of noise point sensitivity and hypothetical point cloud uniformity in the existing technology are solved, and the accuracy of cylindrical point cloud parameter optimization is improved.
Patent Information
- Application Number
- CN202510257608.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-06-13
AI Technical Summary
The prior art assumes that point clouds are distributed uniformly in the optimization of cylindrical point cloud parameters, and cannot effectively deal with dense or sparse areas, and is sensitive to noise points and outliers, resulting in inaccurate optimization results.
By obtaining the workpiece point cloud of the target workpiece, the point cloud belonging to the cylinder in the cylindrical point cloud is extracted and divided into point clouds within the preset height range, projected to the bottom surface of the cylinder, and the loss function is constructed based on the projection point and the parameters to be optimized, and multiple iterative optimization is performed using the gradient descent algorithm.
Eliminate noise points to optimize the interference, improve the accuracy of optimization results, and can provide accurate center and radius optimization results in complex industrial applications or scenarios with high precision requirements.
Smart Images

Figure CN120147540A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional point cloud processing, and in particular, to a method, device, electronic device, and readable storage medium for optimizing cylindrical point cloud parameters. Background Art
[0002] In the field of point cloud processing and optimization, especially in the three-dimensional reconstruction and geometric fitting of cylindrical objects, it is usually necessary to optimize the parameters related to cylindrical point clouds, including the optimization of the position of the center of the bottom surface of the cylinder, the radius of the bottom surface of the cylinder, etc.
[0003] In the prior art, one of the most common processing methods is to project the point cloud on the cylindrical surface onto a certain reference plane (such as the bottom surface of the cylinder), and then optimize based on the projected points. This method simplifies the problem and makes it easier to handle by reducing the dimension. However, after the point cloud is projected onto the plane, some important geometric information may be lost. Especially when the point cloud is unevenly distributed, the projected point cloud may not accurately reflect the shape of the original cylindrical surface.
[0004] In addition, there are also fitting methods based on the geometric model of the cylinder. For example, in the least squares fitting method, the center and radius of the cylinder are fitted by minimizing the distance from the points in the point cloud to the cylinder. This method is simple and easy to use, but it often assumes that the point cloud has no noise and is evenly distributed. Another example is the Random Sample Consensus (RANSAC) algorithm, in which a subset of points is randomly selected for fitting, and finally the most suitable cylinder model is obtained. This method can suppress the influence of noise points to a certain extent, but there is still a problem of being sensitive to noise, especially in the case of uneven point cloud.
[0005] In addition, there are also optimization methods based on geometric distance, optimization methods based on cost functions, etc.
[0006] Although the methods adopted in the prior art can optimize the parameters of cylindrical point clouds in some applications, there are also some significant drawbacks. Specifically, the existing fitting methods usually assume that the point cloud is evenly distributed. However, in actual scenarios, the point cloud often has dense or sparse regions, which causes the traditional fitting methods to overfit or underfit in some regions, affecting the accuracy of the optimization. The traditional optimization algorithms are sensitive to noise points and outliers. Especially when there is obvious noise in the point cloud, it may lead to inaccurate optimization results. These defects existing in the prior art make it impossible to provide accurate optimization results of the center and radius in complex industrial applications or scenarios with high-precision requirements. Summary of the Invention
[0007] The purpose of the embodiments of the present invention is to provide a method, device, electronic device, and readable storage medium for optimizing cylindrical point cloud parameters, so as to eliminate the interference of noise points on the optimization and improve the accuracy of the optimization results.
[0008] In a first aspect, the present invention provides a method for optimizing cylindrical point cloud parameters, the method comprising:
[0009] Obtain the workpiece point cloud of the target workpiece, the workpiece point cloud including a cylindrical point cloud;
[0010] Extract the point cloud belonging to the cylindrical surface from the cylindrical point cloud, and segment the point cloud on the cylindrical surface to obtain the point cloud within a preset height range;
[0011] Project each three-dimensional point in the point cloud within the preset height range onto the bottom surface of the cylinder to obtain projection points;
[0012] Construct a loss function based on the projection points and the parameters to be optimized, and perform gradient descent processing based on the loss function for multiple iterations until the optimized parameters are obtained when the preset requirements are met.
[0013] In an optional embodiment, the step of segmenting the point cloud on the cylindrical surface to obtain the point cloud within a preset height range includes:
[0014] Project each three-dimensional point in the point cloud on the cylindrical surface onto the axis of the cylinder to obtain corresponding projection points;
[0015] Based on the projection points corresponding to each three-dimensional point, segment the point cloud on the cylindrical surface within the preset height range.
[0016] In an optional embodiment, the step of segmenting the point cloud on the cylindrical surface within the preset height range based on the projection points corresponding to each three-dimensional point includes:
[0017] Obtain the projection values of each projection point in the direction of the axis of the cylinder;
[0018] Select the projection points corresponding to the projection values within the preset height range;
[0019] Based on the selected projection points, segment the point cloud on the cylindrical surface within the preset height range.
[0020] In an optional embodiment, the parameters to be optimized include the coordinates of the center of the bottom surface and the radius of the bottom surface;
[0021] The step of constructing a loss function based on the projection points and the parameters to be optimized includes:
[0022] Construct the difference terms between each projection point and the center of the bottom surface and the radius of the bottom surface;
[0023] Perform normalization processing on the difference terms of all projection points to construct a loss function.
[0024] In an alternative embodiment, the step of constructing the difference terms between each of the projection points, the center of the bottom surface, and the bottom surface radius includes:
[0025] Calculate the first distance between each of the projection points and the center of the bottom surface, and square the first distance to obtain the first squared term;
[0026] Calculate the difference between the first squared term and the square of the bottom surface radius, and square the difference to obtain the second squared term;
[0027] Accumulate the second squared terms corresponding to all the projection points to obtain the difference term.
[0028] In an alternative embodiment, the step of performing gradient descent processing based on the loss function for multiple iterations until optimized parameters are obtained when a preset requirement is met includes:
[0029] Perform gradient descent processing based on the loss function for multiple iterations. In each iteration, obtain the parameters for the current iteration based on the parameters obtained in the previous iteration and the gradient of the loss function in the current iteration;
[0030] Until the loss function converges or the number of iterations reaches the preset maximum number, obtain the finally optimized parameters.
[0031] In an alternative embodiment, the parameters to be optimized include the coordinates of the center of the bottom surface and the bottom surface radius;
[0032] The step of obtaining the parameters for the current iteration based on the parameters obtained in the previous iteration and the gradient of the loss function in the current iteration includes:
[0033] Based on the coordinates of the center of the bottom surface obtained in the previous iteration and the gradient of the loss function with respect to the coordinates of the center of the bottom surface in the current iteration, calculate the coordinates of the optimized center of the bottom surface for the current iteration;
[0034] Based on the bottom surface radius obtained in the previous iteration and the gradient of the loss function with respect to the bottom surface radius in the current iteration, calculate the optimized bottom surface radius for the current iteration.
[0035] In a second aspect, the present invention provides a cylindrical point cloud parameter optimization device, and the device includes:
[0036] An acquisition module, configured to acquire the workpiece point cloud of the target workpiece, where the workpiece point cloud includes a cylindrical point cloud;
[0037] A segmentation module, configured to extract the point cloud on the cylinder surface from the cylindrical point cloud, and segment the point cloud on the cylinder surface to obtain the point cloud within a preset height range;
[0038] A projection module for projecting each three-dimensional point in a point cloud within a preset height range onto the bottom surface of a cylinder to obtain projection points;
[0039] An iterative optimization module for constructing a loss function based on the projection points and parameters to be optimized, and performing gradient descent processing based on the loss function for multiple iterations until optimized parameters are obtained when preset requirements are met.
[0040] In a third aspect, the present invention provides an electronic device, including one or more storage media and one or more processors communicating with the storage media. The one or more storage media store machine-executable instructions executable by the processor. When the electronic device runs, the processor executes the machine-executable instructions to perform the method according to any one of the foregoing embodiments.
[0041] In a fourth aspect, the present invention provides a computer-readable storage medium storing machine-executable instructions, and when the machine-executable instructions are executed, the method according to any one of the foregoing embodiments is implemented.
[0042] The present invention provides a method, device, electronic device, and readable storage medium for optimizing cylinder point cloud parameters. By obtaining a workpiece point cloud of a target workpiece, the workpiece point cloud includes a cylinder point cloud. Extract the point cloud belonging to the cylindrical surface in the cylinder point cloud, and segment the point cloud on the cylindrical surface to obtain a point cloud within a preset height range. Project each three-dimensional point in the point cloud within the preset height range onto the bottom surface of the cylinder to obtain projection points, construct a loss function based on the projection points and parameters to be optimized, and perform gradient descent processing based on the loss function for multiple iterations until optimized parameters are obtained when preset requirements are met. In this solution, by segmenting the point cloud within the preset height range on the cylindrical surface and performing parameter optimization operations based on the segmented point cloud, interference caused by noise points on the cylindrical surface to optimization can be excluded, and the accuracy of the optimization result can be improved. Description of the Drawings
[0043] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required to be used in the embodiments of the present invention. It should be understood that the following drawings only show some embodiments of the present invention, and thus should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0044] Figure 1 It is a flowchart of the method for optimizing cylinder point cloud parameters provided by the embodiment of the present invention;
[0045] Figure 2 It is a schematic diagram of the cylinder point cloud in the embodiment of the present invention;
[0046] Figure 3For Figure 1 Flow chart of the sub-steps included in S12 in
[0047] Figure 4 For Figure 3 Flow chart of the sub-steps included in S122 in
[0048] Figure 5 Schematic diagram of the point cloud and the projected point cloud segmented in the embodiment of the present invention;
[0049] Figure 6 For Figure 1 Flow chart of the sub-steps included in S14 in
[0050] Figure 7 For Figure 6 Flow chart of the sub-steps included in S14 in
[0051] Figure 8 For Figure 1 Flow chart of the sub-steps included in S15 in
[0052] Figure 9 Functional module block diagram of the cylindrical point cloud parameter optimization device provided by the embodiment of the present invention;
[0053] Figure 10 Structural block diagram of the electronic device provided by the embodiment of the present invention. Detailed implementation manners
[0054] Next, the technical solutions in the embodiments of the present invention will be described with reference to the accompanying drawings in the embodiments of the present invention.
[0055] Please refer to Figure 1 , which is a flow chart of the cylindrical point cloud parameter optimization method provided by the embodiment of the present invention. The cylindrical point cloud parameter optimization method can be executed by a cylindrical point cloud parameter optimization device, which can be implemented by software and / or hardware and can be configured in an electronic device. The electronic device can be a computer device or a controller, a processor, etc. in a robot. The detailed steps of the cylindrical point cloud parameter optimization method are introduced as follows.
[0056] S11, Obtain the workpiece point cloud of the target workpiece, where the workpiece point cloud includes a cylindrical point cloud.
[0057] S12, Extract the point cloud belonging to the cylindrical surface from the cylindrical point cloud, and segment the point cloud on the cylindrical surface to obtain the point cloud within a preset height range.
[0058] S13, Project each three-dimensional point in the point cloud within the preset height range onto the bottom surface of the cylinder to obtain a projected point.
[0059] S14, Construct a loss function based on the projected point and the parameter to be optimized.
[0060] S15. Perform gradient descent processing based on the loss function for multiple iterations until the optimized parameters are obtained when the preset requirements are met.
[0061] In this embodiment, the target workpiece can be any workpiece including a cylindrical structure. Therefore, the obtained workpiece point cloud includes a cylindrical point cloud. As Figure 2 shown, the cylindrical structure includes a cylindrical surface and two bottom surfaces. The parameters to be optimized include the coordinates of the center of the bottom surface of the bottom surface and the bottom radius. Before performing the optimization method provided in this embodiment, it can be considered that there are initial coordinates of the center of the bottom surface and the bottom radius. The initial coordinates of the center of the bottom surface and the bottom radius can be randomly set or can be initial values determined by other methods. This embodiment does not limit this.
[0062] In addition, in this embodiment, the direction vector of the cylindrical axis and the plane equation of the cylindrical bottom surface are also known, thus providing preliminary reference values for the optimization process. The direction vector of the cylindrical axis is approximately the normal vector of the plane of the bottom surface.
[0063] Based on the initial coordinates of the center of the bottom surface and the bottom radius, further optimization is performed using the optimization method provided in this embodiment to obtain the finally optimized coordinates of the center of the bottom surface and the bottom radius.
[0064] First, extract the point cloud belonging to the cylindrical surface from the cylindrical point cloud. Taking the direction where the cylindrical axis is located as the height direction, the point cloud on the cylindrical surface is segmented to obtain the point cloud within a preset height range. The preset height range can be set based on requirements. Its purpose is to effectively remove edge points or three-dimensional points that do not meet geometric requirements and reduce the impact of these noise points on the optimization accuracy.
[0065] In this way, using the retained point cloud within the preset height range to perform subsequent parameter optimization processing can ensure the accuracy of parameter optimization.
[0066] In this embodiment, the point cloud within the preset height range is projected onto the cylindrical bottom surface, and the optimization of the parameters to be optimized is realized based on the projected points. The optimization method can be to construct a loss function based on the projected points and the parameters to be optimized, and use the loss function as a guide to perform multiple iterations. Each time an iteration is performed, gradient descent processing is performed on the loss function to realize the update of the parameters. Until the preset requirements are met, the finally optimized parameters are obtained.
[0067] The cylindrical point cloud parameter optimization method provided in this embodiment can exclude the interference of noise points on the cylindrical surface to the optimization by segmenting the point cloud within the preset height range on the cylindrical surface and performing parameter optimization operations based on the segmented point cloud, thereby improving the accuracy of the optimization result.
[0068] Please refer toFigure 3 , in this embodiment, the step of segmenting the point cloud on the cylindrical surface to obtain the point cloud within a preset height range can be implemented in the following manner:
[0069] S121, project each three-dimensional point in the point cloud on the cylindrical surface onto the cylindrical axis to obtain corresponding projection points.
[0070] S122, based on the projection points corresponding to each of the three-dimensional points, segment the point cloud on the cylindrical surface within the preset height range.
[0071] In three-dimensional space, the cylindrical point cloud may not be completely vertical, that is, the direction vector of the cylindrical axis is not necessarily in the vertical direction. Therefore, if the point cloud on the cylindrical surface is segmented directly based on the height direction in three-dimensional space, what is segmented is the point cloud within a certain height range in three-dimensional space, rather than the point cloud within a certain height range based on the cylindrical point cloud itself as the reference object. For example, when the inclination of the cylindrical point cloud is relatively large, if the point cloud on the cylindrical surface is segmented based on the height information in three-dimensional space, some of the three-dimensional points in the segmented point cloud may be those with relatively close distances to the two bottom surfaces, some three-dimensional points may be those closer to one bottom surface and farther from the other bottom surface, and some three-dimensional points may also be those at the position where the bottom surface and the cylindrical surface are in contact. And the three-dimensional points at these positions are often likely to be noise points, which is not conducive to the accuracy of parameter optimization.
[0072] Therefore, if the point cloud on the cylindrical surface is segmented based on the height information in three-dimensional space, it may not be possible to exclude the noise points in the point cloud on the cylindrical surface, and further, when performing subsequent parameter optimization with the segmented point cloud, it will affect the accuracy of parameter optimization.
[0073] Based on the above considerations, in this embodiment, each three-dimensional point on the cylindrical surface is projected onto the cylindrical axis to obtain projection points. In this way, multiple pairs of corresponding three-dimensional points and projection points can be obtained. By screening the projection points on the cylindrical axis and determining the corresponding three-dimensional points based on the screened projection points, the point cloud on the cylindrical surface within the preset height range can be segmented.
[0074] In this embodiment, by projecting the three-dimensional points on the cylindrical surface onto the cylindrical axis and segmenting the point cloud on the cylindrical surface that meets the requirements based on the projection points on the cylindrical axis, regardless of whether the cylindrical point cloud is inclined or not, the interference of noise points on the cylindrical surface can be excluded, and the accuracy of parameter optimization can be improved.
[0075] Specifically, please refer to Figure 4 , in this embodiment, the step of segmenting the point cloud on the cylindrical surface within the preset height range based on the projection points corresponding to the three-dimensional points can be implemented in the following manner:
[0076] S1221. Obtain the projection values of each of the said projection points in the direction of the axis of the cylinder.
[0077] S1222. Screen out the projection points corresponding to the projection values within a preset height range.
[0078] S1223. Based on the screened-out projection points, segment the point cloud on the cylinder surface within the preset height range.
[0079] In this embodiment, there are multiple projection points on the axis of the cylinder. Taking one end of the direction of the axis of the cylinder as the positive direction and the other end as the negative direction, the projection points at both ends among the projection points are used as the maximum projection point and the minimum projection point. For example, the projection value of the minimum projection point can be set to 0, and based on the minimum projection point, the projection values of other projection points are determined. In this way, the projection values of each projection point can be obtained, and the minimum projection value and the maximum projection value among them can be determined.
[0080] Based on the minimum projection value and the maximum projection value, a preset height range can be set. For example, a maximum ratio threshold and a minimum ratio threshold can be set. The maximum threshold is obtained by multiplying the maximum ratio threshold by the maximum projection value, and the minimum threshold is obtained by multiplying the minimum ratio threshold by the maximum projection value. The preset height range is the range between the minimum threshold and the maximum threshold.
[0081] For example, assume the minimum projection value is 0, the maximum projection value is 9, the maximum ratio threshold is 2 / 3, and the minimum ratio threshold is 1 / 3. Then the minimum threshold is 3 and the maximum threshold is 6. The preset height range is [3, 6]. Screen out the projection points corresponding to the projection values within the preset height range.
[0082] And each of the screened-out projection points has a corresponding three-dimensional point on the cylinder surface. Therefore, based on the screened-out projection points, the corresponding three-dimensional points can be restored, and then the point cloud composed of the three-dimensional points on the cylinder surface within the preset height range can be segmented. In this way, the point cloud that may have noise points near the two bottom surfaces on the cylinder surface can be excluded. The segmented point cloud can more accurately describe the shape of the cylinder and provide more accurate input data for subsequent optimization algorithms.
[0083] In this embodiment, through the above method, the original three-dimensional point cloud data is converted into one-dimensional data, and screening is performed based on the one-dimensional projection values, which can greatly reduce the complexity of the screening process.
[0084] On this basis, project each three-dimensional point in the point cloud within the preset height range onto the bottom surface of the cylinder to obtain projection points. The cylinder includes two bottom surfaces, which can be divided into an upper bottom surface and a lower bottom surface. When performing the projection, the three-dimensional points can be projected onto any bottom surface, and the two bottom surfaces can be considered the same.
[0085] The bottom surface of the cylinder can usually be regarded as a plane. By projecting each three-dimensional point onto the plane, a new set of projected points is obtained. In this way, the geometric features of the point cloud will be transformed into the projected point cloud on the bottom surface. This approach can simplify the problem because the bottom surface of the cylinder is a relatively simple geometric structure, and the point cloud on this plane can be optimized using a simpler model.
[0086] As Figure 5 shown in [FIGURE REFERENCE], where the upper set of point clouds is the local circular point cloud on the cut-out cylindrical surface, and the arc-shaped point cloud below is the point cloud projected onto the bottom surface of the cylinder.
[0087] On this basis, a loss function is constructed based on the projected points and the parameters to be optimized. Please refer to Figure 6 , where the parameters to be optimized include the coordinates of the center of the bottom surface and the radius of the bottom surface. The construction of the loss function can be achieved through the following steps:
[0088] S141, construct the difference terms between each of the projected points, the center of the bottom surface, and the radius of the bottom surface.
[0089] S142, normalize the difference terms of all projected points to construct the loss function.
[0090] The error of the points on the bottom surface of the cylinder to the edge of the circle is minimized. The error of each point is obtained by subtracting the radius from the distance between the projected point projected onto the bottom surface of the cylinder and the center of the bottom surface. Therefore, the difference terms between each of the projected points, the center of the bottom surface, and the radius of the bottom surface can be constructed.
[0091] On this basis, in this embodiment, the difference terms of all projected points are normalized. The normalization method is to divide the cumulative value of the difference terms of all projected points by the total number of projected points. In this way, regardless of the size of the set of projected points, the cumulative value of the error can be balanced to a relatively fixed range. When the data volume of the set increases, the value of the loss function will not increase excessively due to the large data volume, thus avoiding the risk of unstable calculation.
[0092] Please refer to Figure 7 , where the difference terms between each of the projected points, the center of the bottom surface, and the radius of the bottom surface can be constructed through the following steps:
[0093] S1411, calculate the first distance between each of the projected points and the center of the bottom surface, and square the first distance to obtain the first squared term.
[0094] S1412, calculate the difference between the first squared term and the square of the radius of the bottom surface, and square the difference to obtain the second squared term.
[0095] S1413, accumulate the second squared terms corresponding to all projected points to obtain the difference term.
[0096] In this embodiment, the finally constructed loss function has the following form:
[0097]
[0098] where N represents the total number of projection points, p i represents the i-th projection point, c 2 represents the center of the bottom surface circle, and r 2 represents the radius of the bottom surface. Among them, c 2 and r 2 are parameters to be optimized.
[0099] In the loss function constructed in this embodiment, by squaring the first distance between the projection point and the center of the bottom surface respectively, squaring the radius of the bottom surface, then calculating the difference between the two squares, and finally squaring the difference.
[0100] Compared with the traditional loss function that only constructs the difference between the distance between a point and the center of the circle and the radius, the loss function in this embodiment can more precisely measure the square of the difference between the distance and the radius of the bottom surface, avoiding the influence of extreme values on the loss.
[0101] This loss function further squares the difference of the square terms. Actually, for the points close to the optimization targets (i.e., the center of the circle and the radius), the penalty is relatively smooth. It can better ensure the smoothness of the gradient. Especially when the point set of the projection points is far from the center of the circle, the change can be relatively gentle, and the optimization process is not easily trapped in an unstable state due to the drastic change of the gradient. While in the traditional loss function, when the error is less than 1, the change of the loss function is very small, and the optimization process may not be sensitive enough to small errors. The optimized loss function in this embodiment can effectively avoid this situation.
[0102] In this embodiment, the loss function makes the optimization process more stable and the processing of small errors more accurate by means of standardization, improving the measurement method of the fitting degree, smoothing the gradient, etc. This helps to improve the convergence of the gradient descent method and the accuracy of the final result.
[0103] Please refer to Figure 8 , based on the constructed loss function, perform gradient descent processing on the loss function to optimize the parameters. This step can be implemented in the following way:
[0104] S151, perform gradient descent processing based on the loss function for multiple iterations. In each iteration, obtain the parameters of this iteration according to the parameters obtained in the previous iteration and the gradient of the loss function in the current iteration.
[0105] S152. Until the loss function converges or the number of iterations reaches the preset maximum number, the finally optimized parameters are obtained.
[0106] In each round of iteration, the parameters obtained in the current round of iteration are determined based on the parameters obtained in the previous round of iteration and the gradient of the loss function in the current round of iteration. After multiple rounds of iteration like this, when the loss function converges or the number of iterations reaches the preset maximum number, the iteration can be stopped and the finally optimized parameters can be determined.
[0107] Among them, the way to judge whether the loss function converges can be to calculate whether the difference between the function value of the loss function in the current round of iteration and the function value of the loss function in the previous round of iteration is less than the preset threshold. If it is less than the preset threshold, it can be determined that the loss function converges, which is expressed as follows:
[0108] |L new -L old |<tol
[0109] Among them, L new represents the function value of the loss function in the current round of iteration, L old represents the function value of the loss function in the previous round of iteration, and tol represents the set preset threshold.
[0110] As can be seen from the above, the parameters to be optimized include the coordinates of the center of the bottom surface and the radius of the bottom surface. Therefore, in each round of iteration, the center of the bottom surface and the radius of the bottom surface need to be optimized separately.
[0111] Specifically, in each round of iteration, according to the coordinates of the center of the bottom surface obtained in the previous round of iteration and the gradient of the loss function with respect to the coordinates of the center of the bottom surface in the current round, the coordinates of the optimized center of the bottom surface in the current round are calculated.
[0112] In addition, in each round of iteration, according to the radius of the bottom surface obtained in the previous round of iteration and the gradient of the loss function with respect to the radius of the bottom surface in the current round, the radius of the bottom surface after the current round of iteration is calculated.
[0113] In this embodiment, based on the above constructed loss function, in each round of iteration, the gradient of the loss function with respect to the center of the bottom surface is obtained by taking the partial derivative of the center of the bottom surface, and the calculation method is as follows:
[0114]
[0115] Because:
[0116]
[0117] And because:
[0118]
[0119] Therefore, substituting it into the formula gives:
[0120]
[0121] In addition, the gradient of the loss function with respect to the bottom radius is obtained by taking the partial derivative with respect to the bottom radius, and the calculation method is as follows:
[0122]
[0123] In each round of iteration, the bottom center of the circle is updated as follows:
[0124]
[0125] In each round of iteration, the bottom radius is updated as follows:
[0126]
[0127] Among them, represents the bottom center of the circle and the bottom radius obtained in the t-th iteration, represents the bottom center of the circle and the bottom radius obtained in the (t + 1)-th iteration. α 1 and α 2 represent the learning rate (step size), which determines the step size of each iteration.
[0128] In the above way, multiple rounds of iteration are performed on the bottom center of the circle and the bottom radius until the final optimized bottom center of the circle and bottom radius are obtained when certain requirements are met.
[0129] The method for optimizing the cylinder point cloud parameters provided in this embodiment projects the cylinder point cloud onto the cylinder axis, combines the preset ratio threshold, and accurately segments the cylinder point cloud part excluding noise points, thereby improving the accuracy of point cloud segmentation. Using the projection method to convert the segmented cylinder point cloud to the cylinder bottom surface not only maintains the geometric characteristics of the point cloud but also effectively reduces the number of point clouds, providing accurate data support for subsequent center and radius optimization.
[0130] In addition, by optimizing the center coordinates and radius through the gradient descent algorithm, the loss function is designed based on the geometric error between the projected points and the circle, effectively improving the accuracy and convergence of the optimization. In the design of the loss function, the weighted sum of the squared errors suppresses outliers, making the algorithm have a certain robustness to noise points. Even if the point cloud data is unevenly distributed or there are discrete points locally, this algorithm can still obtain reliable center coordinates and radii.
[0131] In summary, this algorithm can be applied to the processing of point cloud data of various cylindrical objects, such as pipeline detection, 3D reconstruction of industrial parts, etc., and has strong practicality and universality.
[0132] Based on the same inventive concept, please refer to Figure 9 , an embodiment of the present invention further provides a schematic diagram of functional modules of a cylindrical point cloud parameter optimization device. In this embodiment, the functional modules of the cylindrical point cloud parameter optimization device can be divided according to the above method embodiment. For example, each functional module can be corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. It should be noted that the division of modules in the embodiment of the present invention is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0133] For example, in the case of dividing each functional module corresponding to each function, Figure 9 the shown cylindrical point cloud parameter optimization device is only a schematic diagram of a device. The cylindrical point cloud parameter optimization device can include an acquisition module, a segmentation module, a projection module, and an iterative optimization module. The functions of each functional module of the cylindrical point cloud parameter optimization device will be elaborated in detail below.
[0134] The acquisition module is used to acquire the workpiece point cloud of the target workpiece, and the workpiece point cloud includes cylindrical point cloud;
[0135] The segmentation module is used to extract the point cloud on the cylinder surface in the cylindrical point cloud, and segment the point cloud on the cylinder surface to obtain the point cloud within a preset height range;
[0136] The projection module is used to project each three-dimensional point in the point cloud within the preset height range onto the bottom surface of the cylinder to obtain projection points;
[0137] The iterative optimization module is used to construct a loss function based on the projection points and the parameters to be optimized, and perform gradient descent processing based on the loss function for multiple iterations until the optimized parameters are obtained when the preset requirements are met.
[0138] It can be understood that the above acquisition module, segmentation module, projection module, and iterative optimization module can be used to execute the above S11 to S15. The detailed implementation manners of the acquisition module, segmentation module, projection module, and iterative optimization module can refer to the content related to the above S11 to S15.
[0139] In a possible implementation manner, the above segmentation module can be used to:
[0140] Project each three-dimensional point in the point cloud on the cylinder surface onto the cylinder axis to obtain corresponding projection points;
[0141] Based on the projection points corresponding to each three-dimensional point, segment the point cloud on the cylinder surface within the preset height range.
[0142] In one possible implementation, the above-mentioned segmentation module can be specifically used for:
[0143] Obtain the projection values of each of the projection points in the direction of the cylinder axis;
[0144] Filter out the projection points corresponding to the projection values within a preset height range;
[0145] Based on the filtered projection points, segment the point cloud on the cylinder surface within the preset height range.
[0146] In one possible implementation, the above-mentioned iterative optimization module can be used for:
[0147] Construct the difference terms between each of the projection points and the center of the bottom surface and the radius of the bottom surface;
[0148] Normalize the difference terms of all projection points to construct a loss function.
[0149] In one possible implementation, the above-mentioned iterative optimization module can be specifically used for:
[0150] Calculate the first distance between each of the projection points and the center of the bottom surface, and square the first distance to obtain a first squared term;
[0151] Calculate the difference between the first squared term and the square of the radius of the bottom surface, and square the difference to obtain a second squared term;
[0152] Accumulate the second squared terms corresponding to all projection points to obtain a difference term.
[0153] In one possible implementation, the above-mentioned iterative optimization module can be used for:
[0154] Perform gradient descent processing based on the loss function for multiple iterations. In each iteration, obtain the parameters of the current iteration according to the parameters obtained in the previous iteration and the gradient of the loss function in the current iteration;
[0155] Until the loss function converges or the number of iterations reaches a preset maximum number, obtain the finally optimized parameters.
[0156] In one possible implementation, the above-mentioned iterative optimization module can be used for:
[0157] According to the coordinates of the center of the bottom surface obtained in the previous iteration and the gradient of the loss function with respect to the coordinates of the center of the bottom surface in the current iteration, calculate the coordinates of the optimized center of the bottom surface in the current iteration;
[0158] Calculate the optimized bottom surface radius of the current iteration based on the bottom surface radius obtained in the previous iteration and the gradient of the loss function with respect to the bottom surface radius in the current iteration.
[0159] Please refer to Figure 10 , which is the structural block diagram of the electronic device provided by the embodiment of the present invention. The electronic device can be a computer device communicating with the robot, or a controller, a processor, etc. in the robot. The electronic device includes a memory, a processor, and a communication module. Each element of the memory, the processor, and the communication module is directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines.
[0160] Among them, the memory is used to store computer programs or data. The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc.
[0161] The processor is used to read / write the data or programs stored in the memory and execute the cylindrical point cloud parameter optimization method provided by any embodiment of the present invention.
[0162] The communication module is used to establish a communication connection between the electronic device and other communication terminals through the network and is used to send and receive data through the network.
[0163] It should be understood that Figure 10 The structure shown is only a schematic diagram of the structure of the electronic device, and the electronic device may further include more or fewer components than those shown in Figure 10 , or have a different configuration from that shown in Figure 10 .
[0164] Furthermore, the embodiment of the present invention further provides a computer-readable storage medium, and the computer-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed, the cylindrical point cloud parameter optimization method provided by the above embodiment is realized.
[0165] Specifically, the computer-readable storage medium can be a general storage medium, such as a removable disk, a hard disk, etc. When the computer program on the computer-readable storage medium runs, it can execute the above-mentioned cylindrical point cloud parameter optimization method. Regarding the process involved when the computer and its executable instructions in the computer-readable storage medium run, reference can be made to the relevant descriptions in the above method embodiments, which will not be elaborated here.
[0166] In the embodiments provided by the present invention, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces. The indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.
[0167] In addition, the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0168] Furthermore, in each embodiment of the present invention, the various functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0169] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs, etc., which can store program codes.
[0170] In this document, relational terms such as first and second are used solely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0171] The above description is only for the embodiments of the present invention and is not intended to limit the protection scope of the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A cylindrical point cloud parameter optimization method, characterized in that: The method comprises: Acquire a workpiece point cloud of a target workpiece, wherein the workpiece point cloud includes a cylindrical point cloud; Extracting the point cloud belonging to the cylindrical surface from the cylindrical point cloud, and segmenting the point cloud on the cylindrical surface to obtain point clouds within a preset height range; Projecting each 3D point in the point cloud within a preset height range onto the bottom surface of the cylinder to obtain a projection point; A loss function is constructed based on the projection points and the parameters to be optimized, and a gradient descent process is performed based on the loss function for multiple iterations until the optimized parameters are obtained when preset requirements are met.
2. The cylindrical point cloud parameter optimization method according to claim 1, characterized in that: The step of segmenting the point cloud on the cylinder to obtain a point cloud within a preset height range includes: Project each 3D point in the point cloud on the cylinder surface onto the cylinder axis to obtain the corresponding projection point; Based on the projection points corresponding to the three-dimensional points, a point cloud within a preset height range on the cylindrical surface is segmented.
3. The cylindrical point cloud parameter optimization method according to claim 2, characterized in that: The step of segmenting the point cloud on the cylindrical surface within a preset height range based on the projection points corresponding to the three-dimensional points comprises: Obtaining the projection value of each projection point in the direction of the cylindrical axis; Filter out projection points corresponding to projection values within a preset height range; The point cloud within a preset height range on the cylindrical surface is segmented based on the screened projection points.
4. The cylindrical point cloud parameter optimization method according to claim 1, characterized in that: The parameters to be optimized include the coordinates of the center of the bottom circle and the radius of the bottom circle; The step of constructing a loss function based on the projection points and the parameters to be optimized includes: Constructing the difference terms between each of the projection points and the center and radius of the bottom surface; The difference items of all projection points are standardized to construct the loss function.
5. The cylindrical point cloud parameter optimization method according to claim 4, characterized in that: The step of constructing the difference terms between each of the projection points and the bottom circle center and the bottom radius comprises: Calculating a first distance between each of the projection points and the center of the bottom circle, and squaring the first distance to obtain a first square term; Calculating a difference between the first square term and the square of the base radius, and squaring the difference to obtain a second square term; The second square terms corresponding to all projection points are accumulated to obtain the difference term.
6. The cylindrical point cloud parameter optimization method according to claim 1, characterized in that: The step of performing gradient descent processing based on the loss function for multiple iterations until the optimized parameters are obtained when the preset requirements are met includes: Performing a gradient descent process based on the loss function for multiple iterations, in each round of iteration, obtaining parameters for the current round of iteration according to the parameters obtained in the previous round of iteration and the gradient of the loss function in the current round; When the loss function converges or the number of iterations reaches a preset maximum number, the final optimized parameters are obtained.
7. The cylindrical point cloud parameter optimization method according to claim 6, characterized in that: The parameters to be optimized include the coordinates of the center of the bottom circle and the radius of the bottom circle; The step of obtaining the parameters of the current round of iteration according to the parameters obtained in the previous round of iteration and the gradient of the loss function in the current round includes: The coordinates of the center of the bottom circle after optimization in the current round are calculated according to the coordinates of the center of the bottom circle obtained in the previous round of iteration and the gradient of the loss function with respect to the coordinates of the center of the bottom circle in the current round; The bottom radius after optimization in the current round is calculated based on the bottom radius obtained in the previous round of iterations and the gradient of the loss function with respect to the bottom radius in the current round.
8. A cylindrical point cloud parameter optimization device, characterized in that: The device comprises: An acquisition module, used for acquiring a workpiece point cloud of a target workpiece, wherein the workpiece point cloud includes a cylindrical point cloud; A segmentation module, used for extracting the point cloud on the cylindrical surface in the cylindrical point cloud, and segmenting the point cloud on the cylindrical surface to obtain a point cloud within a preset height range; A projection module, used to project each three-dimensional point in the point cloud within a preset height range onto the bottom surface of the cylinder to obtain a projection point; The iterative optimization module is used to construct a loss function based on the projection points and the parameters to be optimized, and to perform gradient descent processing based on the loss function for multiple iterations until the optimized parameters are obtained when the preset requirements are met.
9. An electronic device, characterized in that: The electronic device comprises one or more storage media and one or more processors communicating with the storage media, wherein the one or more storage media store machine executable instructions executable by the processors, and when the electronic device is running, the processor executes the machine executable instructions to execute the method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed, the method according to any one of claims 1 to 7 is implemented.