13
P. Venkataraman P. Venkataraman Mechanical Engineering Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter Mechanical Engineering Reduce and Super Smooth your Surface Data with the Bezier Filter

P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

Embed Size (px)

Citation preview

Page 1: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Reduce and Super Smooth your Surface Data with the

Bezier Filter

Page 2: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

One Dimensional Example

0 50 100 150 200 2501.2

1.25

1.3

1.35

1.4

1.45x 10

4

Ori

gin

al D

ata,

Fit

ted

Dat

a

points

Closing DJIA between Aug and Dec 2007

0 50 100 150 200 2501.2

1.25

1.3

1.35

1.4

1.45x 10

4

Ori

gin

al D

ata,

Fit

ted

Dat

a

points

DJIA - Adjust Close 17 Sep - Dec 18

A Bezier function over all the data

Order of function = 20

Mean original data = 13172.432

Mean Bezier data = 13172.423

Avg. Error = 98.34

Maximum Data = 14164.53

Std. Dev (original) = 530.19

Std. Dev. (Bezier) = 514.68

1

Page 3: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

What is a Bezier Function ?

0 1 2 3 4 50

0.5

1

1.5

2

2.5

3

3.5

4

x: independent variable

y: d

ep

end

en

t va

ria

ble

s

[a1,b1][a1,b1]

[a2,b2]

[a3,b3]

[a4,b4]

[a5,b5]

Convex hullBezier VerticesBezier Curve: order 4

,0

( ) ( ) ( ) , 0 1

n

i n ii

Bx p y p J p p

1, ( ) ( )i n in i

nJ p p p

i

p : parameter

Bernstein basis

Number of vertices: 5

Order of the function : 4

A Bezier function is a Bezier curve that behaves like a function

The Bezier curve is defined using a parameter

Instead of y=f(x);

both x and y depend on the same parameter value; x = x(p) and y = y(p)

2

Page 4: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Matrix Description of Bezier Function

0 1 2 3 4 50

0.5

1

1.5

2

2.5

3

3.5

4

x: independent variable

y: d

ep

end

en

t va

ria

ble

s

[a1,b1][a1,b1]

[a2,b2]

[a3,b3]

[a4,b4]

[a5,b5]

Convex hullBezier VerticesBezier Curve: order 4

[ ( ) ( )] [ ][ ][ ]x p y p P N B

4 3 2[ ] [ 1];

1 -4 6 -4 1 0 0

-4 12 -12 4 0 1 3

[ ] 6 -12 6 0 0 [ ] 2 1

-4 4 0 0 0 3 2

1 0 0 0 0 5

P p p p p

N B

0

This allows the use of Array Processing for shorter computer time

3

Page 5: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

For a selected order of the Bezier function (n) Given a set of (m) vector data ya,i , or [Y], find the coefficient matrix, [B] so that the corresponding data set yb,i , [YB ] produces the least sum of the squared error

2

, ,

m

a i b ii

E y y T T

B B A AE Y Y Y Y Y P NB Y P NB

0E

B

1[ ] [ ] [ ]T TA A AB P P P Y

Minimize

FOC:

The Best Bezier Function to fit the Data

Once the coefficient matrix is known, all other information can be generated using array processing

For the filter, the best order is chosen on minimum absolute error

4

Page 6: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

[ ( ) ( )] [ ][ ][ ]x yx p y p P N B B

[ ( )] [ ][ ][ ]; [ ( ) ] [ ][ ][ ]x yx p P N B y p P N B

[ ( ) ( )] [ ][ ][ ]x p y p P N B

The matrix definition for the Bezier function is

It can be recognized as

And can be decoupled as

Decoupling Independent and Dependent Variables 5

Page 7: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Two Dimensional Bezier Function – Smooth Datay

x

Original Data

5 10 15 20 25 30 35 40 45 50

5

10

15

20

25

30

35

40

45

50

-6

-4

-2

0

2

4

6

Original Data about 2600 points based on MATLAB Peaks function

