• No results found

Numerical algorithms for curve approximation and novel user oriented interactive tools

N/A
N/A
Protected

Academic year: 2022

Share "Numerical algorithms for curve approximation and novel user oriented interactive tools"

Copied!
111
0
0

Loading.... (view fulltext now)

Full text

(1)

Dottorato di Ricerca in Matematica XXI Ciclo – A.A. 2008/2009 Settore Scientifico-Disciplinare:

MAT/08 – Analisi Numerica

Tesi di Dottorato

Numerical algorithms for curve approximation and novel user oriented interactive tools

Candidato:

Loredana Chieppa

Supervisori della tesi:

Prof. Giovanni Di Lena Prof. Michele Fiorentino Prof. Antonio E. Uva

Coordinatore del Dottorato di Ricerca:

Prof. Luciano Lopez

(2)
(3)

To my parents Ai miei genitori

(4)
(5)

Contents

Acknowledgements xi

Introduction xiii

1 Background and literature review 1

1.1 Curve representation . . . 2

B´ezier curves . . . 3

B-spline curve . . . 7

1.2 Wavelets analysis . . . 13

History . . . 13

Mathematical definition . . . 13

Wavelet for Computer Graphics . . . 14

Wavelet as new language . . . 16

1.3 Multiresolution analysis . . . 20

Multiresolution curve . . . 20

2 Part one: B-spline Curve Approximation with Optimal Knots 25 2.1 Introduction . . . 25

2.2 Preliminaries . . . 26

2.3 Extension to the not convex functions . . . 31

2.4 Optimal knots for plane curves . . . 34

2.5 Optimal knots for cubic B-spline . . . 35

2.6 Application to knot removal tool . . . 38

3 Numerical examples 45 3.1 Convex functions approximation . . . 45

3.2 Not Convex functions approximation . . . 48

3.3 Plane curves approximation . . . 50

3.4 Knot removal application . . . 55

(6)

4 Part two: 2D sketching using multiresolution approach 61

4.1 Introduction . . . 61

4.2 Sketch curve style . . . 63

4.3 Related work . . . 65

4.4 The proposed approach . . . 67

4.5 Multiresolution Engine . . . 70

4.6 Multi-level Segmentation . . . 72

4.7 Smoothing with continuity constraints . . . 76

5 Implementation and examples 85

Conclusion and future work 89

Bibliography 93

Index 97

(7)

List of Figures

1.1 B´ezier curves of various degree . . . 7

1.2 (left) The example of uniform B-spline curve. (right) The basis functions of uniform cubic B-spline. . . 12

1.3 A “mother” wavelet and two “daughters” . . . 18

1.4 The filter bank . . . 22

3.1 Convex function . . . 46

3.2 Convex function: “catenary” . . . 47

3.3 Not convex function . . . 48

3.4 Not convex function . . . 49

3.5 Curve plane: spiral function . . . 50

3.6 Convex function rotation . . . 52

3.7 Not convex function rotation . . . 53

3.8 Curve plane rotation . . . 54

3.9 Knot removal method: example 1 . . . 56

3.10 Knot removal method: example 2 . . . 57

3.11 Knot removal method: example 3 . . . 58

3.12 Knot removal method: example 4 . . . 59

4.1 Style sketches for a car bodies . . . 62

4.2 Sketches and character lines of cars model . . . 63

4.3 Sketches of car model . . . 64

4.4 Graphic tablet device for digital design . . . 65

4.5 Original curve with 11 control points . . . 69

4.6 Original curve and its coarse version with 7 control points . . 69

4.7 Original curve and its coarse version with 4 control points . . . 69

4.8 The original curve C(t) . . . 73

4.9 The original curve (11 control points) and its coarse version (4 control points). . . 73

(8)

4.10 The segmentation points . . . 73

4.11 Normalized graph of distances and threshold at 0.57 . . . 75

4.12 Segmentation point refinement from seven (top) to four (bottom) 75 5.1 User interface for intuitive sketching . . . 85

5.2 Synthetic curve segmentation: test A . . . 87

5.3 Synthetic curve segmentation: test B . . . 87

5.4 Synthetic curve segmentation: test C . . . 87

5.5 Synthetic curve segmentation: test D . . . 87

5.6 Car body sketch with a graphic tablet . . . 88

5.7 Segmentation of the car outline . . . 88

5.8 Original car sketch profile (sedan) . . . 88

5.9 Seven features points detected on the sketched profile . . . 88

5.10 New sketch car profile generated by a CAD designer . . . 89

5.11 Feature points detected by system after segmentation. . . 89

5.12 Curve extracted by profile of the car in Figure 5.5 after segmen- tation . . . 90

5.13 Example of local simplification of a sketch section: original and smoothed. . . 90

5.14 Example of local simplification of a sketch section: original and smoothed with C1 constraint. . . 90

(9)

List of Tables

3.1 Uniform knots . . . 46

3.2 Not uniform knots . . . 47

3.3 Not convex function . . . 49

3.4 Resnorm values . . . 51

3.5 Test functions errors . . . 51

3.6 “Standard” and “optimal” errors . . . 55

(10)
(11)

Acknowledgements

Foremost, I would like to extend my deepest gratitude to my supervisor Pro- fessor Giovanni Di Lena of University of Study - Bari, for giving me the op- portunity to undertake research work in the field of applied mathematics to Computer Graphic. I thank him for providing me with the opportunity to complete my PhD thesis at University of Bari, and for giving me the mathe- matics basis to work in this not easy research field. I am also grateful to Prof.

Nicoletta Del Buono for supporting me during my PhD period at University of Bari and for her assistance during writing out of my thesis.

I especially want to thank Professor Giuseppe Monno and my advisors Prof.

Michele Fiorentino and Prof. Antonio E. Uva of Department of Mechanical Engineering, Polytechnic of Bari, whose support and guidance made my thesis work possible. They have been actively interested in my work and have always been available to advise me. I am very grateful for their patience, motivation, enthusiasm, and immense knowledge in the Computer graphics applications.

I am also grateful to my friend, industrial designer, Tony Azzella, for introdu- cing me to the wonderful world of applied mathematics to computer graphics.

