ubi 516 advanced computer graphics

68
Fractal Geometry Fractal Geometry Methods Methods UBI 516 Advanced Computer Graphics Aydın Öztürk [email protected] http://www.ube.ege.edu.tr/~ozturk

Upload: olinda

Post on 05-Jan-2016

40 views

Category:

Documents


1 download

DESCRIPTION

UBI 516 Advanced Computer Graphics. Fractal Geometry Methods. Aydın Öztürk ozturk @ ube.ege.edu.tr http://www. ube.ege.edu.tr/~ozturk. Fractals. Many objects in nature aren't formed of squares or triangles, but of more complicated geometric figures. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: UBI 516 Advanced Computer Graphics

Fractal Geometry MethodsFractal Geometry Methods

UBI 516 Advanced Computer Graphics

UBI 516 Advanced Computer Graphics

Aydın Öztürk

[email protected]://www.ube.ege.edu.tr/~ozturk

Page 2: UBI 516 Advanced Computer Graphics

Fractals

Many objects in nature aren't formed of squares or triangles, but of more complicated geometric figures.

Many natural objects - ferns, coastlines, etc. - are shaped like fractals.

Page 3: UBI 516 Advanced Computer Graphics

Fractals(cont)

All the object representations we have considered so far used Euclidean geometry methods that is object shapes were described with equations.

Natural objects can be realistically described with fractal geometry methods, where procedures rather than equations are used.

Page 4: UBI 516 Advanced Computer Graphics

Fractals(cont.) A fractal has two basic charecteristics

- Infinite detail at every point

- Self similarity between the object parts.

Page 5: UBI 516 Advanced Computer Graphics

Self Similarity Geometric figures are similar if they

have the same shape.

 The two squares are similar.

 The two rectangles are not similar.

But the two rectangles are similar.

Page 6: UBI 516 Advanced Computer Graphics

Self Similarity

Many figures that are not fractals are self-similar.

Notice the figure to the right. The outline of the figure is a trapezoid. All the trapezoids inside make up the larger trapezoid.

Page 7: UBI 516 Advanced Computer Graphics

Self Similarity: Examples

            

  

                

  

             

  

            

  

            

Page 8: UBI 516 Advanced Computer Graphics

Construction of Self Similar Fractals

            

  

                

  

             

  

            

  

            

To construct a deterministic self-similar fractal, we start with a geometric shape called initiator.

Subparts of of initiator are then replaced with a pattern called generator.

Initiator Generator

Page 9: UBI 516 Advanced Computer Graphics

Construction of Self Similar Fractals

To construct a deterministic self-similar fractal, we start with a geometric shape called initiator.

Subparts of of initiator are then replaced with a pattern called generator.

Page 10: UBI 516 Advanced Computer Graphics

Construction of Self Similar Fractals

Page 11: UBI 516 Advanced Computer Graphics

 The Sierpinski Triangle

Page 12: UBI 516 Advanced Computer Graphics

 The Sierpinski Triangle(cont.)

Step One Draw an equilateral triangle with sides of 2 triangle lengths each. Connect the midpoints of each side. Shade out the triangle in the center

                       

Page 13: UBI 516 Advanced Computer Graphics

 The Sierpinski Triangle(cont.)

Step Two Draw another equilateral triangle with sides of 2 triangle lengths each. Connect the midpoints of the sides and shade the triangle in the center as before.

                             Notice the three small triangles that also need to be shaded out in each of the three triangles on each corner - three more holes.

Page 14: UBI 516 Advanced Computer Graphics

 The Sierpinski Triangle(cont.)

Step Three Draw an equilateral triangle with sides of 4 triangle lengths each.

                             

Page 15: UBI 516 Advanced Computer Graphics

 The Sierpinski Triangle(cont.)

Step Four We follow the above pattern and complete the Sierpinski Triangle.

Page 16: UBI 516 Advanced Computer Graphics

 Example-1

Page 17: UBI 516 Advanced Computer Graphics

 Example-2

Page 18: UBI 516 Advanced Computer Graphics

 Example-3

Page 19: UBI 516 Advanced Computer Graphics

 Example-4

Page 20: UBI 516 Advanced Computer Graphics

 Example-5

Page 21: UBI 516 Advanced Computer Graphics

 Example-6

Page 22: UBI 516 Advanced Computer Graphics

 Example-7

Page 23: UBI 516 Advanced Computer Graphics
Page 24: UBI 516 Advanced Computer Graphics

 Example-8

Page 25: UBI 516 Advanced Computer Graphics

 Example-9

Page 26: UBI 516 Advanced Computer Graphics

 Example-10

Page 27: UBI 516 Advanced Computer Graphics

 Example-11

Page 28: UBI 516 Advanced Computer Graphics

 Example-12

Page 29: UBI 516 Advanced Computer Graphics

 Example-13

Page 30: UBI 516 Advanced Computer Graphics

 Example-14

Page 31: UBI 516 Advanced Computer Graphics

 Example-15

