The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance...

104
The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    213
  • download

    0

Transcript of The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance...

Page 1: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

The Batik Trick

a Physically Plausible Simulation of Traditional Batik Painting

using

Distance Transforms, Distance Transforms, and Distance Transforms

by

Brian Wyvill and Kees van Overveld

Page 2: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

contents

1. The Art of Batik Painting

2. The Visual Effects and their Causes

3. Distance Transforms

4. A Batik Simulator

5. Results, Conclusions and Summary

Page 3: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

1.The Art of Batik Painting

Batik (American: ba-teek’; Correct: bah’-tik)

•origins unknown; 2000 years old; Middle-east, India or Central Asia?

•most prevalent: Indonesian island of Java; since 14th or 15th century• http://www.story-of-batik.com/html/history_of_batik.html

Page 4: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

1.The Art of Batik Painting

Page 5: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

1.The Art of Batik Painting

the wax-gorithm:

while (not ready){

dye entire cloth with color C;

for(p in uncovered region) p.color *= C;

wash off color on wax-covered areas (if any);

cover part of exposed region with wax;

if(expensive || just for fun) remove wax from some regions;

}

correct mistakes or add painted details;

sell;

// you should be rich now !!!

Page 6: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

1.The Art of Batik Painting

example

Page 7: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

2.The Visual Effects and their Cause

(the phenomenology of dye absorption and wax cracking)

Page 8: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

2.The Visual Effects and their Cause

(the phenomenology of dye absorption and wax cracking)

non-homogenous cloth absorption rates:

Page 9: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

2.The Visual Effects and their Cause

(the phenomenology of dye absorption and wax cracking)

non-homogenous cloth absorption rates:

cracks occur in time-order

... because crack-propagation is a causal process: cracks run until they encounter another (earlier) crack or the bound of the wax

instead of all-at-once

so there are few crack crossings but most T-junctions

Page 10: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

2.The Visual Effects and their Cause

(the phenomenology of dye absorption and wax cracking)

non-homogenous cloth absorption rates:

cracks occur in time-order

cracks often end in maximally concave regions of wax borders

...because it is energetically cheap to have shorter cracks

..instead of...

Page 11: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

2.The Visual Effects and their Cause

(the phenomenology of dye absorption and wax cracking)

non-homogenous cloth absorption rates:

cracks occur in time-order

cracks often end in maximally concave regions of wax borders

cracks erode, so older cracks result in wider dye traces than younger cracks

Page 12: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

2.The Visual Effects and their Cause

(the phenomenology of dye absorption and wax cracking)

non-homogenous cloth absorption rates:

cracks occur in time-order

cracks often end in maximally concave regions of wax borders

cracks erode, so older cracks result in wider dye traces than younger cracks

junction regions are fragile, so wax breaks off, leaving widened ‘younger’ crack ends

Page 13: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

2.The Visual Effects and their Cause

(the phenomenology of dye absorption and wax cracking)

non-homogenous cloth absorption rates

cracks occur in time-order

cracks often end in maximally concave regions of wax borders

cracks erode, so older cracks result in wider dye traces than younger cracks

junction regions are fragile, so wax breaks off, leaving widened ‘younger’ crack ends

...this will be achieved by an appropriate noise function

Page 14: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

2.The Visual Effects and their Cause

(the phenomenology of dye absorption and wax cracking)

non-homogenous cloth absorption rates

cracks occur in time-order

cracks often end in maximally concave regions of wax borders

cracks erode, so older cracks result in wider dye traces than younger cracks

junction regions are fragile, so wax breaks off, leaving widened ‘younger’ crack ends

...whereas various Distance Transforms will be used for these

Page 15: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(Jack-of-all-trades in image processing)

Page 16: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(Jack-of-all-trades in image processing)

formal definition:

for a set S, and a metric | , |: S S

and a subset VS, we define

s, sS: D(s)=MIN(v:v V:|s-v|)

Page 17: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(examples)

in geometry:

L1 -metric L2 -metric L -metric

arb. shape V small D: V’s border small D: V’s border small D: V’s border

large D: diamond large D: circle large D: square

for small distance D: for large distance D:

Page 18: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(observations)

•distance transform models decreasing influence at larger D: shape details are lost (Huygens’ principle)

•shape of (D=const)-contour dominates for large D

•distance transform is related to

• Minkowsky sum

• Voronoi diagram

• low-pass filtering & multi-scale

• implicit surfaces

• Dijsktra’s shortest path (discrete S)

•most preferred metric: L2 (independent of coordinate system)

•brute force calculation requires O(|S||V|) calculations

•approximations require O(n |S|) calculations

Page 19: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