Special thanks, also, to my family and to my boyfriend Francesco for their understanding, patience and support during the entire period of my study.

(12)
(13)

Introduction

The present work is concerned with two particular aspects in the large field of numerical approximation in the area of Computer Graphics (CG). In par- ticular we study the approximation of plane curves with “optimal knots” and the develop of sketch style curves using “multiresolution” approach. These two aspects, apparently independent of each other, can be regarded as tools of a single system opportunely designed to tackle problems in field of interactive sketch style curves.

In the Computer Graphics area the approximation of curves or surfaces is an important field on which concentrate mathematical studies. The continuous challenge is to find more and more approximation techniques that are com- petitive both in term of mathematic flexibility and algorithmic performance.

Exactly from this point of view, in the previous decades a series of techniques have been developed in order to obtain tools characterized by an increasing computational power and reduced costs.

This thesis takes its place in the active research area of Computer Graphics and have two main aims: firstly the mathematical investigation of the pro- blem of the optimal knots curve approximation and secondly the development of proper mechanism to sketch style curves. In order to obtain these aims we divided this work in two main parts.

In the first part the plane curves approximation problem is tacked using the concept of “optimal knots” sequence as suggested in the work of Hamideh in [14]. We started searching first optimal knots sequence for not convex func- tion until arriving to determine a method to approximate curves plane with optimal knots. Furthermore this “optimal” representation can be useful as a better alternative in some applications as, for example, the knot elimination.

The second part of the thesis, instead, is mainly devoted on the study of the sketch style curves. At the present time, the market value of products depends more and more on aesthetic and ergonomic aspects. In spite of this, desktop CAD software does not assist well in the definition and adjustment of free

(14)

form curves to improve beauty and the success of products. This explains the extensive use in industry of manual sketches on paper. For these reasons we have developed and evaluated innovative methods and algorithms for the interactive generation of quality 2D freeform curves with graphics tablet in- put. The proposed system uses multiresolution analysis based on wavelets, as a mathematical support technique in the sketching procedure. This multire- solution approach is the basis of this second part: by using and improving its potentiality with new techniques discussed and implemented in this thesis, we introduce a 2D sketching framework using a novel user oriented algorithm to segment, edit and smooth free-form curves.

In the following sections we give firstly an overview on the background and literature review regarding the topics of this thesis and then we analyze and go into details first on the B-spline curve approximation with “optimal knots”and then on 2D sketching using multiresolution approach. Furthermore, we show some examples and implementation of both procedures.

(15)

Background and literature review

The goal of Computer Graphics is to produce pictures or images by computer with the help of mathematical computation. It is a rapidly expanding field of computer science, with application in a variety of areas including film and tele- vision post production, computer entertainment, engineering and medical data visualization, image processing and virtual reality, architecture and computer aided design. From the earliest text character images of a non-graphic main- frame computers to the latest photographic quality images of a high resolution personal computers, from vector displays to raster displays, from 2D input to 3D input and beyond, computer graphics has gone through its short, rapid changing history. Moreover the power and flexibility of graphics hardware and software is constantly improving, making this an exciting and dynamic area to work in.

Computer technology is, also, widely used in daily activities, such as filmmak- ing, publishing, banking, engineering, and education.

Engineers and architects use computers to design images or products and computer-aided design (CAD) and computer-aided manufacture (CAM) are two important areas where computer graphics plays a central role. Both (CAD) and (CAM) are widely used in aerospace, automotive engineering, marine engineering, civil engineering, and electronic engineering, just to men- tion some areas in which they are important. The application of computer graphics in engineering constitutes the foundation of computer aided geome- tric design (CAGD), which provides the mathematical basis to describe and process geometric shapes and data.

(16)

As we have seen CG is at the center of many important research fields, so it is important to find new methods and applications.

In this chapter we give a brief overview on the mathematical functions, used in this thesis, that are at the base of many CG applications. In particular, we present some common methods of spline approximation as B´ezier and B- spline curves and then we introduce wavelet approach for Computer Graphics and multiresolution analysis which is intimately connected with the study of wavelets.

These curves representation and wavelet approach will be used and showed in the numerical applications presented in this thesis.

1.1 Curve representation

Since the birth of Computer Graphics, it has been graphics developers greatest aspiration to develop something that is as close to reality as possible. A special attention in CG has been directed in the search of better curve representation.

The need to represents curves and surfaces arose by need to modeling existing objects (a car, a face, a mountain) and in modeling “from scratch”, where no preexisting physical object is being represented.

The two most common methods of representing curves in geometric modeling are implicit equations and parametric functions. The implicit equation of a curve lying in the xy plane has the form f (x, y) = 0. This equation describes an implicit relationship between the x and y coordinates of the points lying on the curve. An example of implicit equation is given by the circle of unit radius centered at the origin, described by the following equation

f(x, y) = x2+ y2− 1 = 0. (1.1.1) The parametric functions, instead, are defined using parameters. In this case each of the coordinates of a point on the curve is represented separately as an explicit function of an independent parameter, that is,

C(t) = (x(t), y(t)), t∈ [0, 1]. (1.1.2)

(17)

For example, one set of parametric equations for the unit circle are:

 x(t) = cos(t),

y(t) = sin(t). (1.1.3)

It is important to mention that the parametric representation of a curve is not unique.

It is difficult to decide which of the two given representations of the same curve is the best to describe it; they could present both advantages and disadvan- tages.

From a detailed analysis showed that the parametric form is more natural for designing and representing shape in a computer. However, as the coordinates parametric functions are arbitrary, is obvious to ask what is the best repre- sentation to choose. The ideal situation, that compensates implementation problems with an efficient representation of the curves, consists in the choose functions that:

• are capable of precisely representing all the curves the users of the system need;

• are easily, efficiently and accurately processed in a computer;

• are simple and mathematically well understood;

A widely used class of functions that satisfy the last two criteria is the poly- nomials. Two common mechanism to express polynomial functions are:

• power basis,

• B´ezier curves.

These two methods are mathematically equivalent, but the B´ezier method is far better suited to representing and manipulating shape in a computer.

Let see in more details the B´ezier representation.

B´ezier curves

This spline approximation method was developed, in the late 1960s, by the French engineer Pierre B´ezier for use in the design of automobile bodies while