3D View of the Data

010

2030

4050

60

0

10

20

30

40

50

60-8

-6

-4

-2

0

2

4

6

8

10

x

Original Data

y

Ori

gin

al

-6

-4

-2

0

2

4

6

8

y

x

m =12, n =15 ,Least Sum of Absolute Error :179.8217

5 10 15 20 25 30 35 40 45 50

5

10

15

20

25

30

35

40

45

50

-6

-4

-2

0

2

4

6

Using the Bezier Filter

010

2030

4050

60

0

10

20

30

40

50

60-8

-6

-4

-2

0

2

4

6

8

x

Bezier Data

y

Bez

ier

-6

-4

-2

0

2

4

6 Contour Plot

3D Plot

original Bezier

mean 0.317 0.312

std. dev. 1.116 1.086

maximum 8.042 7.360

minimum -6.521 -6.405

average error: 6.91e-02

6

Page 8: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Two Dimensional Bezier Function – Rough Data

Same peaks function but randomly perturbed on both sides

y

x

Original Data

5 10 15 20 25 30 35 40 45 50

5

10

15

20

25

30

35

40

45

50

-6

-4

-2

0

2

4

6

Less dominant peaks diffused3D plot

010

2030

4050

60

0

10

20

30

40

50

60-8

-6

-4

-2

0

2

4

6

8

10

x

Original Data

y

Ori

gin

al

-6

-4

-2

0

2

4

6

8 Bezier FilterContour plot

y

x

m =12, n =12 ,Least Sum of Absolute Error :1702.726

5 10 15 20 25 30 35 40 45 50

5

10

15

20

25

30

35

40

45

50

-6

-4

-2

0

2

4

6

3D plot

010

2030

4050

60

0

10

20

30

40

50

60-8

-6

-4

-2

0

2

4

6

8

x

Bezier Data

y

Bez

ier

-6

-4

-2

0

2

4

6

average error: 6.54e-01

original Bezier

mean 0.322 0.325

std. dev. 0.859 1.035

maximum 8.253 7.481

minimum -7.651 -6.565

7

Page 9: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Bezier Function in Image Handling

The original image is 960 x 1280 pixels of size 671 KB

200 400 600 800 1000 1200

100

200

300

400

500

600

700

800

900

True image processing in MATLAB

Bezier filter applied to Red, Green and Blue color separately and combined

Highly nonlinear color distribution

8

Page 10: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Single Bezier Functions for the Image

200 400 600 800 1000 1200

100

200

300

400

500

600

700

800

900

200 400 600 800 1000 1200

100

200

300

400

500

600

700

800

900

Size = 671 KB

Bezier function representation

Function order 20 x 20

Coefficient storage = 11 KB (3 color streams)

Original image

9

Page 11: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Bezier Function in Four Quadrants

Original Image 671 KB

200 400 600 800 1000 1200

100

200

300

400

500

600

700

800

900

Four quads

Bezier function representation

200 400 600 800 1000 1200

100

200

300

400

500

600

700

800

900

Function order 20 x 20

Coefficient storage = 4*11 KB (3 color streams) = 44 KB

10

Page 12: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Bezier filter is easy to incorporate and can work for regular, unpredictable data, and images

The Bezier functions have excellent blending and smoothing properties

High order but well behaved polynomial functions can be useful in capturing the data content and underlying behavior

The mean of the Bezier data is the same as the mean of the original data

Bezier functions naturally decouples the independent and the dependent variables

Conclusions

A single continuous function is used to capture all data

Gradient and derivative information of the data are easy to obtain

11

Page 13: P. Venkataraman Mechanical Engineering Rochester Institute of TechnologyCEIS University Technology Showcase, February 12, 2009 Reduce and Super Smooth

P. VenkataramanP. Venkataraman

Mechanical Engineering

Rochester Institute of Technology CEIS University Technology Showcase, February 12, 2009

Reduce and Super Smooth your Scattered Surface Data with the Bezier Filter

Mechanical Engineering

Questions