a two-pass algorithm for the Distance Transform:

for(pixel p in V) D(p)=0;

for(pixel p in S\V) D(p)=infinity;

for(pixel p: scan from top left to bottom right){

for(pixel n in upper left half Neighborhood(p))

if(D(n)+|n-p|>D(p))D(p)=D(n)+|n-p|;

}

for(pixel p: scan from bottom right to top left){

for(pixel n in lower right half Neighborhood(p))

if(D(n)+|n-p|>D(p))D(p)=D(n)+|n-p|;

}

(optionally, smooth D(p) with a suitable relaxation)

Page 20: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0

0 0

0 0

Page 21: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0

0 0

0 0

Page 22: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0

0 0

0 0

Page 23: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1

0 0

0 0

Page 24: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1

0 0

0 0

Page 25: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41

0 0

0 0

Page 26: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0

0 0

Page 27: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0

0 0

Page 28: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1

0 0

Page 29: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41

0 0

Page 30: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0

Page 31: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0

this is

wrong: it should be 2.82. Don’t p

anic,

this is wrong: it

should be 2.82. Don’t panic,

just wait a

nd see

just wait a

nd see

Page 32: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1

Page 33: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

Page 34: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41

Page 35: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1

Page 36: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1

Page 37: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41

Page 38: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41 2.41

Page 39: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41 2.41

2.82

Page 40: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41 2.41

2.82 2.41

Page 41: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41 2.41

2.82 2.41 2

Page 42: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41 2.41

2.82 2.41 2 2

Page 43: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41

Page 44: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.82

Page 45: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.82

next we revert the scanning direction

Page 46: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.42

0 0 1 2

1.41 1 1 1.41 2.41

3.82 2.82 2.41 2 2 2.41 2.82

Page 47: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

Page 48: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

Page 49: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

1

Page 50: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

12

Page 51: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

Page 52: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

1

Page 53: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

Page 54: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41 3.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

Page 55: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.82

See? Told you everything w

as going to

be

See? Told you everything w

as going to

be

OKOK

Page 56: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.821

Page 57: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

Page 58: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

3.82

Page 59: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.82 3.82

Page 60: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41 3.82

Page 61: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.412 3.82

Page 62: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.4121 3.82

Page 63: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.41 3.82

Page 64: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.412.41 3.82

Page 65: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.412.41 3.82

4.23

Page 66: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.412.41

3.82

3.82

4.23

Page 67: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.412.41

3.823.41

3.82

4.23

Page 68: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.412.41

3.823.413

3.82

4.23

Page 69: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.412.41

3.823.4132

3.82

4.23

Page 70: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.412.41

3.823.41322.41

3.82

4.23

Page 71: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(fast approximation)

0 1 1.41 2.41

0 0 1 1.41 2.41

0 0 1 2

3.41 2.41 1.41 1 1 1.41 2.41

2.82 2.41 2 2 2.41 2.823.82

123

12

2.8212

2.822.41211.412.41

3.823.41322.412.82

3.82

4.23

Page 72: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(related algorithms)

•the distance transform can be turned into an identity+distance transform (IDT) by also keeping track of the identity of the closest object Vi: this is a discrete approximation to the Voronoi diagram with arbitrary initial objects.

remember:

for(pixel p in V ) D(p)=0;

for(pixel p in S\ V ) D(p)=infinity;

for(pixel p: scan from top left to bottom right){

for(pixel n in upper left half Neighborhood(p))

if(D(n)+|n-p|>D(p)) D(p)=D(n)+|n-p|;

}

(and similar for other half)

Page 73: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(related algorithms)

•the distance transform can be turned into an identity+distance transform (IDT) by also keeping track of the identity of the closest object Vi: this is a discrete approximation to the Voronoi diagram with arbitrary initial objects.

remember:

for(pixel p in Vi) {D(p)=0;Id(p)=Vi; }

for(pixel p in S\{Vi}) {D(p)=infinity; Id(p)= ‘none’;}

for(pixel p: scan from top left to bottom right){

for(pixel n in upper left half Neighborhood(p))

if(D(n)+|n-p|>D(p)) {D(p)=D(n)+|n-p|;

Id(p) = Id(n);

}

}

(and similar for other half)

Page 74: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

3.Distance Transforms

(related algorithms)

•the distance transform can be turned into an identity+distance transform (IDT) by also keeping track of the identity of the closest object Vi: this is a discrete approximation to the Voronoi diagram with arbitrary initial objects.

•after D(s) is computed, it tells the shortest distance to the border of V. D(s) allows local updating in case of local modifications of V.

•larger neighborhoods give better approximation to circular (D(s)=const)-contours