(18)

working for the car manufacturer Renault. B´ezier curves have a number of properties that make them highly useful and convenient for curve and surface design. Furthermore they are also easy to implement, so, for these reasons B´ezier curves are widely available in various CAD systems and in assorted drawing and painting packages.

As we have said previously a B´ezier curve is a parametric polynomial curve.

We can define an nth-degree B´ezier curve as:

C˜(t) : [0, 1] → R2, (1.1.4) so that

C(t) =˜ Xn k=0

kn(t)Pk; (1.1.5)

where P0, P1, . . . , Pn−1, Pn are called control points and the basis functions (also called blending functions) ˜Bkn(t) are the classical nth-degree Bernstein polynomials given by:

kn(t) = n!

k!(n − k)!tk(1 − t)n−k. (1.1.6) In any curve representation scheme, the choice of basis functions determines the geometric characteristics of the scheme.

The Bernstein polynomial functions have the following properties:

• Positivity:

kn(t) ≥ 0 k = 0, . . . , n;

• ˜Bn0(0) = ˜Bnn(1) = 1;

nk(0) = ˜Bkn(1) = 0, k= 1, . . . , n − 1;

• ˜Bnk(t) attains exactly one maximum on the interval [0, 1]. In particular it can be proven that the maximum occurs at the point t = kn.

• Partition of unity:

Xn k=0

kn(t) = Xn

k

n k



(1 − t)n−ktk= (1 − t + t)n= 1.

(19)

• Symmetry: for any n, the set polynomials { ˜Bkn(t)} is symmetric with respect to t = 12.

• Derivatives:

d

dtB˜kn(t) = n( ˜Bk−1n−1(t) − ˜Bn−1k (t));

d

dtB˜0n(0) = −n;

d

dtB˜1n(0) = n;

d

dtB˜nn(1) = −n;

d

dtB˜n−1n (1) = n;

d dtB˜kn(k

n) = 0; 0 < k < n (1.1.7)

• recursive definition: by using the following formula

n k



=n − 1 k

n − 1 k− 1

 ,

the Bernstein polynomials can be generated by the recursive formula:

kn(t) = (1 − t) ˜Bkn−1(t) + t ˜Bn−1k−1(t). (1.1.8)

We have enumerated the principal properties of the basis functions, now we are going to describe properties that are satisfied by the B´ezier curves:

Endpoint interpolation: A very useful property of a B´ezier curve of nth- degree is that it always passes through the first and last control points.

That is, the boundary conditions at two ends of the curve are:

C(0) = P˜ 0; C(1) = P˜ n;

(20)

Furthermore, the values of the parametric first derivatives of a B´ezier curve at the endpoints can be calculated from control point coordinates as:

(0) = n(P1− P0);

(1) = n(Pn−1− Pn);

Thus, the slope at the beginning of the curve is along the line joining the first two control points and the slope at the end of the curve is along the line joining the last two endpoints.

Convex hull: The curve is contained in the convex polygon generated by the convex closure of its control points. This property is known as convex hull property and follows from the blending functions properties: positivity and partition of unity.

Affine invariance: B´ezier curves are invariant under affine parameter trans- formations. That is, while the curve is usually defined on the parametric interval [0,1], a simple affine transformation on the parameters to the in- terval [a,b] yields the same curve.

Closed curve: If P0 = Pn the curve is closed and presents, in general, a singular point (cusp) in the connection point.

If the three points P1, P0 = Pn, Pn−1 are aligned the curve is smooth (that is, the tangent vectors at t = 0 and t = 1 have the same direction).

We observe that for:

- n = 1, we have ˜B01(t) = 1−t and ˜B11(t) = t, so the B´ezier curve of first-degree has the following expression:

C(t) = (1 − t)P˜ 0+ tP1. (1.1.9) This is a straight line segment connecting the control points from P0 and P1; - n = 2, we have:

C(t) = (1 − t)˜ 2P0+ 2t(1 − t)P1+ t2P2, (1.1.10) This is a parabolic arc connecting the control points from from P0 to P2;

(21)

- n = 3, we have:

C(t) = (1 − t)˜ 3P0+ 3t(1 − t)2P1+ 3t2(1 − t)P2+ t3P3. (1.1.11) This is a cubic B´ezier curve.

Figure 1.1 shows sample curves of degree one through four. A degree n Bezier curve has n + 1 control points.

Figure 1.1: B´ezier curves of various degree

We will use linear and quadratic B´ezier curve representation in the sec- tion 4.7, as skeleton curve to construct coarse versions of a curve during the smoothing phase, that satisfy continuity constraints at its endpoints.

In the next section we recall the definition and some important properties of another curve representation called B-spline curve.

B-spline curve

B-splines is a different approach to representing piecewise polynomial curves and they are the most widely used class of approximating splines.

Now we see how B-spline representation has better geometric properties re- spect to B´ezier curves.

As already observed the B´ezier curves consist of just one polynomial segment.

There are several reasons which can be addressed to demonstrated the inade- quacy of B´ezier representation in several circumstances:

• when a large number of constraints must be satisfied a B´ezier curve with

(22)

a high degree, is required. However these curves are inefficient to be computed and are numerically unstable;

• the B´ezier curves are not well-suited to interactive shape design;

• the B´ezier curves do not possess a sufficiently local control.

To overcome these drawbacks we have to consider the B-spline curves.

Before to construct B-spline curve and see how they are defined, we have to introduce a new entity, knot vector, and firstly define the B-spline basis (or blending) functions.

Let us consider an increasing sequence of m + 1 real numbers:

U = {u0 ≤ u1 ≤ . . . ≤ um−1≤ um};

where ui are called the knots and U the knot vector, then the B-spline func- tion of p-th degree (or order p+1), with k = 0, . . . , m−(p+1) can be defined as:

Bkp : [u0, um] → R; (1.1.12) and it possesses the following properties, for all t ∈ [u0, um]:

Positivity: Bkp(t) ≥ 0, k= 0 . . . , m − (p + 1);

Partition of unity:

m−(p+1)

X

k=0

Bpk(t) = 1;

Linear independence:

m−(p+1)

X

k=0

Bkp(t) are linearly independent;

