Efficient Estimation of Qualitative Topological Relations based on the Weighted Walkthroughs Model∗ Serafino Cicerone
Eliseo Clementini
University of L’Aquila L’Aquila, Italy {cicerone,eliseo}@ing.univaq.it
Abstract Weighted walkthroughs are a quantitative model for representing the spatial relation between two raster features in image databases. In this paper, we establish a correspondence between the weighted walkthroughs and qualitative models for spatial reasoning. We provide rules for estimating qualitative geometric properties and topological relations from the quantitative data that are computed for each pair of pixel sets. The approach has been tested through experiments with raster regions. Keywords Qualitative size, qualitative shape, topological relations, weighted walkthroughs, raster regions.
1
Introduction
Weighted walkthroughs [7, 1, 12] are a model for representing the spatial relation between two digital images in the field of content based image retrieval. The model is based on a quantitative technique that associates to a pair of digital images (pixel sets) a matrix of nine numeric values: each numeric value captures a primitive direction (up, up-right, right, down-right, down, down-left, left, up-left, coincident) and measures the amount of individual pixels of the first image that is in the corresponding direction with pixels of the second image. The properties of the model permit a very efficient computation technique of the values representing the mutual positioning of the two pixel sets, which are mainly used to assess a quantitative metric of similarity. In the context of GIS, there are various models to represent spatial relations between geographic features, most of them related to topological relations (e.g., the 9-intersection model [8] or the CBM [2, 4]), but also to distance and directions [5]. The common aim of all these models is to provide qualitative frameworks for reasoning with spatial relations. A problem somehow underestimated is how efficiently to compute the qualitative spatial relations starting from quantitative spatial data. The topological relations of the 9-intersection model, for example, are based on geometric definitions that are quite computationally expensive (see [3]). A related issue is to find models for topological relations that are adaptable to features affected by error, such as the error due to the limited resolution of raster data models [6, 13]. ∗
Corresponding author: Eliseo Clementini, Dipartimento di Ingegneria Elettrica, Universit` a degli Studi dell’Aquila, I-67040 Monteluco di Roio, L’Aquila, Italy. Phone: +39-0862-434438; Fax: +39-0862-434403. e-mail:
[email protected]
1
The weighted walkthroughs model can be applied to the study of spatial relations between geographic features represented by raster data. The approach that is being explored in this paper is to assess whether, starting from the quantitative values given by the model, it is possible to extract the qualitative information that is implicitly contained in it. The advantage of this approach is the use of an efficient computational model as a basis for finding qualitative properties and relations. In this paper, we show some results about the estimation of qualitative properties on relative size and similarity of shapes and basic topological relations between two simple regions. The results we have found show that topological relations can be assessed looking at the weighted walkthroughs up to a fixed error approximation that is related to the size of the basic cell element of raster data. Therefore, it is not possible to extract “sharp” topological relations, but only approximate relations. However, since this approximation is of the same order of magnitude as the error due to rasterization, the results are quite acceptable. We found that topological qualitative information cannot be estimated independently from qualitative information on size and shape. Interestingly, this is supported also by other studies, such as [11], where the authors show that the integration of qualitative topological and size information can be very useful for spatial reasoning. The paper is organized as follows. In Section 2, we summarize the more pertinent aspects of the weighted walkthroughs model, extracted from [7]. In Section 3, we point out preliminary definitions, which are related to topological relations and geometric properties of spatial features. In Section 4, we provide rules to extract qualitative spatial information from all the quantitative data provided by the weighted walkthroughs model. In particular, we concentrate on a qualitative scale for relative size and shape and on topological relations between simple regions. In Section 5, short conclusions end the paper.
2
Weighted walkthroughs
Given a Cartesian reference system, the projection of two points a = h xa , ya i and b = h xb , yb i on each reference axis can take three different orders: a before, coincident, or after b. The combination of the two projections results in 9 different bi-dimensional displacements which can be encoded in a pair of indices h i, j i: −1 if xb < xa −1 if yb < ya 0 if xb = xa 0 if yb = ya i= j= (1) +1 if xb > xa +1 if yb > ya Given two regions A and B, multiple different primitive directions can apply at the same time to different pairs of points in A and B. According to this, the pair h i, j i is a walkthrough from A to B if h i, j i encodes the displacement between at least one pair of points belonging to A and B, respectively (see Fig. 1). In order to account for its perceptual relevance, each walkthrough h i, j i is associated to its weight wi,j (A, B) measuring the number of pairs of points which belong to A and B and whose displacement is captured by the direction h i, j i. The weight is evaluated as an integral measure over the four-dimensional set of point pairs in A and B (see Fig. 1): Z Z wi,j (A, B) = Ki,j (A, B) Ci (xb − xa )Cj (yb − ya ) dxb dyb dxa dya (2) A
B
where: C±1 (·) are the characteristic functions of negative and positive real semi-axes (−∞, 0) and (0, +∞), respectively; C0 (·) = δ(·) denotes the Dirac function, which here acts as characteristic function of the singleton set {0}; Ki,j (A, B) is a dimensional normalization factor depending on global measures taken on A and B. 2
B
w(A,B) =
w−1,1 w−1,0 w−1,−1
w0,1 w0,0 w0,−1
0 w(A,B) = 0 0
w1,1 w1,0 w1,−1
0 0 0
.671 .324 .329
A
Figure 1: Regions A and B connected by three distinct walkthroughs (left); the 9 weights arranged in a 3 × 3 array (middle); weights associated with the walkthroughs connecting A to B (right). In Eq. 2, the weights with a null index (i.e., wi,0 , w0,j , and w0,0 ) are computed by integration of a quasi-everywhere-null function (the set of point pairs that are aligned or coincident has a null measure in a four-dimensional space). The Dirac function appearing in the expression of C0 (·) reduces the dimensionality of the integration domain to enable a finite non-null measure. To compensate this reduction, normalization factors Ki,j have different dimensionality whether indexes i and j are equal to zero or take non-null values: K±1,±1 (A, B) = K0,0 (A, B) =
1 |A||B|
K±1,0 (A, B) =
1
K0,±1 (A, B) =
1 (|A||B|) 2
1
3
(|A||B|) 4 1
(3)
3 (|A||B|) 4
where |A| and |B| are the areas of A and B, respectively. The 9 coefficients of the weighted walkthroughs representation are invariant with respect to shifting and zooming of the image and they are reflexive: wi,j (A, B) = w−i,−j (B, A) Weighted walkthroughs are also compositional, in that the walkthroughs between A and the union B1 ∪ B2 can be derived by linear combination of the weighted walkthroughs between A and B1 and between A and B2 : wi,j (A, B1 ∪ B2 ) =
Ki,j (A, B1 ∪ B2 ) Ki,j (A, B1 ∪ B2 ) · wi,j (A, B1 ) + · wi,j (A, B2 ) Ki,j (A, B1 ) Ki,j (A, B2 )
Compositionality permits to reduce the integral of Eq. 2 to the linear combination of a set of sub-integrals computed on any partition of entities A and B. This has a main relevance for the computational viability of weighted walkthroughs. In fact, if A and B are decomposed into rectangular parts, the numerical computation of the 4-dimensional integral of Eq. 2 can be replaced through the linear combination of a set of close-form terms representing the weighted walkthroughs between rectangular entities. These can be reduced to 9 basic arrangements: • Projections of the two set of points A and B are disjoint on both the axes. Four similar cases are possible with different left/right and upside/down positioning of A and B. In particular, if B is in the lower-right quadrant of A:
3
y
0 0 0
A B
0 0 0
0 0 1
x
• Projections of A and B are coincident on one axis and disjoint on the other axis. Again, four similar cases are possible, among which we consider the case that B is below A: y
0 0
A
1 2
B
0 0 1
0 0 1 2
x
• Projections of A and B are coincident on both axes, i.e. A and B are coincident: y 1 4 1 2 1 4
A=B
1 2
1 1 2
1 4 1 2 1 4
x
The values computed in the basic-cases are adimensional real numbers undergoing a set of bounds that are inductively maintained through linear combination, and which thus apply to the relationship between any two regions A and B. The following fact contains these bounds. Fact 2.1 Let w(A, B) be the weighted walkthroughs between A and B: 1. each weight of w(A, B) takes values in the interval [0, 1]; 2. the sum of the four corners weights of w(A, B) equals 1; 3. the sum w−1,0 (A, B) + w1,0 (A, B) is upper bounded by the following estimate: w−1,0 (A, B) + w1,0 (A, B) ≤
|B A | ≤1 HAB LB
where B A denotes the part of B whose projection on the vertical axis is included in the projection of A (see Fig. 2). The same estimate holds for the sum w0,−1 (A, B) + w0,1 (A, B);
4
B
B
HAB HA HB
A
A
BA
LB
LB
LA
HAB
LAB
Figure 2: Global measures on A and B and symbols involved in the upper bounds for weights w±1,0 . 4. the central weight w0,0 (A, B) equals the ratio between the measure of the intersection A ∩ B and the square of the product of the measure of A and B: |A ∩ B| w0,0 (A, B) = p |A||B| Weighted walkthroughs enjoy a “property of continuity”: if B is approximated by the minimum embedding multi-rectangle made up of elements of size τ × τ , the relationship with respect to A changes up to a quantity which tends to zero when τ becomes small with respect to the size of B. This property provides a quantitative basis to smooth the trade off between accuracy and computational complexity when regions are approximated to a multi-rectangular shape to compute their relationships by composition. In fact, by exploiting the property of compositionality, the weighted walkthroughs between A and B can be derived in time O(NA + NB ), where NA and NB are the number of rectangles in the decomposition of entities A and B, respectively.
3
Notations
In this section, we introduce some useful notations. A simple region A is a regular closed (nonempty) two-dimensional point-set with connected interior and connected exterior. We consider the following topological relations between two simple regions A and B: • d isjoint(A, B) • touch(A, B) • overlap(A, B) • i n(A, B) • equal(A, B) Their definition comes from the CBM [2], except the last one, which is defined as equal(A, B) = i n(A, B) ∧ i n(B, A). They correspond to the following 9-intersection relations [8]: d isjoint, meet, overlap, i nside ∨ coveredBy, equal. The above topological relations can be organized in a conceptual neighborhood graph [10] (see Fig.3). A path in the graph corresponds to changes in topological relations between regions A and B after a translation of one of the regions. 5
in disjoint
overlap
touch
equal
in
Figure 3: The conceptual neighborhood graph.
p bar
α
P x
A
Figure 4: bar denotes the barycentre of A, while P and p denote points on the boundary of A having the maximum and minimum distance from bar, respectively. The model for the embedding space that we take into consideration is a raster space made up of squared cells. For an exact definition of topological relations between rasters, see [9]. Regions A and B are considered approximated by their minimum embedding multi-rectangle made up of cells. The following definition formalizes the concept of cell: Definition 3.1 Given a region A, let τ × τ be the dimension of the basic square used to compose the minimum embedding multi-rectangle of A. This basic square is called cell. From the weighted walkthroughs model, given two regions A and B, besides the computation of the matrix w(A, B), other parameters related to size and shape of the regions are computed [7]. Let us introduce further notations for such parameters. If A is a region, then bb(A), denotes the bounding box of A, while bbH (A), and bbW (A) denote the height and the width of bb(A), respectively. Symbols barx (A) and bary (A) represent the x- and y-coordinate of the barycentre bar of A, respectively. Moreover, let P and p be two points on the boundary of A having the maximum and minimum distance from bar, respectively, and let α be the angle formed by the x-axes with the segment connecting bar and P (see Fig.4). Then: barsin (A) = sin(α),
barcos (A) = cos(α),
and
barr at (A) =
d(bar, P ) , d(bar, p)
where d(p1 , p2 ) denotes the Euclidean distance between points p1 and p2 . In summary, all the quantitative data that are directly available in the weighted walkthroughs model [7] for each pair of regions A and B are the following: 1. w(A, B) 2. τ 3. |A|, |B|, and |A ∩ B| 4. bb(A), bbH (A), and bbW (A) 6
5. bb(B), bbH (B), and bbW (B) 6. barx (A) and bary (A) 7. barx (B) and bary (B) 8. barsin (A), barcos (A), and barr at (A) 9. barsin (B), barcos (B), and barr at (B) We will often make use of an approximately equal to relation, which is defined as follows: Definition 3.2 Given two real numbers a and b and an error approximation ², they are ²approximately equal if |a − b| < ². We simply say that a and b are approximately equal and write a ' b when ² is assumed understood. In the following section, the relation above will be indistinctly applied to values in w(A, B), areas of regions, and coordinates of points in the plane. We will also make use of a relation much bigger than, which is defined as follows: Definition 3.3 Given two real numbers a and b, a is much bigger than b and we write a >> b if |a − b| ' |a|. In other words, the definition above means that a is orders of magnitude bigger than b and therefore that b can be disregarded with respect to a.
4
Estimation of qualitative information
In this section we provide rules to extract qualitative spatial information from all the quantitative data provided by the weighted walkthroughs model. From data such as the area, the bounding rectangle and the barycentre of an object, we can extract qualitative information about size and shape of the object itself (Section 4.1). Then, we can proceed to obtain information on spatial relations between regions A and B by looking at the weighted walkthroughs matrix independently from information on size and shape (Section 4.2). There are values on the weighted walkthroughs matrix related to the spatial relation between regions A and B that can be given a qualitative interpretation only by considering additional information on size and shape of regions A and B (Sections 4.3 and 4.4).
4.1
Relative size and shape
We consider a qualitative scale for comparing size and shape of objects. Let us indicate the size of a region A with size(A) and the shape with shape(A). Regarding relative size, a region A can hold one of the relations in the set {comparable, smaller, small} with respect to B. These relations for relative size have the following definitions coming from the available quantitative information: Definition 4.1 Let A and B be two regions such that |A|, |B| >> τ 2 . We say that A and B are comparable and write size(A) ≈ size(B) if |A| ' |B|. Definition 4.2 Let A and B be two regions such that |A|, |B| >> τ 2 . We say that A is smaller than B and write size(A) < size(B) if |A| 6' |B| and |A| < |B|. 7
Definition 4.3 Let A and B be two regions. If |B| >> τ 2 and |A| ' τ 2 then we say that A is small with respect to B and we write size(A) > τ 2 . We say that A and B are similar and write shape(A) ≈ shape(B) if there exists a translation σ(A) and a zooming ζ(A) such that, after the translation and the zooming, all the following conditions hold, up to error approximations: 1. bbH (A)) ' bbH (B) 2. bbW (A)) ' bbW (B) 3. barx (A) ' barx (B) 4. bary (A) ' bary (B) 5. barsin (A) ' barsin (B) 6. barcos (A) ' barcos (B) 7. barr at (A) ' barr at (B) If it does not exist a translation σ(A) and a zooming ζ(A) fulfilling all conditions above, then we say that A and B are not similar or different and write shape(A) 6≈ shape(B). With previous definitions, we obtain a rough categorization of the relative shape and size of regions A and B, which is useful for the extraction of their topological relation from the matrix w(A, B). In particular, it is important to consider the categories that are associated to different paths in the conceptual neighborhood. Let us consider the following categories: 1. regions have comparable size and similar shape: size(A) ≈ size(B) and shape(A) ≈ shape(B); 2. region A is smaller than region B, possibly they are of different shape: size(A) < size(B); 3. regions have comparable size, but they have different shape: size(A) ≈ size(B) and shape(A) 6≈ shape(B); 4. region A is small with respect B: size(A)