Page 32: UBI 516 Advanced Computer Graphics

 Example-16

Page 33: UBI 516 Advanced Computer Graphics

 Example-17

Page 34: UBI 516 Advanced Computer Graphics

 Example-18

Page 35: UBI 516 Advanced Computer Graphics

 Example-19

Page 36: UBI 516 Advanced Computer Graphics

 Example-20

Page 37: UBI 516 Advanced Computer Graphics

 Classification of Fractals

Self-similar fractals have parts that are scaled-down versions of the entire object.

Self-affine fractals have parts that are formed with different scaling parameters sx , sy , sz in different coordinate directions.

Invariant fractal sets are formed with nonlinear transformations.

Page 38: UBI 516 Advanced Computer Graphics

 Fractal Dimension

The detail variation in a fractal object can be described with a number D, called fractal dimension, which is a measure of roughness, or fragmentation of the object.

More jagged-looking objects have larger fractal dimensions.

Page 39: UBI 516 Advanced Computer Graphics

Fractal Dimension(cont.)

 

A line has one dimension - length. It has no width and no height, but infinite

A plane has two dimensions - length and width, no depth.

A point has no dimensions –no length, no width, no height.

Page 40: UBI 516 Advanced Computer Graphics

Fractal Dimension(cont.)

 

A cube has three dimensions, length, width, and depth, extending to infinity in all three directions

Fractals can have fractional (or fractal) dimension. A fractal might have dimension of 1.6 or 2.4.

Page 41: UBI 516 Advanced Computer Graphics

Fractal Dimension(cont.)

 

A unit straight-line segment is divided into two equal length sub-parts. This gives two scaled copies of the original segment.

A unit square is divided into four sub-squares. Scaling the length and width by 2 gives four copies of the original square.

A unit cube is divided into eight sub-cubes. Scaling the length, width, and height by 2 gives eight copies of the original cube.

                                   

Page 42: UBI 516 Advanced Computer Graphics

Fractal Dimension(cont.)

 

 Figure   Dimension   No. of Copies 

Line 1 2 = 21

Square 2 4 = 22

Cube 3 8 = 23

  Similarity with scaling factor s=1/2

d n = 2d

Relationship between the number of copies, scaling factor and the dimension.

Page 43: UBI 516 Advanced Computer Graphics

Fractal Dimension(cont.)

 

             

                      Sierpinski triangle. Scale the length of the sides of an equilateral triangle by 2. Scaling the sides gives us three copies, so 3 = 2d, where d is the dimension. Solving this equation we obtain the corresponding fractal

dimension d=1.584.

 Figure   Dimension   No. of Copies 

Line 1 2 = 21

Sierpinski's Triangle 1.584 3 = 2d

Square 2 4 = 22

Cube 3 8 = 23

 Doubling Similarity  d n = 2d

Page 44: UBI 516 Advanced Computer Graphics

Fractal Dimension(cont.)

Let s be the scaling factor.

Relationship between the number of copies, the scaling factor and the dimension can be written as

Solwing this expression for d, we have