Local support: supp(Bpk) = [uk, uk+(p+1)], that is its support consists of p+2 consecutive knots.

These properties of the B-spline basis functions are very important because their determine the many desirable geometric characteristics in B-spline curve.

The shapes of the Bkn basis functions are entirely determined by the relative spacing between the knots (u0, u1, . . . , um). Scaling or translating the knot vector has no effect on shapes of the basis functions and the B-spline.

There are several ways to define B-spline basis functions, e.g. by divided differences of truncated power functions, by blossoming and by a recurrence

(23)

formula. The last one way is the most useful for computer implementation.

The k-th B-spline basis function of p-degree (order p + 1) can be defined by the Cox-deBoor recursion formula as:

Bk0(t) =

 1, uk≤ t < uk+1, 0, otherwise.

Bpk(t) = t− uk

uk+p− ukBkp−1(t) + uk+p+1− t

uk+p+1− uk+1Bk+1p−1(t), (1.1.13) for k = 0, . . . , m − 1.

The recursive definition (1.1.13) outlines that the B-spline functions (the space that they generate), belong to a space of piecewise polynomial functions with polynomial of degree p.

Furthermore in the recursive formulation (1.1.13) it has been adopted the convention that the indeterminate form 00 is equal to zero.

The indeterminate form is held to zero to prevent the inconsistent form that arises, for example, when uk = uk+p.

With this convention the recursive formula is well suited. Although the B- spline functions are formally defined on the real axes, the B-spline of degree p are considered only on the interval [up, um−p].

It is also important give a formula to calculate the derivatives of B-spline basis functions. So, the ith derivative of Bkp(t) is given by the general formula:

(Bkp)(i) = p (Bkp−1)(i−1)

uk+p− uk − (Bk+1p−1)(i−1) uk+p+1− uk+1



(1.1.14) If some consecutive knots coincide, the number of equal points is called knot multiplicity. This nomenclature can be extended also in the case of a knot subsequence:

uk≤ uk+1≤ ... ≤ uk+p ≤ uk+p+1

in which case we will refer to as “knot multiplicity with respect to the subse- quence”.

The knots individuate points on the real line; these points are the knots projections on the real line, so, to distinguish these one from the knots they will be called, sometimes, breakpoints.

Generally the knot vectors can be uniform, open uniform and non-uniform

(24)

distributed.

Uniform knot vectors are those vectors for which the distance between two subsequent points, i.e., ui+1− ui is constant, e.g. [0, 1, 2, 3, 4, 5]. In this case the B-splines are called “uniform” according to to the knot-vector class. Uniform B-splines have periodic basis functions. That is, all basis func- tions have the same shape, each successive basis function is simply a shifted version of the previous function.

Open Uniform knot vectors are uniform knot vectors which have n-equal knot values at each end:

ui= u1, i < n

ui+1− ui = const, p ≤ i < k + 1 ui= uk+n, i≥ k + 1

e.g. [0, 0, 0, 1, 2, 3, 4, 4, 4], (n=3, k=5).

The B-spline curves characterized by this knot-vector, called “open uniform B-splines” have characteristic that are very similar to B´ezier splines. In fact when the p-degree of the polynomial is n, open uniform B-splines reduce to B´ezier splines. Furthermore, the polynomial curve for an open B-spline passes through the first and last control points.

Finally, non-uniform knot vectors are defined by the only constraint:

ui ≤ ui+1, e.g. [0, 1, 2, 3, 3, 4].

With unequally spaced intervals in the knot vector, we obtain different shapes for the basis functions in different intervals. Nonuniform B-splines provide increased flexibility in controlling a curve shape.

If the knot vector does not have any particular structure, the generated curve will not touch the first and last legs of the control polyline.

According to the behavior of a B´ezier curve at its end points, we could like to ensure that the curve has tangents to the first and the last legs at the first and last control points, respectively. In order to do so, the first knot and the last knot must be of multiplicity p + 1. This will generate the so-called clamped B-spline curves. By repeating some knots and control points, the generated curve can be a closed one. In this case, the starting and the ending point of the generated curve join together forming a closed loop.

(25)

The B-spline functions of p-degree are polynomial of degree not higher than p in each interval individuated by two consecutive breakpoints, and so they are formally defined on the open set formed by these intervals.

Using the derivation rules and a recursive formula, we can prove the following result:

d

dtBkp(t) = p Bkp−1(t)

uk+p− uk − p Bk+1p−1(t)

uk+p+1− uk+1. (1.1.15) In the formula (1.1.15) has been used the convention that the indeterminate form 00 is considered equal to zero.

Now we can construct a B-spline curves: a pth-degree B-spline curve is defined by

C(t) = Xn k=0

Bkp(t)Pk (1.1.16)

with t ∈ [0, 1], where Pk are the control points, Bkp(t) are the pth-degree B-spline basis functions defined on the nonperiodic knot vector:

U = {u0, . . . , up, up+1, . . . , um−p−1, um−p, . . . , um} with m + 1 knots so defined

0 = u0= . . . = up < up+1< . . . < um−p−1< um−p= . . . = um= 1 This curve representation is largely used in many CG applications because it has many desirable properties that make it a valid and important toll.

Now we see some important properties of B-spline curve as defined in 1.1.16:

• C(t) is a pth-degree piecewise polynomial curve with n + 1 control points and m + 1 knots where m = n + p + 1;

• Endpoint interpolation:

C(0) = P0 (1.1.17)

C(1) = Pn. (1.1.18)

(26)

• The first derivatives at the endpoints of a B-spline curve are given by:

C(0) = p up+1− up

(P1− P0), (1.1.19) C(1) = p

um−p− um−p−1

(Pn− Pn−1). (1.1.20)

• Affine invariance: an affine transformation (translation, rotation, scale and shear) is applied to the curve by applying it to the control points.

