Title: The Batik Trick
1The 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
2- contents
- The Art of Batik Painting
- The Visual Effects and their Causes
- Distance Transforms
- A Batik Simulator
- Results, Conclusions and Summary
31.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_bat
ik.html
41.The Art of Batik Painting
51.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 !!!
61.The Art of Batik Painting
example
72.The Visual Effects and their Cause
(the phenomenology of dye absorption and wax
cracking)
82.The Visual Effects and their Cause
(the phenomenology of dye absorption and wax
cracking)
non-homogenous cloth absorption rates
92.The Visual Effects and their Cause
(the phenomenology of dye absorption and wax
cracking)
non-homogenous cloth absorption rates cracks
occur in time-order
instead of all-at-once
so there are few crack crossings but most
T-junctions
... because crack-propagation is a causal
process cracks run until they encounter another
(earlier) crack or the bound of the wax
102.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
..instead of...
...because it is energetically cheap to have
shorter cracks
112.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
122.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
132.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
142.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
153.Distance Transforms
(Jack-of-all-trades in image processing)
163.Distance Transforms
(Jack-of-all-trades in image processing)
formal definition for a set S, and a metric ,
S ? S ? ? and a subset V?S, we define ?s,
s?S D(s)MIN(vv ?Vs-v)
173.Distance Transforms
(examples)
in geometry
for small distance D
for large distance D
L1 -metric
L2 -metric
L? -metric
183.Distance Transforms
(observations)
- distance transform models decreasing influence at
larger D shape details are lost (Huygens
principle) - shape of (Dconst)-contour dominates for large D
- distance transform is related to
- Minkowsky sum
- Voronoi diagram
- low-pass filtering multi-scale
- implicit surfaces
- Dijsktras shortest path (discrete S)
- most preferred metric L2 (independent of
coordinate system) - brute force calculation requires O(SV)
calculations - approximations require O(n S) calculations
193.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-pgtD(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-pgtD(p))D(p)
D(n)n-p (optionally, smooth D(p) with a
suitable relaxation)
203.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
213.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
223.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
233.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
?
?
?
?
?
0
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
243.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
?
?
?
?
?
0
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
253.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
?
?
?
?
0
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
263.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
?
?
?
0
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
273.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
?
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
283.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
1
?
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
293.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
1
1.41
?
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
303.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
1
1.41
2.41
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
313.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
this is wrong it should be 2.82. Dont panic,
just wait and see
?
?
0
0
1
1.41
2.41
?
?
?
0
0
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
323.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
1
1.41
2.41
?
?
?
0
0
1
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
333.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
1
1.41
2.41
?
?
?
0
0
1
2
?
?
?
?
?
?
?
?
?
?
?
?
?
?
343.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
?
?
?
?
?
?
?
?
?
?
?
353.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
?
?
?
?
?
?
?
?
?
?
363.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
?
?
?
?
?
?
?
?
?
373.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
?
?
?
?
?
?
?
?
383.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
?
?
?
?
?
?
?
393.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
?
?
?
?
?
403.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
?
?
?
?
413.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
?
?
?
423.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
?
?
433.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
?
443.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
453.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
463.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
473.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.82
3.82
483.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.82
3.82
493.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
1
1.41
2.41
?
?
0
0
1
2
1
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
503.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
1
1.41
2.41
?
0
0
1
2
1
2
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
513.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
?
0
0
1
1.41
2.41
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
523.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
?
0
0
1
1.41
2.41
1
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
533.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
543.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
3.41
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
553.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
2.82
0
0
1
1.41
2.41
1
2
See? Told you everything was going to be OK
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
563.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
2.82
1
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
573.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
583.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
?
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
593.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
?
2.82
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
603.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
?
2.82
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
613.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
?
2.82
2.41
2
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
623.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
?
2.82
2.41
2
1
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
633.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
?
2.82
2.41
2
1
1.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
643.Distance Transforms
(fast approximation)
?
?
?
?
?
?
?
2.82
2.41
2
1
1.41
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
653.Distance Transforms
(fast approximation)
?
?
?
?
?
?
4.23
2.82
2.41
2
1
1.41
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
663.Distance Transforms
(fast approximation)
?
?
?
?
?
3.82
4.23
2.82
2.41
2
1
1.41
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
673.Distance Transforms
(fast approximation)
?
?
?
?
3.82
3.41
4.23
2.82
2.41
2
1
1.41
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
683.Distance Transforms
(fast approximation)
?
?
?
3.82
3.41
3
4.23
2.82
2.41
2
1
1.41
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
693.Distance Transforms
(fast approximation)
?
?
3.82
3.41
3
2
4.23
2.82
2.41
2
1
1.41
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
703.Distance Transforms
(fast approximation)
?
3.82
3.41
3
2
2.41
4.23
2.82
2.41
2
1
1.41
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
713.Distance Transforms
(fast approximation)
3.82
3.41
3
2
2.41
2.82
4.23
2.82
2.41
2
1
1.41
2.41
3.82
0
1
1.41
2.41
2.82
1
2
0
0
1
1.41
2.41
1
2
0
0
1
2
1
2
3
3.41
2.41
1.41
1
1
1.41
2.41
2.82
2.41
2
2
2.41
2.82
3.82
723.Distance Transforms
(related algorithms)
- the distance transform can be turned into an
identitydistance 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-pgtD(p)) D(p)D(n)n-p (and
similar for other half)
733.Distance Transforms
(related algorithms)
- the distance transform can be turned into an
identitydistance 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)0Id(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-pgtD(p))
D(p)D(n)n-p Id(p)
Id(n) (and similar
for other half)
743.Distance Transforms
(related algorithms)
- the distance transform can be turned into an
identitydistance 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.
754.A Batik Simulator
(architecture)
764.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
774.A Batik Simulator
(crack generation)
- crack initialization
- crack propagation
- crack tuning
784.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)gtD(p))pn // 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)
794.A Batik Simulator
(crack generation crack propagation)
propagateCrack(p,d0,d1) // have two halves
of the crack run simultaneously p0p1p
while(not ready) for(j0jlt2j)if(pj in
wax (not on a crack or off wax)) step
pj in direction dj estimate dj 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 dj with
IIR-filtered noise
804.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 pj
p0
814.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 pj
824.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 pj
834.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 pj
844.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 pj
854.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 pj
864.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 pj
874.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
884.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
894.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 identitydistance
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.
904.A Batik Simulator
(crack generation crack tuning age
administration)
And now its time for some serendipity the
wedge-shaped generalized Voronoi shapes look just
like typical batik-type irregularities in
dye-absorption near the wax cracks!
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.
914.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)ltTHRESHOLD. 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.
924.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)ltTHRESHOLD. 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.
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.
934.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
944.A Batik Simulator
(dye application color model)
r0.72 g0.72 b0.008
r100 g100 b100
Dyes may be modeled as color filters
transmit r 0.9 g0.9 b0.4
dye 2 yellow
r0.81 g0.81 b0.02
r90 g90 b40
transmit r 1.0 g1.0 b0.25
dye 1 dark orange
r0.81 g0.81 b0.09
r90 g90 b10
reflect r 0.9 g0.9 b0.9
substrate
So we model color filtering by means of
component-wise multiplication of dye colors
954.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
964.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)gt0 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) gt 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)
975.Summary and Conclusions
- The batik simulator gives convincing batik-type
modification of flat-colored, segmented images - The various mechanisms in the batik process can
be modeled in terms of geometric operations and
re-entrant image processing operations - All required algorithms can be straightforwardly
derived from the distance transform - 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!
985.Results and Conclusions
the effect of widening cracks with age
995.Results and Conclusions (cont)
modulating crack width the red channel
1005.Results and Conclusions (cont)
modulating crack density the green channel
1015.Results and Conclusions (cont)
modulating randomness the blue channel
1025.Results and Conclusions (cont)
the process of building a piece of batik
1035.Results and Conclusions (cont)
104Questions?