New Methods in Fractal Imaging Michael F. Barnsley, John Hutchinson Australian National University
Abstract
met by certain pairs of IFSs and result in sometimes beautiful continuous transformations between pictures. For example, animated cloudscapes may be produced using a single fractal homeomorphism plus a single input picture of the sky. (iii) V -variable fractals, discussed in Section 5, provide a bridge from IFS attractors to "random" fractals. The symbol V represents a positive integer which describes the amount of randomness of a V -variable fractal. These fractals may be used to provide random variants of a picture or structure. As an example we illustrate how diverse textures can be generated from a single input texture, and how an infinite collection of random synthetic human faces by may defined by a single input image and sampled using random iteration.
In this paper we draw attention to some recent advances in fractal geometry and point out several ways in which they apply to digital imaging. Simple applications include a method for animating backgrounds in the production of synthetic content, including seascapes, forests, and skies; a novel low-cost technique for creating animated talking heads with unique look-and-feel; and the sharing of engaging graphics, at low bandwidth, between wireless devices such as cellphones. These advances make use of an addressing system which may be associated with the "top" of the attractor of an iterated function system (IFS). Previous computer graphics applications of IFS theory have focused on models based on the attractors and the invariant measures of IFSs. The addressing system enables the establishment of mappings between attractors; it is these trans- 2 Tops Functions formations, rather than the attractors themselves, that underlie the digital imaging ideas introduced here. Let an iterated function system (IFS) be denoted
1
F := {X; f1 , ..., fN }.
Introduction
(1)
This consists of a finite of sequence of one-to-one contraction mappings fn : X → X acting on a compact metric space (X, d) with metric d so that for some 0 ≤ l < 1 we have d(fn (x), fn (y)) ≤ l · d(x, y) for all x, y ∈ X, for n = 1, 2, ..., N . It is well-known [13] that there exists a unique non-empty compact set AF ⊂ X, called the attractor of the IFS, such that
Fractal geometry has previously provided methods for generating digital images which represent terrains, cloud textures and plants; see for example [14], [15], [16] and [17]. Here we report on the relevance of three new mathematical discoveries to modelling and rendering synthetic digital images. The discoveries relate to IFS theory, see for example [13], [2] and [5]. IFS theory, briefly described in Section 2, has been applied to computer graphics, see for example [4] and [11], and to image compression, see for example [3] and [6]. We refer to the new discoveries as (i) fractal tops [8], (ii) the fractal homeomorphism theorem [10] and (iii) V variable fractals [7]. (i) The theory of fractal tops, discussed in Section 2, provides a useful mapping from an IFS attractor into the associated code space. It may be applied to assign colours to the IFS attractor via a method which we refer to as colour-stealing, see Section 3. (ii) The fractal homeomorphism theorem, discussed in Section 4, yields conditions under which two different IFS attractors are homeomorphic. The conditions are
AF =
[ n
fn (AF ).
Let the associated code space be denoted by Ω. This consists of infinite sequences of symbols {σk }∞ k=1 belonging to the alphabet {1, ..., N }. We write σ = σ1 σ2 σ3 ... ∈ Ω to denote a typical element of Ω, and we write ωk to denote the k th element of ω ∈ Ω. Then (Ω, dΩ ) is a compact metric space, where the metric dΩ is defined by dΩ (σ, ω) = 0 when σ = ω and dΩ (σ, ω) = 2−k when k is the least index for which σk 6= ωk . We order the elements of Ω according to σ < ω iff σk > ωk 1
where k is the least index for which σk 6= ωk . This is a linear ordering, sometimes called the lexicographic ordering. Let φF denote the associated code space function [13]. Then φF : Ω → AF is the continuous onto function defined by φF (σ) = lim fσ1 ◦ fσ2 ◦ ...fσk (x) k→∞
for some x ∈ X. The limit is independent of the choice of x. The set of codes of a point x ∈ AF , namely φ−1 F (x) := {σ ∈ Ω : φF (σ) = x}, is compact and possesses a unique largest element τF (x). We call τF : AF → Ω the tops function [8] of the IFS. The set τF (Ω) is shift-invariant and as a consequence there are efficient algorithms for approximation of τF , see [10]. (A subset Θ ⊂ Ω is called shift-invariant when Θ = {σ2 σ3 ... ∈ Ω : σ1 σ2 σ3 ... ∈ Θ}.) The tops function of an IFS may be used to assign colours to its attractor. It can also be used to construct homeomorphisms between attractors. For the Figure 1: Attactor of an IFS rendered by indexing (top rest of this paper we restrict attention to the case where left), measure theory (top right) and colour-stealing 2 X = ¤ := {(x, y) ∈ R : 0 ≤ x ≤ 1, 0 ≤ y ≤ 1} and the (bottom left). The image at lower right is the one from transformations which comprise IFSs are affine. which the colours were stolen.
3
Colour-Stealing is "almost continuous": the map φG is continuous with respect to the natural topology on code space and τF is continuous at points of AF which do not belong to a certain countable set of boundaries, see Chapter 4 of [10]. These boundaries may be revealed when colourstealing is applied, and may combine harmoniously with the forms and colours in the picture Q. If the picture Q is transformed by a continuous transformation, for example by a horizontal translation, then the picture P changes almost-continuously. See for example the bottom left image in Figure 2. Animations, which can be produced by steadily translating Q while holding F and G fixed, may seem quite beautiful. See for example [9].
Two well-known methods by which colours may be assigned to the attractor AF of an IFS F are by indexing, where each point x ∈ AF is coloured according to the value of n such that x ∈ fn (AF ), see for example [11], and by using measure theory, see [4]. Indexing does not work when the attractor of the IFS is overlapping, and the measure theory method is expensive to compute. The new method, colour-stealing, applies in all cases, is cheap to compute and very versatile. Pictures produced using colour-stealing may be beautiful and possess distinctive look-and-feel, see Figures 1 and 2. Colour-stealing is defined as follows. Let G := {¤; g1 , ..., gN } denote a second IFS and let Q : ¤ → C denote a picture on ¤, namely a function whose domain is ¤ and whose range lies in a colour-space C such as C = {0, 1, 2, ..., 255}3 . Let AG ⊂ ¤. Then we define a new picture P : AF → C by
4
Fractal homeomorphisms
In certain cases the transformation φG ◦ τF : AF → AG is a homeomorphism. That is, φG ◦ τF is a one-toone continuous transformation from AF onto AG and its inverse, given by φG ◦ τF is also continuous. One situation where this occurs may be described as follows. Let us write U to denote the closure of a subset U ⊂ Ω with respect to the metric dΩ . Let EF (σ) = {ω ∈ τF (AF ) : φF (ω) = φF (σ)} for all σ ∈ Ω. Let SF = {EF (σ) : σ ∈ Ω}. We call the set of subsets SF the code space structure of the IFS F. The frac-
P(x) = Q(φG (τF (x)) for all x ∈ AF . That is, informally, each code (address) ω ∈ Ω is assigned the colour of the point on the attractor of G given by this code. Each point on the attractor of F is then given the colour of the "top" code (address) of this point. We say that the colours of P have been stolen from Q, and we call P a stolen picture. The unique look-and-feel of stolen pictures derives in part from the property that the transformation φG ◦ τF 2
Figure 3: The ranges of the two IFSs used to make the fractal homeomorphism in the pictures of New York.
obtained by translating the original cloud picture sideways.
5
V-Variable Fractals
Rather than describing the full theory of V -variable Figure 2: The top left image P is the attractor of an IFS fractals and superfractals here, we consider the case F of three affine transformations, rendered by colour- V = 1, previously noted in [1] and [12], and we refer stealing from the image Q at top right. The IFS G, used to [7] and [10] for the generalization to V ≥ 1. Let to select the stolen colours, is similar to but distinct n } Fn = {¤; f1n , f2n , ..., fM from F. The image at lower left is a 2× zoom on P. The image at lower right is a 4× zoom, but the IFS G denote an IFS for each n ∈ {1, 2, ..., N }. Let H denote has been replaced by T GT −1 where T is a horizontal the nonempty compact subsets of ¤, and let denote translation. Fn : H → H denote the function defined by Fn (B) = S n fm (B) for all B ∈ H, for each n ∈ {1, 2, ..., N }. Then m
Fn : H → H is a strict contraction mapping with respect to the Hausdorff metric on H and tal homeomorphism theorem, see Chapter 4 of [10], includes the statement that if the two IFSs F and G have (2) F : ={H : F1 , F2 , ..., FN } the same code space structure then φG ◦ τF is a homeomorphism. Roughly speaking this says that if the sym- is an IFS. The attractor AF of F is a set of sets and is bolic dynamical systems associated with the tops of the an example of what we call a superfractal. In contrast, two IFSs are topologically conjugate, then the attrac- the attractor AF of the IFS in Equation 1 is a set of points, a single fractal. tors of the IFSs are homeomorphic. The elements of AF may be sampled by means of a We illustrate applications of this theorem in Figrandom iteration algorithm, analogously to the way in ures 4 and 5. To construct Figure 4, the pictures P which the points of AF may be sampled by the chaos and Q are rescaled so that their domains are both game, [5]. Let pn > 0 for all n ∈ {1, 2, ..., N }, with ¤, and each of the IFSs F = {¤; f1 , f2 , f3 , f4 } and P p = 1. Then let B0 ∈ H and define a sequence G = {¤; g1 , g2 , g3 , g4 } consists of four affine transfor- n n mations which map ¤ into itself in such a way that ¤ {Bk }∞ k=0 by Bk+1 = Fσk (Bk ) for k = 0, 1, 2 where σk is neatly tiled by the four sets f1 (¤), f2 (¤), f3 (¤) and is chosen equal to n with probability pn , independently f4 (¤), and by the four sets g1 (¤), g2 (¤), g3 (¤) and of all other choices. Then two things happen: the elg4 (¤), as illustrated in Figure 3. It is straightforward to ements of the sequence {Bk }∞ k=0 approximate elements prove that the code space structures associated with the of AF , being assuredly more and more accurate with intwo IFSs are the same. Similarly, two tilings of a trian- creasing values of k; and the asymptotic distribution of gle by four triangles are used to construct the homeo- the Bk s is, almost always, the same, namely a certain morphism between the top two images in Figure 5. The probability measure supported on AF . This result is iltwo rectangular images are frames from an animation lustrated in Figure 6 where we show, from left to right, 3
Figure 5: Top two triangular images show before and after a fractal homeomophism of a triangle to a triangle. The two rectangular images are frames of an animation produced from the original cloud picture.
sulting sequence of vectors of subsets of ¤ converges, almost always, to the same stationary distribution. The components of the stationary vectors are called V variable fractal sets and the set consisting of all of them is called a superfractal. The distribution of elements occuring in any fixed component defines a certain measure on the superfractal which depends only on the probabilities and is correctly sampled by the random construction. As V tends to infinity this distribution converges, in the appropriate sense, to a probability distribution on truly random fractal sets, [7]. For computer graphics applications, low values of V seem to be particularly useful, as illustrated by the case V = 1, above.
Figure 4: Before (lower image) and after (upper image) a fractal homeomorphism. See text. The original photo of New York was obtained from BigStockPhoto.com, and its copyright is owned by Brian Kelly.
from top to bottom, B0 , B1 , ..., B11 . These sets have been rendered using a version of colour-stealing. In this case N = 2 and M = 4. Each of the IFSs is defined by a tiling of a triangle by four triangles, and the superfractal AF consists of an uncountable collection of pictures of faces. The random iteration algorithm starts out on a polygonal set and, while more and more accurately representing members of the collection of faces, approximately samples the collection according to a certain fixed probability distribution. In Figure 7 we illustrate synthetic marble textures obtained by using three IFSs of affine maps, each corresponding to a different tiling of a triangle by triangles. In the case V > 1 a more complicated random construction is used. We construct a sequence of vectors of sets {(B1k , B2k , ..., BVk ) ∈ HV }∞ k=0 , where 0 0 0 (B , B , ..., B ) is chosen arbitrarily and Bvk+1 = 1 2 V S σk,v k fm (Blm ) where lm is selected randomly from
6
Concluding Remarks
We have described briefly some new results in IFS theory including the concept of the tops function, colourstealing, fractal transformations, and superfractals. For the interested researcher, a much fuller introduction to this underlying mathematics is provided in [10]. We point out here that, although the mathematical structures involved may seem at first to be abstract and difficult, the practical methods which they lead to, based on the chaos game, are simple to implement. We have illustrated a few of many potential applications. Our goal has been to expose original ideas, based on IFS addressing structures and the fractal concept of describing objects by the relationships between m {1, 2, ..., V } and σk,v equals n with probability pn , each their parts, self-referentially. This approach is quite dischoice being independent of all other choices. The re- tinct from classical computer graphics wherein models 4
Figure 7: Four synthetic marble textures constructed using 1-variable fractals.
[4] Barnsley, M. F.; Reuter, L.; Jacquin, A.; Malassenet, F.; Sloan, A. Harnessing chaos for image synthesis, Computer Graphics, 22 (1988), 131— 140.
Figure 6: Sequence of images produced by random iteration on a superfractal, converging to a sequence of subtly different faces.
[5] Barnsley, M. F. Fractals everywhere. Second edition. Revised with the assistance of and with a forward by Hawley Rising, III. Academic Press Professional, Boston, MA, 1993.
are built up from geometrical primitives, and leads generally to rendered images with distinctive look-and-feel. Although we have emphasized computer graphics examples, there are clearly potential applications in other areas of digital imaging, including encryption, enhancement, watermarking, and compression.
[6] Barnsley, M.F; Hurd, L. P. Fractal image compression, AK Peters, Boston, MA, 1993. [7] Barnsley, M.; Hutchinson, J.; Stenflo, Ö. A fractal valued random iteration algorithm and fractal hierarchy. Fractals, 13 (2005), no. 2, 111—146.
References [1] Asai, T. Fractal image generation with iterated function set. Ricoh Technical Report No. 24, November 1998, 6—11.
[8] Barnsley, M. F. Theory and application of fractal tops. 3—20, Fractals in Engineering: New Trends in Theory and Applications. Lévy-Véhel J.; Lutton, E. (eds.) Springer-Verlag, London Limited, 2005.
[2] Barnsley, M. F.; Demko, S. Iterated function systems and the global construction of fractals. Proc. Roy. Soc. London Ser. A 399 (1985), no. 1817, 243— 275.
[9] Barnsley, M. F.; Barnsley, L. F.; Xie, R. Colourstealing animations, www.superfractals.com [10] Barnsley, M. F. Superfractals. Cambridge University Press, Cambridge, New York, Melbourne, 2006.
[3] Barnsley, M. F; Sloan, Alan D. A better way to compress images. Byte Magazine, January 1988. 5
[11] Demko, S.; Hodges, L.; Naylor, B. Constructing fractal objects with iterated function systems. Computer Graphics 19 (1985), 271-278. [12] Hambly, B. M. Brownian motion on a random recursive Sierpinski gasket. Ann. Probab. 25 (1997), no. 3, 1059-1102. [13] Hutchinson, J. E. Fractals and self-similarity. Indiana Univ. Math. J. 30 (1981), no. 5, 713—747. [14] Mandelbrot, B. B. The fractal geometry of nature. W. H. Freeman Publishing Company, San Francisco, 1983. [15] Peitgen, H. -O.; Richter, P. H. The beauty of fractals. Images of complex dynamical systems. Springer-Verlag, Berlin, 1986. [16] Prusinkiewicz, P.; Lindenmayer, A. The algorithmic beauty of plants. With the collaboration of J. S. Hanan, F. D. Fracchia, D. R. Fowler, M. J. M. de Boer and L. Mercer. The Virtual Laboratory. Springer-Verlag, New York, 1990. [17] Stewart, I.; Clarke, A. C.; Mandelbrot, B. B.; Barnsley, M. F.; Barnsley, L. F.; Rood, W.; Flake, G.; Pennock, D.; Prechter, R. R.; Lesmoir-Gordor, N.. The beauty and power of fractals. Clear Books, London, 2004.
6