• Strong convex hull property : a B-spline curve is contained in the convex hull of its control polyline. More specifically, if t is in knot span [ui, ui+1[, then C(t) is in the convex hull of control points Pi−p, Pi−p+1, . . . , Pi.

• Local modification: changing the position of control point Pi only affects the curve C(t) on interval [ui, ui+p+1[.

• Variation diminishing property : if the curve is in a plane this means no straight line intersects a B-spline curve more times than it intersects the curve’s control polyline.

In this thesis, we use the B-spline curve, in particular the cubic B-spline curve, both in the first part and in the second part. In the second part, in particular, we use uniform B-spline to perform multiresolution curve analysis.

In the following figure we show an example of cubic B-spline and its basis functions.

Figure 1.2: (left) The example of uniform B-spline curve. (right) The basis functions of uniform cubic B-spline.

(27)

1.2 Wavelets analysis

History

Wavelets are functions that satisfy certain mathematical requirements and are used in representing data or other functions. This idea is not new. Appro- ximation using superposition of functions has existed since the early 1800’s, when Joseph Fourier discovered that he could superpose sines and cosines to represent other functions. However, in wavelet analysis, the scale that we use to look at data plays a special role. Wavelet algorithms process data at different scales or resolutions. If we look at a signal with a large “window”, we would notice gross features. Similarly, if we look at a signal with a small

“window”, we would notice small features. The result in wavelet analysis is to see both small and large “window”.

The Wavelets were proposed in the 1980’s as an alternative to the Fourier transforms for signal analysis, and were initially used for representing seismic signal. In fact, the term wavelet was coined by Ricker in 1940 ([28]) to de- scribe the disturbance that proceeds outward from a sharp seismic impulse or explosive charge. However, only in the middle of 1980’s their mathematic theory was formalized in a rigorous manner.

The Wavelets are now used as a mathematical tool for hierarchically decom- posing functions. They allow any function to be decomposed in terms of a coarse overall shape, plus details that range from broad to narrow.

Mathematical definition

Definition 1.2.1. A wavelet is a function ψ(t) ∈ L2(R) such that the family of functions

ψj,k(t) =: 2j/2ψ(2jt− k)

where j and k are arbitrary integers, is an orthonormal basis in the Hilbert space L2(R).

An orthonormal, compactly supported wavelet basis of L2(R) is formed by the dilation and translation of a single function ψ that satisfies the following

“two-scale” difference equation

ψ(t) =X

i

piψ(2t − i) (1.2.1)

(28)

where pi is a set of coefficients.

The wavelet function has a companion, the scaling function, which also forms a set of orthonormal bases of L2(R)

φj,k(t) =: 2j/2φ(2jt− k)

The scaling function φ also satisfies the “two-scale” difference equation ψ(t) =X

i

qiψ(2t − i) (1.2.2)

where qi is a set of coefficients.

Good wavelet are usually constructed starting from a multiresolution analysis.

Let us give a definition of this concept.

Definition 1.2.2. A multiresolution analysis is a sequence {Vj}j∈Z of sub- spaces of L2(R) such that

i) . . . ⊂ V−1⊂ V0 ⊂ V1 ⊂ . . . ii) spanS

j∈ZVj = L2(R)

iii) f (x) ∈ Vj if and only if f (2−jx) ∈ V0,i.e. the spaces Vj are scaled versions of the central space V0

iv) f ∈ V0 if and only if f (x − m) ∈ V0 for all m ∈ Z,that is, V0 (and hence all the Vj) is invariant under translation.

v) there exists a function φ ∈ V0, called scaling function, such that the system {φ(t − m)}m∈Zis an orthonormal basis in V0

Wavelet for Computer Graphics

Several researches in CG have been centered around the use of wavelets. The ideas of multiple levels of resolution, or so called “level of detail” modeling, have been largely used in CG as in many other disciplines. Thus, when wavelets moved from a mathematical analysis tool to a practical computa- tional tool, they were quickly put to use in CG.

The Wavelets can be applied to a wide variety of objects used in graphics, as we point out in the following list:

(29)

• Image Processing: some of most powerful compression techniques are based on wavelet transforms;

• Global Illumination: radiosity and radiance algorithms, that are based on wavelets are asymptotically faster than other finite element methods;

• Hierarchical Modeling: the use of multiresolution representations for curves and surfaces accelerates and simplifies many applications of edit- ing;

• Animation: the large constrained optimization tasks which arise in physically based modeling and animation subject to goal constraints can be resolved faster and more robustly with wavelets;

• Volume Rendering and Processing: the wavelets can simplify the treatment of very large data sets because they can be used as well as feature detection and enhancement;

• Multiresolution Painting: the use of multiresolution analysis one can build efficient “infinite” resolution paint systems;

• Image Query: the use of a small number of the largest wavelet coeffi- cients of an image, gives the opportunity of accelerating searching and retrieval systems.

There are several reasons for the enthusiastic welcome wavelet based algo- rithms have received in CG. Foremost stand the huge computational demands of CG applications. Geometric models, for example, are often built from a large number of primitive elements in order to achieve some desired level of fi- delity with respect to a real world object. At the same time, users would desire that all the manipulations and the computations which involve these objects occur interactively, that is, with the screen updates occurring multiple times per second. Similarly, the shading and the motion of these objects should appear realistic. Depending on the number and the complexity of objects appearing in a scene, this can lead to very expensive algorithms. Some exam- ples include the modeling of constrained dynamical systems, the deformation of objects under forces, and the indirect illumination effects. Performing the necessary computations under the constraints of interactivity demands the as efficient algorithms as possible, and the application of some shrewd appro- ximations which permit to preserve a perceived realism. Due to the ability of wavelets to represent compactly functions and data sets within user spe- cified error bounds they are a natural tool to be considered. Their zooming

(30)

in ability allows the use of “just enough” precision in a given region of inte- rest, allowing at the same time coarse representations in regions outside the immediate area of interest. Even more importantly, they facilitate a smooth tradeoff between computation time and resulting simulation quality. Often the algorithms which manipulate these hierarchical objects become asympto- tically faster as well, allowing the use of much larger and more complicated scenes with respect to what is possible to treat without this tool.

Wavelet as new language

The Wavelet take some advantages on the traditional methods like the Fourier analysis especially when the real signal presents some discontinuities. There has been a large interest in studying those functions which approximate dis- continuous signals more appropriate with respect to the sin and the cosine functions adopted in the Fourier transform.

In fact the deficiencies of Fourier techniques have led researchers in a variety of disciplines to develop various hierarchical representations of functions. This enormous interest, on wavelet theory, in many and different research fields has lead researches to comunicate necessarily between themselves.

