Abstract
Industrial pipelines are frequently scanned with 3D imaging systems (e.g., LADAR) and cylinders are fitted to the collected data. Then, the fitted as-built model is compared with the as-designed model. Meaningful comparison between the two models requires estimates of uncertainties of fitted model parameters. In this paper, the formulas for variances of cylinder parameters fitted with Nonlinear Least Squares to a point cloud acquired from one scanning position are derived. Two different error functions used in minimization are discussed: the orthogonal and the directional function. Derived formulas explain how some uncertainty components are propagated from measured ranges to fitted cylinder parameters.
Keywords: 3D imaging systems, cylinder fitting, directional error function, Nonlinear Least Square fitting, orthogonal error function
1. Introduction
Digital representation of an object’s surface is important in many engineering applications. Examples include: manufacturing, modular construction, and preservation of historical artifacts. Frequently, the data needed for such representation are collected with 3D imaging systems. The systems are non-contact, line-of-sight instruments which provide range images r(ϑ, φ) of the object’s surface, where r denotes the distance (measured as a time of flight) from an instrument to a point on a surface, and ϑ and φ are the elevation and the azimuth angles to that point. The scanning process is very fast and current systems can collect datasets containing hundreds of thousands of points within a few seconds [1]. Points collected from a surface may be used to build a 3D geometrical model of a scanned object. For example, a cylinder is frequently modeled in projects where industrial pipelines are scanned [2–5]. Frequently, Nonlinear Least Square (NLS) methods [6–10] are used to fit a model to its corresponding point cloud. An important issue is how to propagate an instrument uncertainty (for example: uncertainty of measured ranges r) to the uncertainties of fitted cylinder parameters. These uncertainties are essential in a quality control process when the as-built model (derived from the point cloud) is checked against the as-designed (theoretical) model [11]. The tolerances used in the design process and the uncertainties of the fitted model parameters are both needed to accept the as-built model. For example, the uncertainties of the fitted coefficients of the cylinder centerline are needed to check, with a given confidence, if two pipes are parallel or to check the plumbness of a cylinder column.
It is commonly accepted by manufacturers and users of 3D imaging systems that the uncertainty of a j-th measured point Pj(X,Y,Z) is caused mainly by an uncertainty of the measured range rj; an impact of angular uncertainty can be neglected and both the elevation and the azimuth angles of Pj are treated as noise-free parameters. Under this assumption, the closed formulas for variances (i.e., squared standard deviations) of cylinder parameters fitted to data acquired from one scanning location are provided. These variances are an important component in evaluating measurement uncertainty.
The choice of an error function for NLS minimization is a delicate matter. It was shown that the orthogonal error function, which is commonly used in commercial software, yields results that are in disagreement with experiment when a plane is fitted to a point cloud acquired in some experimental conditions [12]. Another error function, the directional error function, gives results that are, on average, in a much better agreement with experiment. Therefore, in this paper, closed formulas for variances of fitted cylinder parameters are derived for both orthogonal and directional error functions. Both error functions depend on four fitting variables: three angles {ϑ, φ, ρ} which determine a cylinder centerline orientation in space, and the distance L of a centerline to the origin of a coordinate system.
2. Variances of Fitted Cylinder Parameters
Points Pj(X, Y, Z) on a surface of an infinitely long regular cylinder of radius R satisfy the following equation
(1) |
where the cylinder centerline M is
(2) |
w(ϑ, φ) is a unit vector in the direction of the axis, parameterized by two angles: the elevation ϑ and the azimuth φ, and × stands for a cross product of two vectors. Therefore, the Cartesian coordinates of w(ϑ, φ) may be written as
(3) |
L is any fixed point on the axis and q is a number defining a location of arbitrary point on the line M. It is convenient to choose L in such a way that its length L = ‖L‖ is the shortest [5]. This happens when L and w are perpendicular and their dot product is zero, L·w = 0. In this setting, L is the distance of the cylinder centerline M from the origin of the coordinate system. The origin and the orientation of the coordinate system (in which experimental points Pj are acquired) are defined by the location and the orientation of a scanner. Vector L may be parameterized as
(4a) |
where a unit vector l lies on a plane perpendicular to w and
(4b) |
The unit vectors u and v, together with the vector w, form the right-handed orthonormal basis {u, v, w}
(5a) |
(5b) |
Vectors u and v can be parameterized as follows
(6a) |
(6b) |
The angle ρ in Eq. (4b) defines two coordinates of the unit vector l on the 2D plane perpendicular to w, as shown in Fig. 1. It is easy to check that in this parameterization there are two equivalent sets of parameters defining the same centerline M: {ϑ, φ, ρ, L} and {−ϑ, φ + π, π − ρ, L} which correspond to vectors w and −w.
Fig. 1.
Parameterization of a cylinder for fitting to range data. Unit vectors u,v, and l lie on a plane perpendicular to the unit vector w. Angle ρ is measured between vectors u and l.
Point Pj from Eq. (1) may be written as
(7) |
where rj is a range and a unit vector pj is equal to
(8) |
It is also convenient to introduce a vector dj
(9) |
Now, using the above introduced vector dj together with Eqs. (4) and (5), Eq. (1) can be expressed as
(10) |
Thus, in this parameterization, a regular cylinder of radius R is defined by four parameters: three angles ϑ, φ, ρ and the distance L (in this and the next two sections, a radius R is treated as a known constant; later in Section V this restriction is removed for the orthogonal fitting). Due to imperfections in range measurement, experimental points Pj do not lie exactly on a cylinder surface. Therefore, a model of a cylinder has to be fitted to the experimental dataset P{N} = {Pj, j = 1,…, N}, where N denotes the number of points. Within the framework of the Least Squares method, the estimated parameters of a cylinder {ϑ*, φ*, ρ*, L*} are obtained by minimizing the error function
(11) |
where Ej is the squared distance between the experimental point Pj and its corresponding theoretical point on a cylinder surface. Different definitions of the theoretical point yield different error functions. In this paper we study two error functions: the orthogonal error function EO and the directional error function ED, as explained in Figs. 2 and 3 and in the next two sections. The elements of a gradient of the error function ∇E can be calculated as
(12) |
Fig. 2.
Schematic drawing (top view, along the cylinder centerline M) explaining the calculation of the orthogonal error function.
Fig. 3.
Schematic drawing (top view, along the cylinder centerline M) explaining the calculations of the directional error function. Point Pj illustrates the configuration when a ray intersects with the cylinder surface (hj < R) while point Pk illustrates when there is no intersection (hk > R).
The knowledge of closed formulas for a gradient ∇E allows application of efficient minimization algorithms to find the fitted parameters {ϑ*, φ*, ρ*, L*}. Their values depend solely on the experimental dataset P{N}, i.e.,
(13) |
The variances of the fitted cylinder parameters var(ϑ*), var(φ*), var(ρ*), and var(L*) may be calculated following the same general approach developed originally for fitting a sphere to range data [13]. Here, similarly as in the previous study, only range uncertainty is considered and the bearings (ϑj, φj) of acquired j-th point Pj are treated as noise-free parameters. For other types of instruments, for example coordinate measuring machines (CMM), the above assumption may not be valid and the formulas for variances of fitted cylinder parameters developed in this paper may not be applicable. In addition, it is assumed that measured range rj is not correlated with rk for any j ≠ k. When both assumptions are valid, the variances of the fitted cylinder parameters may be estimated by applying to Eq. (13) the uncertainty propagation formula [14]
(14) |
For every j, the sensitivity vector Sj(P{N})
(15) |
can be evaluated by solving the following 4×4 system of linear equations
(16) |
where the vector Vj is defined by
(17) |
while H is 4×4 Hessian matrix which elements are given by
(18) |
3. Orthogonal Fitting
When fitting a cylinder using the orthogonal error function (see Fig. 2) the theoretical point corresponding to the experimental point Pj is defined as the orthogonal projection of Pj on a cylinder surface. Thus, Eq. (11) takes the form
(19) |
where Qj is a distance of point Pj to the cylinder axis M, which can be evaluated from Eq. (10)
(20) |
Defining the scalar functions aj and bj by means of Eqs. (3), (5), (8), (9) and using the properties of the dot and cross products,
(21a) |
(21b) |
the distance Qj from Eq. (20) may be written as
(22) |
Explicit expressions for the gradient ∇EO may be obtained by inserting Eq. (22) into Eq. (19) and using Eq. (12). The minimum can be found numerically using gradient ∇EO. Then, Eqs. (17) and (18) can be applied to Eq. (19) to get the vector Vj and the matrix HO. Once the sensitivity vector Sj is evaluated from Eq. (16), the variances of fitted cylinder parameters for can be calculated from Eq. (14).
4. Directional Fitting
When fitting a cylinder using the directional error function, see Fig. 3, the theoretical point Tj corresponding to the experimental point Pj is defined as an intersection of a ray originating from the instrument and passing through Pj with the cylinder surface
(23) |
where the function tj(ϑ, φ, ρ, L, Pj) has its value close to one when optimization variables are close to their best-fit values and the theoretical points Tj satisfy Eq. (1) of the cylinder
(24) |
A ray need not always intersect a cylinder surface – a similar situation occurs in the directional fitting of a sphere [15]. Whether there is an actual intersection or not can be checked by calculating the distance hj between the cylinder centerline M given by Eq. (2) and a ray passing through Pj; if hj < R, then there is an intersection and the theoretical point on a cylinder surface is defined by Eq. (23). Otherwise, if hj ≥ R, there is no intersection and the theoretical point Tj is defined as a point on a cylinder surface which has the smallest distance to a ray passing through Pj. Assuming that a ray is not parallel to the cylinder centerline M (in which case hj = L), the distance function hj(ϑ, φ, ρ, L, pj) can be calculated as
(25) |
Using a definition of the vectors L, l, w, v and u given in Eqs. (3)–(6), function aj in Eq. (21a) and the property of the triple vector product, the distance function hj can be evaluated as
(26) |
The j-th term in Eq. (11) corresponding to the directional error function ED is a squared distance between the experimental point Pj and the theoretical point Tj, see Fig. 3, giving
(27) |
For the case when hj < R, Ej can be evaluated using the function tj (ϑ, φ, ρ, L, Pj) which is derived in the Appendix, Eqs. (A1)–(A5). When hj ≥ R, Ej can be evaluated using hj(ϑ, φ, ρ, L, pj) from Eq. (26) and sj(ϑ, φ, ρ, L, Pj) which is derived in the Appendix, Eqs. (A6)–(A10), giving
(28) |
From Eq. (28), the j-th term in Eq. (12) for the components of the gradient of the directional error function ∇ED can be evaluated
(29) |
The minimum can be found numerically using gradient ∇ED. Then, Eqs. (17) and (18) can be applied to ED and Eq. (29) to get the equations for the vector Vj and the Hessian matrix HD. Once the sensitivity vector Sj is evaluated from Eq. (16), the variances of fitted cylinder parameters for can be calculated from Eq. (14).
The derivatives of tj, sj, and hj can be calculated from their definitions. Although the derivative of hj is not defined when hj = 0, hj enters into a j-th term of ED only when hj > R, as follows from Eq. (28). Thus, hj is differentiable in the whole domain where experimental conditions are valid.
5. Discussion
So far, only four fitting variables {ϑ, φ, ρ, L} were used and the radius of a cylinder R was treated as a known constant. When the radius is unknown and needs to be fitted, the orthogonal error function EO in Eq. (19) may be still effectively minimized in four dimensional space {ϑ, φ, ρ, L} [5]. This is possible because the radius R enters Eq. (19) in a quadratic term. Since a gradient of the error function must be zero when the minimum of EO is reached, the radius R can be evaluated from the condition
(30) |
Substituting for EO Eq. (19), the radius R may be calculated as
(31) |
where Qj is calculated in Eq. (22). Equation (31) has a simple geometric interpretation: the fitted radius R* is the algebraic mean of distances of all experimental points Pj from the fitted cylinder centerline defined by . The variance of the fitted radius can be calculated by applying to Eq. (31) the uncertainty propagation formula [14]
(32) |
Individual derivatives are calculated at fitted values by inserting Eq. (31) into (32) and using derivatives of Qj. Individual variances var (α*) of the fitted parameters are calculated in Eq. (14) using the formulas derived in Section III for the orthogonal fitting.
Unfortunately, the above strategy for fitting the unknown cylinder radius R cannot be applied to the directional fitting because a j-th term in the directional error function ED depends on R in a more complex way and a convenient separation of fitting variables as in Eq. (31) is not possible.
Closed formulas for variances derived in this paper are applicable to a cylinder fitted to a point cloud acquired from only one scanning location. When two or more datasets acquired from different locations are registered together, the formulas presented here cannot be used. This limitation has its root in the way range uncertainties are propagated into uncertainties of fitted parameters: the registration process makes relatively straightforward formulas much more complicated, with variances explicitly depending on the registration parameters. It remains an open question whether fitting a model to one large point cloud consisting of many registered datasets has an advantage over fitting a model to many unregistered clouds.
The difference between the orthogonal and the directional fitting becomes more important for point clouds containing many points acquired at large angle of incidence (i.e., AOI - the angle between a ray coming through the data point Pj and a normal to the cylinder surface at the theoretical point Tj defined in Eq. (23)). Scanning industrial pipelines (where a length of a scanned pipe may be larger than the fitting variable L) may yield a dataset in which AOIs are varying in a large range. Then, the orthogonal fitting may generate a cylinder centerline which is biased and incorrect. In order to quantify the expected differences between both error functions, further research involving computer simulations and field measurements is needed.
Biography
About the author: Marek Franaszek is a physicist in the Intelligent Systems Division of the NIST Engineering Laboratory. His current research interests include mathematical modeling and algorithm development for processing data acquired with 3D imaging systems. The National Institute of Standards and Technology is an agency of the U.S. Department of Commerce.
6. Appendix
This Appendix contains expressions needed for evaluating the directional error function ED, defined in Eq. (28). The individual j-th term of ED depends on the distance hj between the cylinder centerline M and a ray passing through data point Pj. Let us first consider the case when hj, given by Eq. (26), is less than the cylinder radius R. Eqs. (27) and (24) lead to the following equation for tj
(A1) |
where tj depends on Pj and parameters determining M, i.e., ϑ, φ, ρ, and L. By squaring both sides of Eq. (A1) and using the definitions of aj and bj from Eqs. (21a) and (21b), the following quadratic equation for tj is obtained
(A2) |
This quadratic equation has two solutions. From a definition of the theoretical point Tj in Eq. (23), it follows that only tj > 0 has a physical meaning. Two different experimental settings for collecting data points P{N} need to be distinguished: a) when a cylinder (for example, a pipe) is scanned from the outside; and b) when scanning is done from inside (for example, in a tunnel or inside a containment vessel for a nuclear reactor).
In the first case, L > R and bj defined in Eq. (21b) is always positive (aj from Eq. (21a) is always positive, regardless of a scanner location). Then, from the two real solutions of Eq. (A2), a physical meaning exists only for the smaller one which corresponds to the intersection of a ray with a cylinder surface closer to a scanner location (the origin of coordinates), as shown in Fig. 3. It is useful to define an auxiliary function Δj(ϑ, φ, ρ, L, pj) as
(A3) |
Substituting Δj in the solution of quadratic Eq. (A2) yields the expression for tj as a function of experimental point Pj and fitting variables
(A4) |
In the second case, when scanning is done from inside a cylinder and L < R, Δj in Eq. (A3) is always positive and . However, the sign of bj may now vary. Since the requirement that tj is positive must be uphold, the solution for tj takes now the following form
(A5) |
Once tj is known, a j-th term in the directional error function ED can be calculated for the case when hj < R according to Eq. (28).
When hj ≥ R, scanning can be done only from outside and a ray passing through Pj does not intersect with a cylinder surface; then quadratic Eq. (A2) does not have a real solution and tj cannot be determined. In such a case, a point Gj on a ray is sought which has the smallest distance to the cylinder centerline M, that is
(A6) |
The actual value of sj can be evaluated by finding a minimum of a squared distance of Gj to M,
(A7) |
where w is given by Eq. (3) and L by Eqs. (4a) and (4b). Using the properties of multiple dot and cross products, Eqs. (5), (6), and (21), Uj can be expressed as
(A8) |
For fixed cylinder parameters ϑ, φ, ρ, L and a given data point Pj, a minimum of Uj can be found from the condition
(A9) |
Substituting Eq. (A8) into (A9), the explicit dependence of sj on fitting variables can be determined
(A10) |
The distance hj defined in Eq. (26) together with sj provided in Eq. (A10) are used to calculate a j-th term in the directional error function ED when hj ≥ R, according to Eq. (28).
7. References
- [1].SPAR 3D Imaging and Positioning for Design, Construction, Manufacturing. 2009 http://sparllc.com/spar2009.php?page=presentations.
- [2].Eberly D. Fitting 3D Data with a Cylinder. 2003 http://www.geometrictools.com/Documentation/CylinderFitting.pdf.
- [3].Kwon SW, Liapi KA, Haas CT, Bosche F. Algorithms for fitting cylindrical objects to sparse range point clouds for rapid workspace modeling; ISARC; Eindhoven,Netherlands. 2003. pp. 173–178. [Google Scholar]
- [4].Chaperon T, Goulette F. Extracting Cylinders in Full 3D Data Using a Random Sampling Method and the Gaussian Image; Proceedings of the Vision Modeling and Visualization Conference; Stuttgart, Germany. 2001. pp. 35–42. [Google Scholar]
- [5].Lukacs G, Martin R, Marshall D. Faithful Least-Squares Fitting of Spheres, Cylinders, Cones and Tori for Reliable Segmentation; 5th European Conference on Computer Vision vol I of LNCS 1406; Freiburg. 1998. pp. 671–686. [Google Scholar]
- [6].Davidson AC. Statistical Models. Cambridge: Cambridge University Press; 2003. http://dx.doi.org/10.1017/CBO9780511815850. [Google Scholar]
- [7].Draper NR, Smith H. Applied Regression Analysis. 2nd ed. New York: Wiley; 1981. [Google Scholar]
- [8].Freedman DA. Statistical Models,Theory and Practice. revised ed. Cambridge: Cambridge University Press; 2009. http://dx.doi.org/10.1017/CBO9780511815867. [Google Scholar]
- [9].Himmelblau DM. Process Analysis by Statistical Methods. New York: Wiley; 1970. [Google Scholar]
- [10].Kanatani K. Statistical Optimization for Geometric Computation. New York: Elsevier; 1996. [Google Scholar]
- [11].Turkan Y, Bosche F, Haas CT, Haas R. Towards automated progress tracking of erection of concrete structures; 6th International Conference on Innovation in Architecture, Engineering and Construction AEC; State College, Pennsylvania. 2010. [Google Scholar]
- [12].Franaszek M, Cheok GS, Saidi KS. Experimental Verification of Formulas For Variances of Plane Parameters Fitted to Three-Dimensional Imaging Data. IEEE Trans. Instrum. Meas. 2011 in print. [Google Scholar]
- [13].Witzgall C, Franaszek M. Sensitivities and Variances for Fitted Parameters of Spheres. :2009. http://www.bfrl.nist.gov/861/CMAG/publications/, NIST IR 7616.
- [14].GUM Evaluation of measurement data - Guide to the expression of uncertainty in measurement. 2008 http://www.bipm.org/en/publications/guides/gum.html, JCGM. [Google Scholar]
- [15].Franaszek M, Cheok GS, Saidi KS, Witzgall C. Fitting Spheres to Range Data From 3-D Imaging Systems. IEEE Trans Instrum Meas. 2009;58:3544–3553. http://dx.doi.org/10.1109/TIM.2009.2018011. [Google Scholar]