1dns

)/1ln(

ln

s

nd

Page 45: UBI 516 Advanced Computer Graphics

Fractal Dimension: Examples

Generator Segment length Fractal dimension

1/√7 d=ln 3/ln(√7)=1.129

1/4 d=ln 8/ln 4=1.500

1/6 d=ln 18/ln 6=1.613

Page 46: UBI 516 Advanced Computer Graphics

Creating an Image by Means of Iterated Function Systems

Suppose that we take an initial image I0 , and put it through a special photocopier that produces a new image I1.

I1 is not a simple copy of I0 ; rather, it is a superposition of several reduced versions of I0.

We then take I1 and feed it back into the copier again, to produce image I2 ...etc.

We investigate whether these images converge to some image.

Page 47: UBI 516 Advanced Computer Graphics

Multiple Reduction Copying Machine

Page 48: UBI 516 Advanced Computer Graphics

Multiple Reduction Copying Machine(cont.)

There are multiple lens arrangements to create multiple copies of the original.

Each lens arrangement reduces the size of the original.

The copier operates in a feedback loop, with the output of one stage the input to the next.

The initial input may be any image.

Page 49: UBI 516 Advanced Computer Graphics

Multiple Reduction Copying Machine(cont.)

http://www.arcytech.org/java/fractals/sierpinski.shtml

Sierpinski’s Triangle is a typical example

Page 50: UBI 516 Advanced Computer Graphics

Multiple Reduction Copying Machine: Sierpinski’s Triangle

The Sierpinski’s triangle is a most well known and simplest example of Iterated Function Systems(IFS).

It is comprised of three component functions(lenses), each of which shrinks the input image by one half and translates it to a new position.

This contractive property guarantees convergence of the iterative process.

Page 51: UBI 516 Advanced Computer Graphics

Multiple Reduction Copying Machine: Sierpinski’s Triangle(cont.)

Mathematically, each reducing lense is represented as a contractive affine transformation that acts to scale, rotate, shear and translate a copy of the input image.

The three transformations that produce Sierpinski’s Triangle are:

100

0

0

100

00

0

100

00

00

21

21

41

21

321

21

21

221

21

1 WWW

Page 52: UBI 516 Advanced Computer Graphics

Multiple Reduction Copying Machine: Sierpinski’s Triangle(cont.)

Mathematically, each reducing lense is represented as a contractive affine transformation that acts to scale, rotate, shear and translate a copy of the input image.

The three transformations that produce Sierpinski’s Triangle are:

100

0

0

100

00

0

100

00

00

21

21

41

21

321

21

21

221

21

1 WWW

Page 53: UBI 516 Advanced Computer Graphics

Fractal Tree

The coefficiens of four transformation matrices

Transform a b c d e fW1 0.53 -0.08 0.08 0.53 -0.88 33.44

W2 -0.31 -0.42 -0.44 0.33 -15.19 19.43

W3 -0.25 -0.05 -0.07 0.29 1.48 11.73

W4 0.29 0.54 -0.04 0.29 18.74 9.87

Page 54: UBI 516 Advanced Computer Graphics

Multiple Reduction Copying Machine:Example

Page 55: UBI 516 Advanced Computer Graphics

Partitioned Iterated Function System

The basic idea:

Find self similarity between larger parts and smaller parts of the image.

Partitioning the original image into blocks is a natural choice.

Large partitions are called domain blocks, and the small partitions are range blocks.

Page 56: UBI 516 Advanced Computer Graphics

Partitioned Iterated Function System

Page 57: UBI 516 Advanced Computer Graphics

Fractal Image Compression

Page 58: UBI 516 Advanced Computer Graphics

Resim İçindeki Benzer Parçalar

Range : Küçük bloklar Domain: Büyük bloklar

Page 59: UBI 516 Advanced Computer Graphics

Resmi Parçalarına Ayırmak

Orjinal resim 4x4 Range Parçaları Orjinal 8x8 Domain parçaları ve

bunların 4x4’e indirgenmiş halleri

Page 60: UBI 516 Advanced Computer Graphics

Parçaların Benzerliği

domainth i':

rangeth i' :

i

i

iii

d

r

edar

Page 61: UBI 516 Advanced Computer Graphics

Parçaların Benzerliği-3

Benzerini arayacağımız Range üsttedir.

Domainler’in orijinal halleri ilk kolonda gösterilmiştir.

Regresyon modeline göre düzeltilmiş domainler ise ikinci sütunda gösterilmiştir.

Yandaki rakamlar residual mean square(rms) değerlerini göstermektedir.

Rms değeri en küçük olan domain eldeki range ile eşleştirilir.

Page 62: UBI 516 Advanced Computer Graphics

Rangeleri Domainler Cinsinden İfade Etmek Benzer Range-Domainler bulunduktan sonra bunlar bir dosyada

saklanarak resim bilgisini oluştururlar. Örnek resmimiz 320x200x8 = 512,000 bit (64,000 byte) içeriyor. Domain numaraları 0-999 arasında olduğu için 10 bitle ifade edilebilir. Parlaklık ve konrast tamsayıya çevrilip, 0-15 ve 0-31 aralığında

kuantize edilirse, 4 ve 5 bitle ifade edilebilir. Dolayısıyla, 4000 Range’e karşılık gelen Domain bilgilerini dosyaya

yazarsak :4000*(Domain Numarası+Parlaklık+Kontrast)= 4000*(10+4+5) = 76,000 bit (9,500 byte) olmaktadır.

512/76 = 6.73:1, (512-76)/512 = %85 sıkıştırmak demektir, üstelik %85 sıkıştıran diğer algoritmalardan çok daha iyi bir kalitede !

Page 63: UBI 516 Advanced Computer Graphics

Görüntü Kalitesi

Decompression, siyah bir ekrandan başlanarak 8-10 iterasyonla gerçekleştirilir.

Resmin kalitesi sonucun orjinale ne kadar yakın olduğuna yani herbir Range-Domain çiftinin ne kadar benzer olduk-larına bağlıdır.

Page 64: UBI 516 Advanced Computer Graphics

Decompression: Iteration-1

Page 65: UBI 516 Advanced Computer Graphics

Decompression: Iteration-2

Page 66: UBI 516 Advanced Computer Graphics

Decompression: Iteration-3

Page 67: UBI 516 Advanced Computer Graphics

Decompression: Iteration-10

Page 68: UBI 516 Advanced Computer Graphics

Aynı Resimden Daha Fazla Domain Elde Etmek : Domain Transformasyonları

Range’e uygun Domaini ararken Domainleri olduğu gibi bırakmayıp transformasyon işlemlerine sokabiliriz.

Orjinal, 90o, 180o ve 270o derece döndürülür.

X eksenine göre yansımaları alınır.

Elde edilen 8 ayrı Domainin negatifi alınarak, bir Domain-den hareketle 16 farklı Domain elde edilir.