The mathematician Ingrid Daubechies describes in clear manner what the Wavelets are and how this term became a new communication language among all scientists ([37]).

. . . Mathematicians are like the French, the German poet Goethe once remarked. “They take whatever you tell them and translate it into their own language - and from then on it is something entirely different”.

Goethe’s observation is as true now as ever. But times may be changing. In the last ten years, mathematicians and researchers in diverse areas of science, engineering and even art have discovered and begun to develop a theoretical language they can all understand.

This new common language is sparking new collaborations. Many mathematicians are now crossing over into such applied areas as signal processing, medical imaging, and speech synthesis. At the same time, much deep but abstract - sounding mathematics is be- coming accessible to researchers in fields from geophysics to elec- trical engineering.

The new language is wavelet theory. Those who speak it it describe

(31)

wavelets as powerful new tools for analyzing data. Wavelet theory serves as a kind of numerical zoom lens, able to focus tightly on interesting patches of data - but without losing sight of mathema- tical forest while attending to the trees, twigs, buds, and grains of pollen....

Mathematically, wavelets are an offshoot of the theory of Fourier analysis. Introduced by the French mathematician Joseph Fourier in his essay “Theorie analytique de la chaleur” (analytic theory of heat), published in 1822. Fourier analysis seeks, with great suc- cess, to understand complicated phenomena by breaking them into mathematically simple components. The fundamental idea is to take a function and express it as a sum of trigonometric sine and cosine waves of various frequencies and amplitudes. The familiar and well- understood trigonometric functions are easy to analyze.

By combining information about a function’s sine and cosine com- ponents, properties of the function itself are easily deduced, at least in principle. Fourier analysis is among mathematics’ most widely used theories. It is especially suited to analyzing periodic pheno- mena, periodicity being the most prominent property of sines and cosines. But even so, the theory has its limitations and its pit- falls. The main problem is that finding detailed information about a function requires looking at a huge number of its infinitely many Fourier components. For example, a transient “blip” obvious in a graph, is impossible to recognize from its effect on a single com- ponent. The reason, in essence, is that each sine and cosine wave undulates infinitely in both directions: thus a single wave can’t help locate anything. Indeed the sharper the blip, the more Fourier com- ponents are needed to describe it.

Wavelet theory takes a different approach. Instead of working with the infinitely undulating sine and cosine waves, wavelet analysis relies on translations and dilations of a suitably chosen “mother wavelet” that is concentrated in a finite interval. Almost any func- tion can serve as the mother wavelet: this makes wavelet the- ory more flexible than traditional Fourier analysis. “Daughter”

wavelets are formed by translating, or shifting, the mother wavelet by unit steps and by contracting or expanding it by powers of two (see Figure 1.3).

One then expresses other functions as combinations of wavelets,

(32)

Figure 1.3: A “mother” wavelet and two “daughters”

just as Fourier analysis represents functions by combining sines and cosines.

The fact that the mother wavelet is concentrated in a finite inter- val gives wavelet theory its zoom-in capability:an interesting blip in a function can be analyzed by looking at increasingly contracted copies of the mother wavelet in the vicinity of the blip.

Many of the ideas underlying wavelet theory have been around for decades, but the subject itself got off the ground only recently. The story starts in the early 1980s in France, when wavelets were in- troduced by geophysicist Jean Morlet and mathematical physicist Alexander Grossmann. In 1985, mathematician Yves Meyer con- structed a family of wavelets with two highly desirable mathema- tical properties called smoothness and orthogonality.(Interestingly, J. O. Stromberg at the University of Tromso in Norway had con- structed such a family several years earlier, but the connection with the nascent theory of wavelets was not realized until after Meyer’s work.)

The following year, Meyer and Stephane Mallat gave the subject a solid foundation with a theory of “multiresolution analysis”. Then in 1987, Daubechies constructed a family of wavelet that, in addi- tion to being smooth and orthogonal, were identically zero outside a finite interval. Daubechies ’s construction opened up the field.

“Compactly supported” wavelets are now easy to come by, and are

(33)

among the most commonly used in applications. And applications are abundant. Wavelets are being tested for use in everything from digital image enhancement- making blurry pictures sharp- to new methods in numerical analysis (itself widely used in scientific com- puting). “They’re a very versatile tool” says Daubechies. Not all the applications will pan out, but many will, and some already have.

“There are some very nice success stories” Daubechies adds.

One such story may have far- reaching effects, especially for the next generation of criminals. The Federal Bureau of Investigation has adopted a wavelet-based standard for computerizing its finger- print files. The FBI has around 200 million fingerprint cards on file, according to Peter Higgins, is to digitize the files, store them electronically, and “put [them] in something that would fit in a 20 × 20-foot room”.

It sounds easy: after all, entire encyclopedias now fit on a compact disk with room to spare. But that’s words. Images are something else. At a resolution of 500 pixels per inch. a standard finger- print card contains nearly 10 megabytes of data. Transmitting that much information over a modem-something the police would like to be able to do takes hours at today’s transmission rates. . . What’s needed is some way to compress the data on a fingerprint card without distorting the picture. That’s where wavelets come in. By treating the fingerprint image as a two- dimensional function, it’s possible to represent it with a combination of wavelets. With a suit- ably chosen family of wavelets, only a relative handful are needed to represent a fingerprint, and the contribution of each wavelet can be rounded off, or “quantized”, which reduces the amount of data that needs to be stored or transmitted. . .

(34)

1.3 Multiresolution analysis

Multiresolution curve

The multiresolution techniques and the use of hierarchy have a long history in CG. In particular, the multiresolution plays a fundamental role for CAD curves representation as B-spline.

This technique is a certain way of handling cubic B-splines, which allows to do many things, that are not possible or very complicated with spline techniques. Some of the key-features of multiresolution curves are:

• smoothing through changing the level of resolution

• editing the overall sweep of the curve without changing its character

• editing the character of the curve without changing its overall sweep The key idea of multiresolution curves is to take cubic B-spline control points and apply filter bank decomposition from multiresolution analysis. This means defining a filter-bank: a set of matrices presenting averaging scheme for each level of resolution. By applying decomposition matrices to the initial control polygon we get the control polygon on the lowest level and a set of detail coefficients for every successful level. By applying reconstruction matrices on the latter you can get the control points of the curve at any level.

