How to find a Khalimsky-continuous approximation of a real-valued function Erik Melin

Transcription

How to find a Khalimsky-continuous approximation of a real-valued function Erik Melin
How to find a Khalimsky-continuous
approximation of a real-valued function
Erik Melin
U.U.D.M. Report 2004:38
ISSN 1101–3591
Department of Mathematics
Uppsala University
How to find a Khalimsky-continuous
approximation of a real-valued function
Erik Melin
Uppsala University, Department of Mathematics
Box 480, SE-751 06 Uppsala, Sweden
[email protected]
http://www.math.uu.se/~melin
October 2004
Abstract
Given a real-valued continuous function defined on n-dimensional
Euclidean space, we construct a Khalimsky-continuous integer-valued
approximation. From a geometrical point of view, this digitization
takes a hypersurface that is the graph of a function and produces a
digital hypersurface—the graph of the digitized function.
1.
Introduction and background
The increasing use of multi-dimensional images in applications of computer
imagery calls for a development of digital geometry in three dimensions
and higher. In particular, digital curves, surfaces, planes and other digital
counterparts of Euclidean geometrical objects have been extensively studied.
Several different approaches have been used in this study. Historically, the
first attempts to define digital objects were algorithmic; a digital object was
defined to be the result of a given algorithm. We may here mention the
works by Bresenham (1965) and Kaufman (1987). One major drawback of
this approach is that it may be hard to determine the geometrical properties
of the defined objects.
To get precise definitions, a more recent approach is to let digital objects
be defined by their local properties. This point of view is generally graphtheoretic but is often called topological, although no topology is actually
involved. Keywords sometimes used by the advocates of this direction are
topological and geometrical consistency; however, from time to time it is a
little unclear what these concepts really mean. Much has been written in this
field and we have no ambition to provide all significant references. A survey
of the field with many references has been written by Kong and Rosenfeld
(1989). Concerning digital surfaces a pioneering work is Morgenthaler &
1
Rosenfeld’s (1981) paper. This study was continued by Kim (1984), Rosenfeld et al. (1991), Cohen-Or and Kaufman (1995) and by Chen et al. (1999).
A slightly different approach was suggested by Herman (1998). Here, the
space consists of voxels and surface elements (surfels) where the surfels alternatively can be thought of as adjacency relations between voxels. A different
method of describing linear digital objects is through Diophantine inequalities (Reveill`es 1991). This sort of description is often called arithmetic or
analytic.
An important aspect of the subject is the problem of finding a digital
representation of, say, a surface in R3 . This process is sometimes called
discretization and sometimes digitization. There are many ways to perform
digitization but a general goal is that the digitized object should preserve
characteristic properties of the original object. Straight lines in the plane
are naturally of fundamental importance and Rosenfeld (1974) clarified the
properties of the grid intersection digitization of straight lines. A new digitization of straight lines in the plane was suggested by Melin (2003a), where
the digital lines respect the Khalimsky topology. The present paper treats
a generalization of this digitization to higher dimensions. Some advantages
of working in a topological space compared to the purely graph-theoretical
approach has been discussed by for example Kong, Kopperman & Meyer
(1991) and in Kong (2003) it is shown that the Khalimsky topology is in a
sense the natural choice.
2.
Mathematical background
In this section we present a mathematical background for this paper. The
first subsection contains some general topology for digital spaces. After
that, the two following subsections give an introduction to the Khalimsky
topology and to Khalimsky-continuous functions. Some properties of such
functions are proved. The mathematical background is concluded by a result
on continuous extension which is needed.
2.1.
Topology and smallest-neighborhood spaces
In any topological space, a finite intersection of open sets is open, whereas
the stronger requirement that an arbitrary intersection of open sets be open
is not satisfied in general. Alexandrov (1937) considers topological spaces
that fulfill the stronger requirement, where arbitrary intersections of open
sets are open. Following Kiselman (2002), we will call such spaces smallestneighborhood spaces. Another name that has been used is Alexandrov spaces.
Let B be a subset of a topological space X. The closure of B is a very
well known notion, and the closure of B usually denoted by B. In this paper,
we will instead denote the closure of B in X by CX (B). This allows us to
specify in what space we consider the closure and is also a notation dual to
2
NX defined below. The closure of a set is defined to be the intersection of
all closed sets containing it.
Dually, we define NX (B) to be the intersection of all open sets containing
B. In general NX (B) is not an open set, but in a smallest-neighborhood
space it is. Clearly NX (B) is the smallest neighborhood of the set B. If
there is no danger of ambiguity, we will just write N (B) and C(B) instead
of NX (B) and CX (B). If x is a point in X, we define N (x) = N ({x}) and
C(x) = C({x}). Note that y ∈ N (x) if and only if x ∈ C(y).
We have already remarked that N (x) is the smallest neighborhood of x.
Conversely, the existence of a smallest neighborhood around every point implies that an arbitrary intersection of open sets is open; hence this existence
could have been used as an alternative definition of a smallest-neighborhood
space. A topological space X is called connected if the only sets which are
both closed and open are the empty set and X itself. A point x is called
open if the set {x} is open, and is called closed if {x} is closed. If a point x
is either open or closed it is called pure, otherwise it is called mixed.
Two distinct points x and y in X are called adjacent if the subspace
{x, y} is connected. It is easy to check that x and y are adjacent if and only
y ∈ N (x) or x ∈ N (y). Another equivalent condition is y ∈ N (x) ∪ C(x).
The adjacency set in X of a point x, denoted AX (x), is the set of points
adjacent to x. Thus we have AX (x) = (NX (x) ∪ CX (x)) r {x}. Often,
we just write A(x). A point adjacent to x is called a neighbor of x. This
terminology, however, is somewhat dangerous since a neighbor of x need not
be in the smallest neighborhood of x.
Kolmogorov’s separation axiom, also called the T0 axiom, states that
given two distinct points x and y, there is an open set containing one of
them but not the other. An equivalent formulation is that N (x) = N (y)
implies x = y for every x and y. The T1/2 axiom states that all points
are pure. Clearly any T1/2 space is also T0 . Smallest-neighborhood spaces
satisfying the T1 axiom must have the discrete topology and are therefore
not so interesting. A useful observation is that if X and Y are topological
spaces and x ∈ X and y ∈ Y , then NX×Y (x, y) = NX (x) × NY (y) and
similarly for the closure.
2.2.
The Khalimsky topology
We will construct a topology on the digital line, Z, originally introduced
by Efim Khalimsky (see Khalimsky, Kopperman & Meyer (1990) and references there). Let us identify with each even integer m the closed, real
interval [m − 1/2, m + 1/2] and with each odd integer n the open interval
]n − 1/2, n + 1/2[. These intervals form a partition of the Euclidean line R
and we may therefore consider the quotient space. Identifying each interval
with the corresponding integer gives us the Khalimsky topology on Z. Since
R is connected, the Khalimsky line is connected. It follows readily that an
3
even point is closed and that an odd point is open. In terms of smallest
neighborhoods, we have N (m) = {m} if m is odd and N (n) = {n ± 1, n} if
n is even.
Let a and b, a 6 b, be integers. A Khalimsky interval is an interval
[a, b] ∩ Z of integers with the topology induced from the Khalimsky line.
We will denote such an interval by [a, b]Z and call a and b its endpoints. A
Khalimsky arc in a topological space X is a subspace that is homeomorphic
to a Khalimsky interval. If any two points in X are the endpoints of a
Khalimsky arc, we say that X is Khalimsky arc-connected.
Theorem 1. A T0 smallest-neighborhood space is connected if and only if
it is Khalimsky arc-connected.
Proof. See for example Theorem 11 of Melin (2004). Slightly weaker is
Khalimsky, Kopperman & Meyer’s (1990, Theorem 3.2c) result. On the digital plane, Z2 , the Khalimsky topology is given by the product
topology. Points with both coordinates odd are open and points with both
coordinates even are closed. These are the pure points in the plane. Points
with one odd and one even coordinate are mixed. Let us call a point q such
that kq − pk∞ = 1 an l∞ -neighbor of p. We may note that a mixed point p
is connected only to its four pure l∞ -neighbors (p1 ± 1, p2 ) and (p1 , p2 ± 1),
whereas a pure point p is connected to all eight l∞ -neighbors:
(p1 ± 1, p2 ), (p1 , p2 ± 1), (p1 + 1, p2 ± 1) and (p1 − 1, p2 ± 1).
More generally, Khalimsky n-space is Zn equipped with product topology. Here, points with all coordinates odd are open and points with all
coordinates even are closed. Let Pn denote the set of pure points in Zn .
Note that Pn is not a product space: Pn 6= P1n = Zn .
Let ON(p) = {x ∈ A(p); x is open} be the set of open neighbors of a
point p in Zn and similarly CN(p) = {x ∈ A(p); x is closed} be the set
of closed neighbors. The cardinality of a set X is denoted by card(X).
If c is the number of even coordinates in p and d is the number of odd
coordinates, then card(ON(p)) = 2c and card(CN(p)) = 2d . Define also
PN(p) = CN(p) ∪ ON(p) to be the set of all pure neighbors of a point p. A
pure point in Zn has always 2n pure neighbors. For mixed points, however,
the situation is different. In Z2 every mixed point has 4 pure neighbors.
In Z3 a mixed point has 21 + 22 = 6 pure neighbors. But in Z4 a mixed
point may have 21 + 23 = 10 or 22 + 22 = 8 pure neighbors. Obviously,
the number of possibilities increases even more in higher dimension. These
different types of points have different topological properties and may cause
the digitization process to become more complex in higher dimension, cf.
Remark 20.
4
2.3.
Continuous functions
Unless otherwise stated we shall assume that Z is equipped with the Khalimsky topology from now on. This makes it meaningful to consider (for
example) continuous functions f : Z → Z. Continuous integer-valued functions will sometimes be called Khalimsky-continuous, if we want to stress
that a function is not real continuous. We will discuss some properties of
such functions; more details can be found in e.g. (Kiselman 2002). Suppose
that f is continuous. Since M = {m, m + 1} is connected it follows that
f (M ) is connected, but this is the case only if |f (m) − f (m + 1)| 6 1. Hence
f is Lipschitz with Lipschitz constant 1; we say f is Lip-1. Lip-1, however,
is not sufficient for continuity. If y = f (x) is odd, then U = f −1 ({y}) must
be open, so if x is even then x ± 1 ∈ U . This means that f (x ± 1) = f (x).
In a more general setting, this generalizes to the following:
Proposition 2. Let X be a topological space and f : X → Z be a continuous
mapping. Suppose that x0 ∈ X. If f (x0 ) is odd, then f is constant on N (x0 )
and |f (x) − f (x0 )| 6 1 for all x ∈ C(x0 ). If f (x) is even, then f is constant
on C(x0 ) and |f (x) − f (x0 )| 6 1 for all x ∈ N (x0 )
Proof. Let y0 = f (x0 ) be odd. Then {y0 } is an open set. Hence f −1 ({y0 }) is
open and therefore N (x0 ) ⊂ f −1 ({y0 }), that is, f (N (x0 )) = {y0 }. Moreover,
the set A = {y0 , y0 ± 1} is closed. But then the set f −1 (A) is closed also and
this implies that f (x) ∈ A for all x ∈ C(x0 ). The even case is dual. Let us define the length of a Khalimsky arc A to be the number of points
in A minus one, L(A) = card A − 1. Theorem 1 allows us to define the arc
metric on a T0 connected smallest-neighborhood space X to be the length
of the shortest arc connecting x and y in X:
ρX (x, y) = min(L(A); A ⊂ X is a Khalimsky arc containing x and y).
Proposition 3. Let X be a connected, T0 smallest-neighborhood space. If
f is a continuous mapping X → Z, then f is Lip-1 for the arc metric.
Proof. This is Proposition 15 of Melin (2004).
Theorem 4. Let X be a connected, T0 smallest-neighborhood space and
consider a family of continuous mappings fj : X → Z, j ∈ J. If the set
{fj (a); j ∈ J} is bounded for some a ∈ X, then the mappings f? (x) =
inf j∈J fj (x) and f ? (x) = supj∈J fj (a) are continuous.
Proof. We first prove that f? and f ? are finite everywhere. Assume the
contrary and suppose that there is a sequence of indices jk ∈ J, k = 1, 2, . . .
and a point x ∈ X such that fjk (x) → +∞ (for example) as k → ∞. Then
also fjk (a) → +∞, contrary to our assumption, since each fj is continuous
and therefore, by Proposition 3, Lip-1 for the arc metric.
5
To demonstrate continuity, we have to prove that for each x ∈ X we have
NX (x) ⊂ f −1 (NZ (f (x))). Therefore we fix x ∈ X and suppose y ∈ NX (x).
Let f? (x) = m and let j ∈ J be an index such that fj (x) = m.
We consider two cases separately. The relations that come from Proposition 2 are marked with a †. If m is even, then f? (y) 6 fj (y) 6† m + 1.
We may conclude that for any index i ∈ J, we have fi (y) >† m − 1 since
x ∈ C(y) and fi (x) > m. But then f (y) ∈ NZ (m) = {m, m ± 1} as required.
If m is odd, we still have fi (y) > m − 1 for the same reason as above. But
m − 1 is even, so if fi (y) = m − 1, then also fi (x) =† m − 1 < f? (x),
which is a contradiction. Finally, note that f? (y) 6 fj (y) =† fj (x). Hence,
f? (y) = m ∈ NZ (m) and therefore f? is continuous. Continuity of f ? is
proved in the same way. Given a mapping f : X → Y between any two sets, the graph of f is
defined by Gf = {(x, f (x)); x ∈ X} ⊂ X × Y . Suppose now that X and Y
are topological spaces. It is a general topological fact that if f : X → Y is
continuous, then Gf is homeomorphic to X. This means that the graph of a
Khalimsky-continuous map f : Zn → Z is homeomorphic to Zn . An intuitive
interpretation of this is that the graph has no redundant connectedness and
in particular is bubble-free, cf. Andr`es (2003).
2.4.
Continuous extension
We will find use for a result on continuous extension in Khalimsky spaces,
which can be found in Melin (2003b, Theorem 12). To formulate it, we need
first the following definition:
Definition 5. Let A ⊂ Zn and let f : A → Z be a function. Let x and y be
two distinct points in A.
If one of the following conditions are fulfilled for some i = 1, 2, . . . , n,
1. |f (x) − f (y)| < |xi − yi | or
2. |f (x) − f (y)| = |xi − yi | and xi ≡ f (x) (mod 2),
then we say that the function is strongly Lip-1 with respect to (the
points) x and y. If the function is strongly Lip-1 with respect to every
pair of distinct points in A then we simply say that f is strongly Lip-1.
Theorem 6. Let A ⊂ Zn , and let f : A → Z be any function. Then f can
be extended to a continuous function on all of Zn if and only if f is strongly
Lip-1.
3.
Khalimsky-continuous digitization
Let X be a set and Z an arbitrary subset of X. A digitization of X is a
mapping D : P(X) → P(Z). Given a subset A ⊂ X, we think of D(A)
6
as a digital representation of A. In this paper, we will mainly be interested
in the case when X is the Euclidean space Rn and Z is Zn equipped the
Khalimsky topology.
Given a digitization D : P(Rn ) → P(Zn ) and a function f : Rn−1 → R,
we can define a set-valued mapping (Ds f ) : Zn−1 → P(Z) via the graph of
f:
(Ds f )(p) = {m ∈ Z; (p, m) ∈ D(Gf )}.
We would like to construct a integer-valued mapping from this set-valued
mapping. Obviously it may happen that (Ds f )(x) = ∅ for some x, The
set of points where this does not occur is of interest, hence we define the
digitized domain as the set
Dom(Df ) = {p ∈ Zn−1 ; (Ds f )(x) 6= ∅}.
(1)
We shall also assume from now on that the function and the digitization
are such that (Ds f )(x) is a finite set for each x. Under this assumption we
may define two integer-valued mappings, namely an upper digitization of f
D f : Dom(Df ) → Z, z 7→ max(m ∈ L; (z, m) ∈ D(Gf ))
and similarly a lower digitization
D f : Dom(Df ) → L, z 7→ min(m ∈ L; (z, m) ∈ D(Gf )).
If it happens that D f = D f , we can define the restricted digitization
of f at a point as the common value, Df = D f = D f . The digitized
domain is in general not equal to all of Zn−1 and therefore the restricted
digitization need to be extended in some way.
The next task is to define the a digitization (P) that will form the foundation for the remaining parts of this paper. Then the main goal of this
section will be to prove Theorem 14 which states that the following algorithm will result in the desired approximation.
Algorithm 7. Khalimsky-continuous digitization
1. Apply the pure digitization, P, to the graph of f (see (3)) to obtain
the pure points in the digitization of the graph.
2. Extend the obtained function to be defined on all pure points in the
domain. This is a local operation, which depends only on Pf in a
small neighborhood of each pure point. See Definition 10.
3. Extend the digital function to all of Zn using the formulas of Theorem 14. This is again a local operation. 7
(a) H2 (0)
(b) H3 (0)
(c)
(d)
Figure 1: (a) and (b) The sets H2 and H3 . (c) A curve, f (x), that does not
intersect U2 but intersects H2 . (d) The upper image shows the result of the
digitization with H2 , the lower shows what the result would be if only U2
were used (see Definintion 10 on page 10). Thus the inclusion of the open
cube improves the approximation.
The first goal is to define a digitization of Rn into Pn , the set of pure
points in Zn . Let
Un = {x ∈ Rn ; |xi | = 1/2 for i = 1, 2, . . . , n − 1 and xn = 1/2}
and define
Cn =
[
{tx; t ∈ ]−1, 1] }.
x∈Un
Thus Cn is a cross with
2n
arms. Let
Hn (0) = Cn ∪ {x ∈ Rn ; kxk∞ < 1/2},
(2)
be the union of this cross and an open cube in Rn . This definition is illustrated in Fig. 1. Note that Hn (0) is in fact the open cube together with
finitely many (2n−1 ) points added to half of the vertices, i.e.,
Hn (0) = Un ∪ {x ∈ Rn ; kxk∞ < 1/2}.
The reason for us to use (2) as the definition is that from the topological
point of view the important fact is that Hn contain all the diagonal arms
of Cn . The cube only improves the metric approximation as illustrated in
Fig. 1 (c) and (d) and as discussed in Sect. 4.
For each p ∈ Pn let Hn (p) = Hn (0) + p be Hn (0) translated
by the vector
S
p. Note that Hn (p) ∩ Hn (q) is empty if p 6= q and that {Hn (p); p ∈ Pn }
contains every diagonal grid line of the type {tx+p; t ∈ R} where p ∈ Pn and
x is a vector in Un . Note also that if x, y ∈ Hn (p), then −1/2 < xn −pn 6 1/2
and in particular |xn − yn | < 1. Since most of the time, we will consider
a fixed dimension n, we shall just write H(p) instead of Hn (p) to simplify
notation. Using the set H(p), we define the pure digitization of a subset
A ⊂ Rn as:
P(A) = {p ∈ Pn ; H(p) ∩ A 6= ∅}.
(3)
Lemma 8. Suppose that the mapping f : Rn → R is Lip-1 for the l∞ -metric.
Then P f = P f so that Pf = P f = P f can be defined. Furthermore,
Pf is also Lip-1 for the l∞ -metric in Zn .
8
Proof. Let p ∈ Dom(Pf ) ⊂ Zn and suppose that i, j ∈ Z, i 6= j, are integers
such that (p, i) ∈ P(Gf ) and (p, j) ∈ P(Gf ). Then there are x, y ∈ Rn such
that (x, f (x)) ∈ H(p, i) and (y, f (y)) ∈ H(p, j). Clearly this implies that
kx − yk∞ 6 1. Since (p, i) and (p, j) are pure points, i and j have the same
parity and therefore |i − j| > 2. But then it follows that |f (x) − f (y)| > 1
and this contradicts the fact that f is Lip-1. Hence Pf can be defined.
For the second part, let p, q ∈ Dom(Pf ) where p 6= q. Define d =
kp − qk∞ , i = (Pf )(p) and j = (Pf )(q). Again there are points x, y ∈ Rn−1
such that (x, f (x)) ∈ H(p, i) and (y, f (y)) ∈ H(q, j). We must show that
|i − j| 6 d. Since kx − yk∞ 6 d + 1, the Lip-1 assumption gives that
|f (x) − f (y)| 6 d + 1. Suppose that |i − j| > d. Since (p, i) and (q, j) are
pure points it follows that d ≡ |i − j| (mod 2), and therefore |i − j| > d + 2.
But then
|f (x) − f (y)| > |i − j| − 1 > d + 2 − 1 = d + 1 > |f (x) − f (y)|,
which is contradictory.
Clearly, Dom(Pf ) need not be equal to all of Pn . If f = 0 is the zero
function, then Dom(Pf ) consists of precisely the closed points in Pn . Note
that if p is an open point in Pn , then all its neighbors are closed and therefore
in Dom(Pf ). The following lemma shows that this is not a coincidence. Note
that only the diagonal gridlines of Cn are used in the proof.
Lemma 9. Suppose that f : Rn → R is Lip-1 for the l∞ -metric, and let Pf
be its pure digitization. If p ∈ Pn does not belong to Dom(Pf ), then every
pure neighbor of p belongs to Dom(Pf ). Furthermore, there is an integer r
such that (Pf )(q) = r for every pure neighbor q of p.
Proof. Let us say, for definiteness, that p is an open point. Since (p, k) 6∈
P(Gf ) for any (odd) k ∈ Z, there must be an even integer r such that
|f (p) − r| < 1. Let q be a pure neighbor of p. This means that q = p +
(a1 , a2 , . . . , an ) where |ai | = 1 and that q is closed. The point (q, r) ∈ Pn+1
is closed and we will show that it belongs to the digitized graph.
If f (q) = r, then clearly (q, r) ∈ P(Gf ). Suppose f (q) < r (the case
f (q) > r is similar). Let ψ : [0, 1] → Rn be the parameterization of the real
line segment [p, q] given by ψ(t) = q+t(p−q). In particular we have ψ(0) = q
and ψ(1) = p. Now, we define a mapping g : [0, 1] → R by g(t) = f (ψ(t)) −
(r − t). Note that g(0) = f (q) − r < 0 and that g(1) = f (p) − r + 1 > 0.
Hence there is a ξ such that g(ξ) = 0. Define x = ψ(ξ). By construction,
the point (x, f (x)) is on the diagonal grid line between the pure points (q, r)
and (p, r − 1), i.e., the line segment {(ψ(t), r − t); t ∈ [0, 1] }. Therefore,
either (q, r) or (p, r − 1) belongs to the digitized graph, but (p, r − 1) does
not by assumption. Hence q ∈ Dom(Pf ) and (Pf )(q) = r. 9
(a)
(b)
Figure 2: Khalimsky-continuous digitization in two dimensions. In (a) the
pure points in the graph are defined (large squares) and (b) shows the extension of this mapping to all integers.
Using this result, we will extend Pf to a mapping defined on all pure
points. Let p ∈ Pn r Dom(Pf ). It is easy to see that in fact, with r as in the
lemma above, |f (x) − r| 6 1/2 for every x with kx − pk∞ 6 1/2. Therefore,
it is reasonable to let the extension take the value r at p. Since f takes the
value r at all neighbors of p, by the lemma, it is also clear that this choice
results in a function that is strongly Lip-1 in Zn . Note that it is easy to find
this r given a function f and a p ∈ Pn ; let r = r(f, p) be the integer r such
that (p, r) is mixed and |f (p) − r| 6 1/2.
Definition 10. Suppose that f : Rn → R is Lip-1 for the l∞ -metric. Then
the pure Khalimsky digitization, Kp f : Pn → Z is defined by:
(Pf )(p) if p ∈ Dom(Pf )
(4)
(Kp f )(p) =
r(f, p)
otherwise.
Example 11. The Khalimsky line has no mixed points. Therefore, given a
Lip-1 function f : R → R, the pure Khalimsky-continuous digitization is a
mapping Kp f : Z → Z. This digitization is illustrated in Fig. 2. If f (x) =
kx + m where |k| 6 1, then this digitization agrees with the Khalimskycontinuous lines treated in Melin (2003a).
Note that the pure digitization of a set is a set of pure points and the
pure digitization of a function is a function defined on pure points. The
digitization on the mixed points of Zn−1 remains to be defined. The values
of a continuous function on the pure points do not determine the whole
function uniquely, as the following example in Z2 demonstrates.
Example 12. Let f : P2 → {0, 1} ⊂ Z be defined by f (p1 , p2 ) ≡ p1 (mod 2).
For each mixed point we can extend f continuously by defining it to be either
0 or 1. Since each point can be treated independently, there are uncountable
many different extensions. Confer Remark 20.
Definition 13. Let f : Rn → R be Lip-1 for the l∞ -metric. Then the lower
Khalimsky digitization, K? f : Zn → Z, is the infimum of all continuous
extensions of Kp f . Similarly, the upper Khalimsky digitization, K? f , is
the supremum of all continuous extensions of K.
10
By Theorem 4, the lower and upper Khalimsky digitizations are continuous. We will now give an explicit way to calculate them. Suppose f : Rn → R
is Lip-1 for the l∞ -metric, and let q be a mixed point. Define the set E(q)
by:
E(q) = {m ∈ Z; (Kp f ) ∪ {(q, m)} is strongly Lip-1}.
The notation (Kp f ) ∪ {(q, m)} is set theoretic and means the extension of
(Kp f ) at point q with the value m. Since Kp is strongly Lip-1, Theorem 6
guarantees that E(q) is never the empty set. It is easy to see that it is only
necessary to check the strongly Lip-1 condition with respect to the points in
the pure neighborhood of q, PN(q). And there are not so many possibilities.
Let (Kp f )(PN(q)) ⊂ Z denote the image of this neighborhood. Since the
l∞ -distance between two point in a neighborhood is at most two and Kp f is
Lip-1, it follows that
max(Kp f )(PN(q)) − min(Kp f )(PN(q)) 6 2.
(5)
Suppose that the difference in (5) equals two. Then the only possible
value for a strongly Lip-1 extension of Kp f at q is the mean of these extreme
values, since this extension must necessarily be Lip-1.
Next, suppose that the difference in (5) equals zero. Since q is not pure,
it has at least one closed and one open neighbor. One of these neighbors
will fail to match in parity with the value in (Kp f )(PN(p)). Therefore again,
the only possible extension at the point q is this value.
Finally, suppose the difference in (5) equals one. Then Kf takes both
an even and an odd value in the neighborhood of q. If (Kp f ) is even for
all points in CN(q) and odd for all points in ON(q), then we have a choice;
E(q) consists of these two values. If on the other hand, (Kp f )(p) is odd
for some point p ∈ CN(q), then E(q) can contain only this value—and
similarly if (Kp f )(p) is even for some point p ∈ ON(q). Since we know that
the extension exists, it cannot happen that (Kp f ) is odd for some point in
CN(q) and even for some point in ON(p).
By Theorem 6, every function Kp f extended at a mixed point q with a
value in E(q) can be extended to a continuous function defined on all of Zn .
To sum up, we get the following result:
Theorem 14. The lower and upper Khalimsky digitizations of a Lip-1 function f : Rn → R can be calculated by the following formulas:
(K? f )(x) =
?
(K f )(x) =
(Kp f )(x) if x ∈ Pn
min E(x) otherwise,
(6)
(Kp f )(x) if x ∈ Pn
max E(x) otherwise.
(7)
11
12
10
8
6
4
2
0
0
5
y
10
0
5
15
20 20
15
10
x
(a)
(b)
Figure 3: The function f (x, y) = 7 + 52 sin x5 + 2 cos y4 . A continuous picture
is showed in (a) and the lower Khalimsky continuous digitization is showed
in (b). The black voxels are the pure points in the digitization.
Figure 3 shows the result of a Khalimsky-continuous digitization of a
function of two variables. We remark that the Khalimsky-continuous digitization is increasing in the following sense: If f and g are Lip-1 mappings
f, g : Rn → R and f 6 g, then K? f 6 K? g and K? f 6 K? g. This is straightforward to prove from the definitions.
4.
Approximation properties
By just using rounding, it is immediate that there is a integer-valued approximation F of a real-valued function f such that |F (x) − f (x)| 6 1/2 for
all x in the domain. When we in addition require that the approximation
be Khalimsky-continuous, it is reasonable to expect that the approximation
property deteriorates.
Theorem 15. Let f : Rn → R be Lipschitz for the l∞ -metric with Lipschitz
constant α 6 1 and let F : Zn → Z be either the upper or the lower Khalimsky
continuous digitization of f . Then |f (p) − F (p)| 6 (1 + 3α)/2 for each
p ∈ Zn .
Proof. We have to treat different types of points in the digitization separately. First, suppose that p ∈ Zn is pure and let r = F (p). If (p, r) ∈ Zn+1
is pure, then the graph of f must intersect H(p, r) and it follows that
|f (p) − F (p)| 6 1/2 + α/2. If instead (p, r) is mixed, then for all x ∈ Rn
such that kx − pk∞ 6 1/2 the inequality |f (x) − F (x)| 6 1/2 must hold and
of course, in particular, this is true for x = p. Now, let q be a mixed point
in Zn . Suppose first that a pure neighbor, p, of q is mapped to a mixed
point in the graph, i.e., (q, F (q)) is mixed. This implies F (q) = F (p). Let
12
x = 12 (p + q) be the point halfway between p and q. Then F (q) = F (p) and
|f (x) − F (p)| 6 1/2 by the argument above, so that
|f (q) − F (q)| 6 |F (q) − F (x)| + |f (q) − f (x)| 6
1
1+α
+ αkx − qk∞ 6
.
2
2
Next, we consider the case where all pure neighbors of q are mapped to
pure points in the graph. There are two sub-cases to consider. Suppose first
that the difference in (5) is two so that there are points p1 , p2 ∈ PN(q) such
F (p1 ) = r and F (p2 ) = r + 2. Starting at p1 and using an estimation similar
to the one above, we obtain f (q) 6 r + 1/2 + 3α/2. If we instead start at
p2 , we obtain f (q) > r + 3/2 − 3α/2. By definition, F (q) = r + 1 so we can
estimate |F (q) − f (q)| from above and below:
f (q) − (r + 1) 6 −1/2 + 3α/2 = (−1 + α)/2 + α 6 α
and
f (q) − (r + 1) > 1/2 − 3α/2 = (1 − α)/2 − α > −α.
Hence |f (q) − F (q)| 6 α. Note that this case can occur only if α > 1/3.
Finally, we consider the case when the difference in (5) is one; say that
F (p1 ) = r and F (p2 ) = r + 1. Here, there is a difference depending on
whether we use the lower or the upper digitization; we may have F (q) = r
or F (q) = r + 1. Let us consider the lower digitization, i.e., F (q) = r. Then
f (q) − F (q) 6 f (p1 ) + α − r 6 (1 + 3α)/2,
(8)
and from below we have
f (q) − F (q) > f (p2 ) − α − r > (1/2 − α/2) − α = (1 − 3α)/2 > −α,
so that |f (q) − F (q)| 6 (1 + 3α)/2 and the proposition is proved.
Since α is bounded by 1, we obtain |f (q) − F (q)| 6 2 for any mapping
where the Khalimsky digitization is defined. The following example shows
that the bound in the theorem is sharp.
Example 16. Let f : R2 → R be defined by f (x, y) = min(x + 1, 3 − x). It
is easy to check that (Kp f )(0, 0) = (Kp f )(2, 0) = 0 and that (Kp f )(1, 1) =
(Kp f )(1, −1) = 1. Thus (K? f )(1, 0) = 0, while f (1, 0) = 2. More generally,
for 0 < α 6 1, define a Lip-α mapping as
fα (x, y) = min α(x + 21 ) + 21 , α( 52 − x) +
1
2
.
We have (Kp fα )(0, 0) = (Kp fα )(2, 0) = 0 and (Kp f )(1, ±1) = 1 as before.
Therefore, we again get (K? fα )(1, 0) = 0, while fα (1, 0) = (3α + 1)/2.
13
If one checks the proof of Theorem 15, one sees that it is only in one
case that we get the bound (1 + 3α)/2. It is in (8). In the proof, the lower
digitization is considered and there we have the bad bound above. If instead
one considers the upper digitization, then the bad bound is from below. In
all other cases, the bound is α or (1 + α)/2, so in the one-dimensional case
we obtain the following corollary, since there are no mixed points in the
domain.
Corollary 17. Let F be the Khalimsky-continuous digitization of a mapping
f : R → R, which is Lip-1. Then |f (p) − F (p)| 6 (1 + α)/2 for each p ∈ Z.
In two dimensions, it is also possible to improve the approximation. Since
a mixed point in the Khalimsky plane never has a mixed neighbor, we can
define the optimal Khalimsky-continuous digitization as follows:
(Kf )(x) =
(K? f )(x) if |(K? f )(x) − f (x)| < |(K? f )(x) − f (x)|
(K? f )(x) otherwise.
(9)
Corollary 18. Let F be the optimal Khalimsky-continuous digitization of
a mapping f : R2 → R which is Lipschitz for the l∞ -metric with Lipschitz
constant α 6 1. Then |f (p) − F (p)| 6 (1 + α)/2 for each p ∈ Z2 .
The following example shows that in general, the bound (α+1)/2 cannot
be improved. It is stated in one dimension, but can clearly be extended to
higher dimensions.
Example 19. Let 0 6 α 6 1 and define f : R → R, fα (x) = αx + (1 − 3α)/2.
Suppose that Fα is a Khalimsky-continuous approximation of fα . Since
fα (1) = 1 − (1 + α)/2, it is necessary that Fα (1) = 0, if F is to approximate
fα better than Kfα . By continuity, it follows then that F (2) = 0, while
fα (2) = (α + 1)/2.
Remark 20. The definition of the optimal Khalimsky digitization is utterly
dependent on the fact that mixed points in the plane are not connected, and
therefore can be treated one by one. In three and more dimensions, this is
no longer true. If, for example, we have f : Z3 → Z and define f (1, 0, 0) = 1
then necessarily f (1, 1, 0) = 1 if f is to be continuous. One way out of this
is to define an order among the mixed points. We can decide to first define
the extension of Kp on the points with precisely two odd coordinates (which
are independent) and then on the remaining mixed points.
Acknowledgement
I am grateful to Christer Kiselman for comments on earlier versions of this
manuscript and to Ola Weistrand for letting me use his routines for voxel
visualization.
14
References
Alexandrov, Paul. 1937. “Diskrete R¨aume.” Mat. Sb. 2(44):501–519.
Andr`es, Eric. 2003. “Discrete linear objects in dimension n: the standard
model.” Graphical Models 1–3(65):92–111.
Bresenham, Jack E. 1965. “Algorithm for computer control of a digital
plotter.” IBM Systems Journal 4(1):25–30.
Chen, Li, Donald H. Cooley & Jianping Zhang. 1999. “The equivalence
between two definitions of digital surfaces.” Inform. Sci. 115(1-4):201–
220.
Cohen-Or, Daniel & Arie Kaufman. 1995. “Fundamentals of surface voxelization.” Graphical Models and Image Processing 57(6):453–461.
Herman, Gabor T. 1998. Geometry of digital spaces. Applied and Numerical
Harmonic Analysis Boston, MA: Birkh¨auser Boston Inc.
Kaufman, Arie. 1987. “Efficient algorithms for 3D scan-conversion of parametric curves, surfaces and volumes.” Computer Graphics 21(4):171–
179.
Khalimsky, Efim, Ralph Kopperman & Paul R. Meyer. 1990. “Computer
graphics and connected topologies on finite ordered sets.” Topology
Appl. 36(1):1–17.
Kim, Chul E. 1984. “Three-dimensional digital planes.” IEEE Trans. Pattern Anal. Machine Intell. PAMI-6(5):639–645.
Kiselman, Christer O. 2002. Digital geometry and mathematical morphology.
Lecture notes. Uppsala University. Available at
www.math.uu.se/~kiselman.
Kong, T. Yung. 2003. “The Khalimsky topologies are precisely those simply connected topologies on Zn whose connected sets include all 2nconnected sets but no (3n − 1)-disconnected sets.” Theoret. Comput.
Sci. 305(1-3):221–235.
Kong, T. Yung & Azriel Rosenfeld. 1989. “Digital topology: Introduction
and survey.” Comput. Vision Graph. Image Process. 48(3):357–393.
Kong, T. Yung, Ralph Kopperman & Paul R. Meyer. 1991. “A topological
approach to digital topology.” Amer. Math. Monthly 98(10):901–917.
Melin, Erik. 2003a. “Digital straight lines in the Khalimsky plane.” (To
appear in Mathematica Scandinavica).
15
Melin, Erik. 2003b. Extension of continuous functions in digital spaces with
the Khalimsky topology. U.U.D.M. Report 2003:29 Uppsala University.
Available at www.math.uu.se/~melin.
Melin, Erik. 2004. Continuous extension in topological digital spaces.
U.U.D.M. Report 2004:2 Uppsala University.
Morgenthaler, David G. & Azriel Rosenfeld. 1981. “Surfaces in threedimensional digital images.” Inform. and Control 51(3):227–247.
Reveill`es, Jean-Pierre. 1991. G´eom´etrie discr`ete, calcul en nombres entiers
et algorithmique. Ph.D. thesis. Universit´e Louis Pasteur, Strasbourg.
Rosenfeld, Azriel. 1974. “Digital straight line segments.” IEEE Trans. Computers C-23(12):1264–1269.
Rosenfeld, Azriel, T. Yung Kong & Angela Y. Wu. 1991. “Digital surfaces.”
CVGIP: Graph. Models Image Process. 53(4):305–312.
16