Constrained curve and surface fitting Simon Flöry FSP-Meeting Strobl (June 20, 2006), floery@geoemtrie.tuwien.ac.at, Vienna University of Technology
Overview Introduction Motivation, Overview, Problem Definition A general fitting algorithm Squared distance minimization for curves and surfaces Obstacles: Point cloud as obstacle Theory, constrained optimization, results Obstacles: Forbidden regions Theory, results Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 1
Curve and surface fitting Point clouds are a very popular way to represent geometric objects. Topics of special interest are reducing the amount of information represented by the numerous elements, reconstructing curves and surfaces smoothing the point cloud Curve and surface fitting addresses this issue. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 2
The Fitting Problem We want to approximate a given set of points P = {p k R d : k = 1,...,n} by a fitting curve (d = 2) or surface (d = 3). It s a common choice to deploy B-spline curves or surfaces therefore. For a given fitting entity, x(u) = m N i (u)d i, (1) i=1 we ask for a new position of the control points d i R d, x c (u) = m N i (u)(d i + c i ), (2) i=1 approximating the point cloud in a better way. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 3
The Fitting Problem We want to approximate a given set of points P = {p k R d : k = 1,...,n} by a fitting curve (d = 2) or surface (d = 3). It s a common choice to deploy B-spline curves or surfaces therefore. For a given fitting entity, x(u) = m N i (u)d i, (3) i=1 we ask for a new position of the control points d i R d, x c (u) = m N i (u)(d i + c i ), (4) i=1 approximating the point cloud in a better way. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 4
Constrained curve and surface fitting Conventional curve and surface fitting aims for a best approximation in a least squares sense (balance of residues). However, other features of the point cloud under consideration might be of interest (e.g. the borders). As well, we might want to include a priori knowledge (e.g. regions the final solution must not penetrate). These additional challenges lead to a constrained curve and surface fitting. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 5
Overview Introduction Motivation, Overview, Problem Definition A general fitting algorithm Squared distance minimization for curves and surfaces Obstacles: Point cloud as obstacle Theory, constrained optimization, results Obstacles: Forbidden regions Theory, results Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 6
A general fitting algorithm From the definition of the fitting problem we derive a general fitting algorithm intiutively. We carry out the following discussion mainly for curves. However, the results are - as will be shown - generalized to surfaces easily. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 7
A general fitting algorithm 1. Define a suitable initial position for x(u). Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 8
A general fitting algorithm 1. Define a suitable initial position for x(u). 2. Find for each data point p k the closest point x(u k ) on x(u). Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 9
A general fitting algorithm 1. Define a suitable initial position for x(u). 2. Find for each data point p k the closest point x(u k ) on x(u). 3. Describe the current fitting error in these foot points x(u k ). Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 10
A general fitting algorithm 1. Define a suitable initial position for x(u). 2. Find for each data point p k the closest point x(u k ) on x(u). 3. Describe the current fitting error in these foot points x(u k ). 4. Get the displacements c by minimizing this fitting error. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 11
A general fitting algorithm 1. Define a suitable initial position for x(u). 2. Find for each data point p k the closest point x(u k ) on x(u). 3. Describe the current fitting error in these foot points x(u k ). 4. Get the displacements c by minimizing this fitting error. 5. Update the position of the approximating curve and stop, if the approximation is of satisfactory quality. Otherwise, continue with step 1. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 12
A general fitting algorithm 1. Define a suitable initial position for x(u). 2. Find for each data point p k the closest point x(u k ) on x(u). 3. Describe the current fitting error in these foot points x(u k ). 4. Get the displacements c by minimizing this fitting error. 5. Update the position of the approximating curve and stop, if the approximation is of satisfactory quality. Otherwise, continue with step 1. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 13
Foot point computation p k x(u) x(u k ) ẋ(u k ) For computing the foot point f k = x(u k ) of p k on x(u), we sample the approximating curve densely, choose the closest sample of p k and use it as starting value for a Newton iteration minimizing g(u) = x(u) p k 2. (5) Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 14
Describing the fitting error There are several possibilities to approximate the current fitting error in a foot point x(u k ). We rely on the Squared Distance Minimization (SDM) term by Wang et al. (2005). Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 15
Describing the fitting error n k p k f k t k (0, ρ k ) x(u) Let (t k,n k ) be the local Frenet frame in a foot point f k = x(u k ) of a data point p k on the approximating curve x(u). Moreover, d k = f k p k is the Euclidean distance from f k to p k and ρ k = 1/κ k denotes the inverse curvature of x(u) in f k. We define d k to be negative if p k and the curvature center (0, ρ k ) are located on the same side of the curve and positive otherwise. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 16
SDM for curve fitting Then, based on a second order Taylor approximation of the squared distance function, Q C k (c) = d k d k ρ k [(x c (u k ) p k ) T t k ] 2 + [(x c (u k ) p k ) T n k ] 2, (6) for 0 < d k, and Q C k (c) = [(x c (u k ) p k ) T n k ] 2, (7) for ρ k d k 0, approximate the fitting error in f k. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 17
SDM for surface fitting For surface fittings, an analog approximation is done in a local coordinate frame (n 0,k,n 1,k,n 2,k ) centered at a foot point f k = x c (u k, v k ). Here, n 0,k and n 1,k are the two principal curvature directions, n 2,k denotes the unit surface normal and ρ i,k = 1/κ i,k, i = 0,1, the inverse principal curvatures for n 0,k and n 1,k. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 18
SDM for surface fitting Then, Q S k(c) = 1 i=0 d k d k ρ i,k [(x c (u k,v k ) p k ) T n i,k ] 2 +[(x c (u k,v k ) p k ) T n 2,k ] 2, (8) for 0 < d k, and Q S k(c) = [(x c (u k, v k ) p k ) T n 2,k ] 2, (9) for ρ i,k d k 0 (i = 0 or i = 1), give the SDM error terms for surface fitting. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 19
The optimization problem We use the preceeding approximations of the fitting error in the foot points and describe the fitting problem as an optimization problem. Therefore, we simply sum up over every single approximation error and minimize f(c) = n Q C k (c). (10) k=1 This objective function is quadratic in the unknown displacements c. Thus, a solution is found by solving a system of linear equations. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 20
The optimization problem As a solution of the previously given optimization problem doesn t necessarily mean a visually pleasing solution (e.g. oscillations), a simplified measure for the bending energy is added as smoothing term f(c) = n Q C k (c) + w s k=1 x c(u) 2 du, (11) which makes the objective function remain quadratic in c. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 21
A curve fitting example Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 22
Overview Introduction Motivation, Overview, Problem Definition A general fitting algorithm Squared distance minimization for curves and surfaces Obstacles: Point cloud as obstacle Theory, constrained optimization, results Obstacles: Forbidden regions Theory, results Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 23
Why obstacles? So far, we simply approximated the point cloud by means of a least squares fitting. However, we want to reconstruct other features, such as the borders of a point cloud. In addition, we are interested in guiding the approximation by defining regions the final solution must avoid. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 24
Point cloud as obstacle We regard the elements of the point cloud itself as obstacles to reconstruct its outer - and if it exists - inner boundary. If we orient the normals n k in the foot points f k = x(u k ) such that they point outside, (p k x c (u k )) T n k 0 k = 1,...,n (12) constrains the fitting to approximate the point cloud s outer boundary. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 25
Point cloud as obstacle (illustrated) t k n k p k f k x c (u) Figure 1: The linear constraints force p k to stay on the opposite side of the tangent in f k n k is poiting to. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 26
Point cloud as obstacle (an example) Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 27
Constrained optimization If we add these linear constraints to the fitting optimization problem, we get a quadratic optimization problem with linear constraints, minimize f(c) = n Q C k (c) + w s k=1 x c(u) 2 du subject to (p k x c (u k )) T n k 0 k = 1,...,n. (13) Thus, we are facing a constrained optimization problem now. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 28
Constrained optimization There are basically two families of algorithms to solve optimization problems with quadratic objective function and linear constraints. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 29
Constrained optimization There are basically two families of algorithms to solve optimization problems with quadratic objective function and linear constraints. Active Set Methods estimate and continously update a set of active side conditions. Good for smaller scaled problems. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 30
Constrained optimization There are basically two families of algorithms to solve optimization problems with quadratic objective function and linear constraints. Active Set Methods estimate and continously update a set of active side conditions. Good for smaller scaled problems. Interior Point Methods aim at avoiding the boundary of the feasible region at all. Better suited for larger scaled tasks. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 31
Constrained optimization Our constrained optimzation problem has two major characteristics: Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 32
Constrained optimization Our constrained optimzation problem has two major characteristics: 1. The dimension is only two or three times the number of control points, thus rather small. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 33
Constrained optimization Our constrained optimzation problem has two major characteristics: 1. The dimension is only two or three times the number of control points, thus rather small. 2. The number of constraints equals the possibly big number of data points. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 34
Constrained optimization For these two reasons, we choose to tackle the dual problem, as it increases the dimension of the problem while reducing the complexity of the constraints at the same time. The dual of a quadratic optimization problem with linear constraints is yet another quaddratic, linearly constrained optimization problem. We solve it with an active set method. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 35
Point cloud as obstacle (another example) Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 36
Point cloud as obstacle (another example) Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 37
Overview Introduction Motivation, Overview, Problem Definition A general fitting algorithm Squared distance minimization for curves and surfaces Obstacles: Point cloud as obstacle Theory, constrained optimization, results Obstacles: Forbidden regions Theory, results Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 38
General obstacles Instead of approximating the borders of a point cloud we define subsets of R d the final fitting is not allowed to penetrate. We do not impose any further requirements on these obstacles others than we are able to determine a foot point f O k on the obstacles boundaries for any p Rd and there exists an outward oriented normal n O k in fo k. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 39
General obstacles For a curve fitting in the presence of general obstacles, we first Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 40
General obstacles For a curve fitting in the presence of general obstacles, we first obtain samples s k = x c (u k ) on the approximating B-spline curve x c (u) Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 41
General obstacles For a curve fitting in the presence of general obstacles, we first obtain samples s k = x c (u k ) on the approximating B-spline curve x c (u) and determine the foot point f O k and normal no k in fo k for any s k in distance to an obstacle below a certain threshold ǫ d. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 42
General obstacles In these samples s k, (f O k x c (u k )) T n O k 0 k : s k f O k ǫ d (14) describe linear constraints to achieve a fitting avoiding any general obstacles. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 43
General obstacles (illustrated) x c (u) s k f fo k O n O k P Figure 2: For any sample point s k within a certain distance (light shaded) to an obstacle (dark shaded), foot point fk O and normal no k are computed. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 44
General obstacles Again, we add these linear constraints to the fitting optimization problem and obtain another quadratic optimization problem with linear constraints minimize f(c) = n Q C k (c) + w s k=1 x c(u) 2 du subject to (f O k x c (u k )) T n O k 0 k : s k f O k ǫ d. (15) This program can be solved with the same methods as described before. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 45
Point cloud as obstacle (a curve example) Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 46
Point cloud as obstacle (a surface example) Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 47
Point cloud as obstacle (a surface example) 1 0.8 0.6 v 0.4 0.2 0 0 0.2 0.4 0.6 0.8 1 u Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 48
Summary We showed a way to formulate the general fitting problem as optimization problem. We approximated the boundaries of point clouds by regarding the points as constraints to this optimization process. Moreover, we made the fitting avoid arbitrary regions, again by performing a constrained optimization. Introduction - A general fitting algorithm - Obstacles: Point cloud - Obstacles: Forbidden regions 49
Thank you for your attention.