In order to understand better the working mechanism underlying this tech- nique, in the following section we provide an overview of the multiresolution analysis applied to curves.

A function or a signal can be viewed as composed by a smooth background and some fluctuations or details on top of it. The distinction between the smooth part and the details is determined by the resolution, that is, by the level below which the details of a signal cannot be discerned. At a given resolution, a function is approximated by ignoring all fluctuations below the resolution scale. We can imagine to progressively increase the resolution: at each stage of the increase in the resolution, finer details are added to the coarser description, providing successively better approximations to the origi- nal function. In our case, given a B-spline curve f (u) with m control points, a multiresolution framework constructs the approximating curve with the least squared error using m’ control points with m < m. We consider that these

(35)

are endpoint-interpolating uniform B-spline curves. We summarize the multi- resolution framework considering the general case.

Let Cnbe a discrete signal expressed as a column vector of samples cn1, cn2, .., cnm Cn= [cn1, cn2, .., cnm]T,

that in our application are the control points of the curve. We want to con- struct a low-resolution version Cn−1of Cnwith a number of samples m < m.

The process for creating the m samples of Cn−1 uses some form of filtering and down-sampling that can be expressed by the following matrix equation:

Cn−1= AnCn, (1.3.1)

where An is an m× m matrix.

The detail Dn−1lost in this filtering process can be captured by the following equation:

Dn−1= BnCn, (1.3.2)

where Bn is a (m − m) × m matrix which is related to the matrix An. This process, that splits Cn into a low-resolution version Cn−1 and detail Dn−1, is called decomposition.

If An and Bn are correctly chosen, we can reconstruct the initial signal Cn using another pair of matrices Pn and Qn called synthesis filters, as follows:

Cn= PnCn−1+ QnDn−1. (1.3.3) The process is called reconstruction.

If we recursively apply the same splitting procedure to the signal Cn−1, we obtain a hierarchy of lower-resolution signals C0, C1, . . . , Cn−1 and details D0, D1, . . . , Dn−1. This recursive process is known as a filter bank (Figure 1.4). So, Cn can be recovered from the sequence C0, D0, D1, . . . , Dn−1. This transformation is known as a wavelet transform.

All that is needed for a wavelet transform is an appropriate set of analysis and synthesis filters Aj, Bj, Pj and Qj. To calculate these filters, we associate with each signal Cn (for the B-spline curves these are the vectors of control points), a functions fn(u), with u ∈ [0, 1] given by:

fn(u) = φnCn,

(36)

Figure 1.4: The filter bank

where φnis a row matrix of basis functions called scaling function that are the endpoint-interpolating B-splines basis functions for the curves. These func- tions posses an important property: they have to be refinable; that is, for all j ∈ [0, n] :

φj−1= φjPj. (1.3.4)

In other words, each scaling function at level j − 1 must be expressible as a linear combination of “finer” scaling functions at level j. Next, let Vj be the linear space spanned by the set of scaling functions j. The refinement condition on j implies that these linear spaces are nested. If we choose an proper inner product for the basis functions in Vj we are able to define Wj as the orthogonal complement of Vj in Vj+1. The basis functions j of the space Wj, called wavelets, are such that φj and ψj together form a basis for Vj+1. We can now construct the synthesis filter Qjas the matrix that satisfies:

ψj−1= φjQj. (1.3.5)

The equations 1.3.4 and 1.3.5 can be expressed as a single equation by con- catenating the matrices together:

j−1| Ψj−1] = Φj[Pj | Qj]

The analysis filters Aj and Bj instead, are formed by the matrices satisfying the inverse relation:

j−1| Ψj−1] Aj Bj



= Φj

By this two matrix equations we can write the following relation:

 Aj Bj



= [Pj | Qj]−1

(37)

where



Aj Bj



and [Pj | Qj]−1 are both square matrices.

We have seen an overview on wavelet and multiresolution analysis that we will use in the second part of this thesis when we analyze the smoothing and segmentation phase in the sketch curve phases.

To construct multiresolution curve procedure we need that the work space have particular property as for example that the spaces of the basis functions are nested.

As we have seen in the section 1.1, the basis functions of the B-spline curve are defined recursively and hence they have this property. Furthermore the fact that the B-spline basis functions are locally supported, influence the sparsity of the refinement matrix Pj. These and other property make B-spline curve representation suitable for wavelet and multiresolution analysis.

Now, we can see in more detail how, all these mathematical entity, are used in the two research fields presented in this thesis.

(38)
(39)

Part one: B-spline Curve

Approximation with Optimal Knots

2.1 Introduction

This chapter concerns with an algorithm for constructing suitable configura- tion of knot sets for the linear B-splines. The aim is to determine “optimal positions” for the knots, in order to approximate arbitrary functions in the L1 norm.

Starting from some known results on the approximation of strictly convex functions with linear splines, we construct linear approximations for not con- vex functions and plane curves.

Furthermore, we apply the proposed approach to approximate cubic B-splines with “optimal knots” and to achieved a better curve approximation after knots removal.

Some numerical experiments that illustrating the performance of the presented algorithm are also showed.

In particular we extend to a not convex function the L1 approximation of strictly convex functions by means of second order splines, and then we present some applications of this extension.

The section 2.2 gives an overview of the problem, already studied by [18], subsequently, the section 2.3 and 2.4 are devoted to the extension of linear approximations to a not convex functions and plane curves, respectively.

The section 2.5 and 2.6 are dedicated to applications of the methods described

(40)

in the previous sections, to obtain better cubic B-spline approximations after some knots removal.

Finally, in the chapter 3 some numerical examples are provided.

2.2 Preliminaries

Let [a, b] an interval on the real axis and let S2(U ) be the space of the second order spline with U = {u0, . . . , un+1} set of knots in [a, b], with a = u0 = u1<

· · · < un= un+1= b and with the B-spline basis functions B01, . . . , Bn−11 . Let C(t) ∈ S2(U ) be a linear B-spline with knots set U , then we can rewrite it as follows:

C(t) =

n−1X

i=0