3 x 3, 4-connected: square;

3 x 3, 8-connected: 8-gon,

5 x 5, 24-connected: 16-gon,

7 x 7, 48-connected: 32-gon, etc.

Page 75: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(architecture)

Page 76: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(architecture)

•the Batik process simulation consists of two phases:

•generating cracks

•applying a next dye bath, taking the recent cracks into account

Page 77: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation)

•crack initialization

•crack propagation

•crack tuning

Page 78: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack initialization)

V = current wax distribution;

generate D(s);

while(not enough cracks){

pick random point p V;

// The chance to pick a cell is proportional to the area

// of the cell. This results in uniform average cell areas.

while (n Neighbors(p), D(n)>D(p))p=n;

// D(p) is local maximum of the Distance Transform (DT)

find direction d of steepest descent;

propagateCrack(p,d,-d);

// Every crack ends at the border of the cell it started in.

// Rationale: cracks start far from border where stress

// is high

update DT (only in the environment of recent crack)

}

Page 79: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation)

propagateCrack(p,d[0],d[1]){

// have two halves of the crack run simultaneously

p[0]=p[1]=p;

while(not ready){

for(j=0;j<2;j++)if(p[j] in wax (=not on a crack or off wax)){

step p[j] in direction d[j];

estimate d[j] based on local distance gradient;

// rationale: this ensures shortest way to the border of the cell,

// therefore to maximally curved local concavities (if any)

perturb d[j] with IIR-filtered noise

}

}

}

Page 80: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation; cont.-d)

the pixels labeled with black squares are labeled as ‘on a crack’;

their distance values D(s) are sub-pixel accurate;

the formed crack is the red polyline with sub-pixel coordinates;

the blue squares indicate pixels used for computing D(s) and the next positions of p[j]

p[0]

Page 81: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation; cont.-d)

the pixels labeled with black squares are labeled as ‘on a crack’;

their distance values D(s) are sub-pixel accurate;

the formed crack is the red polyline with sub-pixel coordinates;

the blue squares indicate pixels used for computing D(s) and the next positions of p[j]

Page 82: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation; cont.-d)

the pixels labeled with black squares are labeled as ‘on a crack’;

their distance values D(s) are sub-pixel accurate;

the formed crack is the red polyline with sub-pixel coordinates;

the blue squares indicate pixels used for computing D(s) and the next positions of p[j]

Page 83: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation; cont.-d)

the pixels labeled with black squares are labeled as ‘on a crack’;

their distance values D(s) are sub-pixel accurate;

the formed crack is the red polyline with sub-pixel coordinates;

the blue squares indicate pixels used for computing D(s) and the next positions of p[j]

Page 84: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation; cont.-d)

the pixels labeled with black squares are labeled as ‘on a crack’;

their distance values D(s) are sub-pixel accurate;

the formed crack is the red polyline with sub-pixel coordinates;

the blue squares indicate pixels used for computing D(s) and the next positions of p[j]

Page 85: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation; cont.-d)

the pixels labeled with black squares are labeled as ‘on a crack’;

their distance values D(s) are sub-pixel accurate;

the formed crack is the red polyline with sub-pixel coordinates;

the blue squares indicate pixels used for computing D(s) and the next positions of p[j]

Page 86: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation; cont.-d)

the pixels labeled with black squares are labeled as ‘on a crack’;

their distance values D(s) are sub-pixel accurate;

the formed crack is the red polyline with sub-pixel coordinates;

the blue squares indicate pixels used for computing D(s) and the next positions of p[j]

Page 87: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack propagation; cont.-d)

...etcetera

until we reach a pixel that is already on a crack or off the wax

Page 88: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack tuning)

we account for two additional effects:

•the age of a crack for age-dependent width of the dye track

•widening the junction between a crack and an older crack

Page 89: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack tuning; age administration)

During crack propagation, store ‘age of the crack’(=inverse of crack counter) as an identification tag in all ‘crack’ pixels.

After all cracks are generated, use identity+distance transform to attribute, to each pixel p, the age of the crack C to which p is closest, together with the distance to C.

prior to IDT: pixels are labeled as ‘wax’ or ‘crack’; only ‘crack’-pixels know their age

after IDT: all pixels have an ‘age’ label set. ‘wax’-pixels know both the distance to the closest crack and the age of that crack.

Page 90: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack tuning; age administration)

prior to IDT: pixels are labeled as ‘wax’ or ‘crack’; only ‘crack’-pixels know their age

after IDT: all pixels have an ‘age’ label set. ‘wax’-pixels know both the distance to the closest crack and the age of that crack.

And now it’s time for some serendipity:

the wedge-shaped generalized Voronoi shapes look just like typical batik-type

irregularities in dye-absorption near the wax cracks!

Page 91: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack tuning; junction administration)

D(s) tells how far s lies from the nearest junction with the border or the nearest older crack: there, D( )=0.

During crack propagation, label crack pixels p with info about their distance to the nearest junction (‘d2j’) iff D(p)<THRESHOLD.

Similar as with ‘age’, distribute the values of d2j also to non-’crack’-pixels, using a (modified) distance transform. However, this time decrease rather than increase the distance attribute.

D(p)D(p)

Border of the cell: D( )=0

THRESHOLD-D(p)THRESHOLD-D(p)

Distance along the crack

d2j=Max(0,THRESHOLD-D(p))d2j=Max(0,THRESHOLD-D(p))

THRESHOLD

Page 92: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(crack generation: crack tuning; junction administration)

D(s) tells how far s lies from the nearest junction with the border or the nearest older crack: there, D( )=0.

During crack propagation, label crack pixels p with info about their distance to the nearest junction (‘d2j’) iff D(p)<THRESHOLD.

Similar as with ‘age’, distribute the values of d2j also to non-’crack’-pixels, using a (modified) distance transform. However, this time decrease rather than increase the distance attribute.

junction

prior to modified distance transform: only ‘crack’-pixels have a valid d2j-attribute

after modified distance transform: all pixels have a valid d2j-attribute which is propagated outwards and decreased with distance to the crack.

Page 93: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(summary of crack generation)

•as we saw, the Batik process simulation consists of two phases:

•generating cracks

•crack initiate

•crack propagate

•crack tuning

•age administration

•junction administration

•applying a next dye bath, taking the recent cracks into account

Page 94: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(dye application; color model)

Dyes may be modeled as color filters:

substrate

dye 2: yellow

dye 1: dark orange

r=100r=100

g=100g=100

b=100b=100

r=90r=90

g=90g=90

b=40b=40

r=90r=90

g=90g=90

b=10b=10

transmit: r *=0.9; g*=0.9; b*=0.4

transmit: r *=1.0; g*=1.0; b*=0.25

reflect: r *=0.9; g*=0.9; b*=0.9

r=0.81r=0.81

g=0.81g=0.81

b=0.09b=0.09

r=0.81r=0.81

g=0.81g=0.81

b=0.02b=0.02

r=0.72r=0.72

g=0.72g=0.72

b=0.008b=0.008

So we model color filtering by means of component-wise multiplication of dye colors

Page 95: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(dye application; algorithm)

if(p off wax){

col = dyeColor;

} else {

d2c = distanceToNearestCrack; // using D(p)

aof = ageOfNearestCreack; // using age(p)

d2j = distanceToNearestJunction // using d2j(p)

amp = computeIntensityOfColorToBeApplied (d2c,aof,d2j);

// decreases with d2c; increases with aof;

// increases with d2j;

col = dyeColor * clamp(amp, 0%, 100%)

}

modulate col with a bandwith filtered noise function;

apply to pixel p using multiplicative color model;

Page 96: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

4.A Batik Simulator

(external controls)

The R,G,B channels in the input images constitute process control parameters:

•red: R(x,y)=0: no wax; R(x,y)>0: thickness of the wax (crack width is multiplied with R(x,y))

•green: in the crack initialization, random candidates are taken iff

rand(0...1) > G(x,y). So expected cell size is proportional to G(x,y)

•blue: during crack propagation, the path direction is randomly perturbed with an IIR-filtered random sequence. The random amplitude is B(x,y)

Page 97: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

5.Summary and Conclusions

1. The batik simulator gives convincing batik-type modification of flat-colored, segmented images

2. The various mechanisms in the batik process can be modeled in terms of geometric operations and re-entrant image processing operations

3. All required algorithms can be straightforwardly derived from the distance transform

4. An open question remains as to the methodological soundness of distance transform-based crack formation compared to finite elements-

based techniques: enter the issue of incommensurable sets of assumptions!

Page 98: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

5.Results and Conclusions

the effect of widening cracks with age

Page 99: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

5.Results and Conclusions (cont)

modulating crack width: the red channel

Page 100: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

5.Results and Conclusions (cont)

modulating crack density: the green channel

Page 101: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

5.Results and Conclusions (cont)

modulating randomness: the blue channel

Page 102: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

5.Results and Conclusions (cont)

the process of building a piece of batik

Page 103: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

5.Results and Conclusions (cont)

Page 104: The Batik Trick a Physically Plausible Simulation of Traditional Batik Painting using Distance Transforms, Distance Transforms, and Distance Transforms.

Questions?