αiBi1(t) where αi are coefficients.

The problem we are going to tackle can we formalize as follows.

Problem 1. Let f be a function, f ∈ C[a, b], we want to approximate f by second order spline functions, i.e., we want to find a C(t) with knots set U such that:

Rb

a|f (x) − C(t)|dx 6Rb

a|f (x) − C(t)|dx for all set of knots U in [a, b] and functions C(t) ∈ S2(U ).

Firstly, we recall the results obtained in [14] and [18].

In these works a preliminary solution at the Problem 1 is proposed by consi- dering f to be strictly convex function in [a, b].

The optimal L1approximation straight line can be determined easily with the following result:

(41)

Lemma 2.2.1. For any strictly convex function f ∈ C[a, b], the optimal straight line approximation to f in [a, b] interpolates f at points one-quarter and three-quarters between a and b.

Proof. If we consider the theorem mentioned in Rice [27], the optimal L1 approximation straight line can be determined according to that theorem. So, the interpolating points β1 and β2 are the roots of the following equations:

Z β1

a

φi(x)dx − Z β2

β1

φi(x)dx + Z b

β2

φi(x)dx i= 1, 2 (2.2.1) where

φ1(x) = 1 and φ2(x) = x.

2 In 1978 Kioustelidis and Spyropoulos [18] extended the Lemma 2.2.1 for strictly convex functions to an arbitrary set of knots. They found the condi- tions which the set of knots must satisfy in order to obtain the best L1 linear approximation of a given convex function. As a consequence of this result it can be proved that the approximation is optimal either in the global case, either in the local case, if following system is solved:

f(βi1) − 3f (βi2) + 3f (βi+1,1) − f (βi+1,2) = 0, (2.2.2) where

βi1= 34ui−1+ 14ui, βi2= 14ui−1+ 34ui,

(2.2.3) for i = 2, . . . , n − 1.

So, the optimal knots are calculated solving (2.2.2), while the vector coeffi- cients αi can be obtained as follows:

αi−1= f(βi2) − f (βi1)

βi2− βi1 (ui− βi1) + f (βi1), i= 2, . . . , n − 1, with α0 = f (u0) and αn−1= f (un+1).

Since the equations (2.2.2) are equivalent to the continuity conditions at points ui, the following theorem can be stated [18]

Theorem 2.2.2. Let f ∈ C[a, b] be a strictly convex function in [a, b], then the only solution of the Problem 1 verifies the system (2.2.2) and the constraint on the knots i.e a < u1 < u2 < . . . < un−1< b.

(42)

According to equations (2.2.2) and (2.2.3), the system describing the con- tinuity conditions for i = 2, . . . , n − 1, is:

f 3ui−1+ ui 4



− 3f ui−1+ 3ui 4



+ 3f 3ui+ ui+1 4



− f ui+ 3ui+1 4



= 0, (2.2.4) with u0 = u1 = a and un= un+1= b.

The equations (2.2.4) constitute a tri-diagonal system of non-linear equations for the knots, hence it can be solved by some of standard techniques for non- linear system or by methods used for the solution of a single non-linear equa- tion in one variable. This is possible because each equation in (2.2.4) allows to determinate ui+2from ui and ui+1.

In alternative at previous method in 2002, Hamideh [14], presented a con- structive method for locating the optimal knots without the use of the first derivatives.

Given the subintervals [ui, ui+1] and [ui+1, ui+2], and computed the unique piecewise line approximations li(x) and li+1(x) respectively in each subinter- vals in order to obtaining:

li(x) = f (ββi2)−f (βi1)

i2−βi1 (x − βi1) + f (βi1),

they varied the knots so that the approximation becomes a spline by setting

ui = {x|li(x) = li+1(x)}, i= n − 1, n − 2, . . . , 1.

So they obtained a new set of partition points and with this new sets they began as before and repeated the process. By this procedure the resulting sequence of errors is decreasing and as it is bounded, it is convergent. We can summarize this method by the following algorithm:

Algorithm 2.2.1. Given a strictly convex function f [a, b] and a set of arbi- trary points U = {u0, u1, . . . , un} such that

a= u0 < u1 < . . . < un= b,

(43)

the algorithm constructs the optimal L1 approximation lines in the subinter- vals as follows:

for i = 1 to n do

• Compute the best interpolating points on the i-th interval [ui−1, ui] as follows

βi1=3

4ui−1+1 4ui,

βi2=1

4ui−1+3 4ui.

• Calculate the approximating straight lines li(x) = f(βi2) − f (βi1)

βi2− βi1

(x − βi1) + f (βi1).

Algorithm 2.2.2.

• Set c := 0

• Set U∗(0) = U(0)

• Repeat until convergence - for i = 1 up to n

• Use algorithm 2.2.1 to calculate the set of straight lines L(c) - for i = n down to 1

• Calculate the set of knots U∗(c)

• Set c := c + 1.

Now, let see the relationship between the first and second method:

let be

ϕi(u) = 1

2(f (βi1) − 3f (βi2) + 3f (βi+1,1) − f (βi+1,2)), (2.2.5)

References

Related documents

For each economy the ranking is calculated as the simple average of the percentile rankings on each of the 10 topics included in the index in Doing Business 2013:

Subexponential tails of discounted aggregate claims in a time- dependent renewal risk model.. The subexponential product convolution of two

The notion of Kernel Target Alignment (Cristianini et al., 2002) uses the ob- jective function tr ( Kyy ⊤ ) where y are the training labels, and K is from the class of kernels

The motivation for includ- ing a northward turning trigger is the observation that a large percentage of substorms follow the predictions of the internally-triggered

This is the phenomenon of Vehikel , a transport arising as a certain paradox of a blind spot in con- templation, without which nothing can be seen properly. For Husserl it meant

Partners ’ anxiety rates exceed not only the Australian norm, but also those of cancer survivors themselves [5]. Hence, it is imperative that coping skills interventions target

Our secondary analysis of patients who were non- adherent to CRC screening at baseline showed a signifi- cant increase in overall CRC screening adherence (ad- justed OR = 1.70; 95%

A road pricing program that charges drivers for every kilometer they drive has been proven to be the most effective method to manage demand for road access, achieve efficiency in