digital distance geometry
DESCRIPTION
I presented this overview of my work in Digital Geometry at ICVGIP ’04. Science City, Kolkata on 18-Dec-04TRANSCRIPT
Digital Distance Geometry – Applications to Image Analysis
Dr. P. P. [email protected], [email protected]
Interra Systems, Inc. www.interrasystems.com
ICVGIP ’04. Science City. 18-Dec-04
DedicationTo the Memory of Professor Azriel Rosenfeld
Who taught us to “see” through the eyes of the machine
This photo is taken from http://www.cfar.umd.edu/~ar/
Agenda What is Distance? Distance Geometry Digital Distance Geometry
Digital Distance in 2-D Digital Distances in 3-D Digital Distances in n-D
Digital Distance Computation & Approximation
Glimpses of Applications
What is Distance?
What is Distance? Sense of being Near or Far Distances in Space – As-the-crow-flies
Normally follows the basic properties – well-defined, finite, positive, definite, symmetric & triangular.
Exception are not uncommon Not every place is reachable – violates being well-defined /
finite One-way roads do not have symmetry Triangularity on sphere may not hold
Distances in Time
Distances in Personal Space
Proxemics People's use of personal space
Four categories for informal space: Intimate distance
for embracing or whispering (6-18 inches) Personal distance
for conversations among good friends (1.5-4 feet) Social distance
for conversations among acquaintances (4-12 feet) Public distance
used for public speaking (12 feet or more)
Edward T. Hall, 1963
Distances in Other Spheres
Psychological Distance Emotive Distance Separational Distance of Six-
Degrees Everyone on Earth is separated by no
more than six friends of friends of friends
Distance Geometry
Significance of Distance Geometry
Distance is a Fundamental Concept in Geometry Shortest Paths
Straight Lines Geodesic on Earth Parallel Lines
Equidistant Ever Circle
Trajectory of a point equidistant from Center Least Perimeter with Largest Area
Conics are distance defined Geometries can be built on Distances
Taxicab Geometry
Krause 1975
Digital Geometry Necessitated by Automated Analysis Discrete Models are needed for
Machine Image Analysis Navigation Robotics
Digital Geometry – by Rosenfeld et al
Euclidean :: Digital Geometry
Euclidean Geometry
Digital Geometry
Properties that hold
Euclidean distance is a metric Extendable to higher dimensions
Euclidean distance is a metric Extendable to higher dimensions
Properties that hold after extension
Jordan’s theorem in 2-D
Every shortest path which connects two points has a unique mid-point
Jordan’s theorem in 2-D holds if 4-connectivity is maintained in the object (background) and 8-connectivity in the background (object)
A shortest path has a unique mid-point or a mid-point pair
Euclidean :: Digital Geometry
Euclidean Geometry
Digital Geometry
Properties that do not hold
The shortest path between any pair of points is unique
Only parallel lines do not intersect
Two intersecting lines define an angle between them
The shortest path between pair of points may not be uniqueLines may not intersect but may not be parallelAngle is unlikely. Digital trigonometry has been ruled out (Rosenfeld 1983)
Significance of Digital Distance Geometry
Divergence from Euclidean Geometry. Preservation of “intuitive” Properties. Preservation of Metric Properties. Quality of Approximation
How to work in digital domain with Euclidean accuracy?
“Circularity” of Disks Computational Efficiency
Distance Transformations Medial Axis Transform
Digital Distance Geometry
Basic Notions
Model: Digitization of Space
Digitization Partitioning through Cells Covers the Space No Overlap
Homogeneous – uniformity around every vertex
Regular – identical tiles 2D – 11 Homogeneous, 3 Regular 3D – 1 Regular 4D – 3 Regular n-D – 1 Regular
Tessellations
The Discrete Model Rectangular Tessellations
Easy Algebraic Representation, Zn
Extensible to arbitrary dimensions In 2-D
Hexagonal / Triangular is more “pleasant”
Melter did a mapping to Rectangular
Neighborhood The neighborhood N(x) of a point x is the set of
points defined to be neighbors of x. A digital neighborhood is characterized by a
set of difference vectors {e1,e2, …, ek} Zn such that y N(x) or y Zn is a neighbor of x Zn
iff (x-y) {e1,e2, … , ek}.
With every neighbor ei we also associate a cost (ei). Most often this cost is taken to be unity.
Neighborhood: Examples Cityblock or 4-neighbors:
{(±1,0), (0, ±1)} k = 4
Chessboard or 8-neighbors: {(±1, 0), (0, ±1), (±1, ±1)}, k = 8
Knight’s neighbors:{(±1, ±2), (±2, ±1)}, k = 8
Neighborhoods in 3-D are 6, 18 and 26.
Neighborhoods: 2D
Neighborhoods: 3D
Digital Neighborhood: 5 Factors
Proximity: Any two neighbors are proximal sharing a common hyperplane.
That is, |eij| ≤ 1, 1 ≤ i ≤k, 1 ≤ j ≤n
Separating dimension: The dimension d of the separating hyperplane is bounded by a constant r such that 0≤r≤d≤n-1.
4-neighbors have r = 1 – line separation8-neighbors have r = 0 – both point- and line-separations.
That is, n - d = 1n|ei
j| ≤n – r, 1 ≤ i ≤ k,
Separating cost: The cost between neighbors - usually unity.
That is, (ei) = 1, 1≤i≤k.
Digital Neighborhood: 5 Factors
Isotropy and symmetry: The neighborhood is isotropic in all (discrete) directions.
That is, ej is a permutation and / or reflection of ei, 1 ≤ i, j ≤k.
Uniformity: The neighborhood relation is identical at all points along a path and at all points of the space
Exceptions are not uncommon.
Path – Graph-Theoretic Notion
Given a neighborhood N(·), a digital path π(u,v) connecting two points u and v is defined to be a sequence of points where all pairs of consecutive points are neighbors.
π(u, v) is {u = x0, x1, x2, …, xM = v} where xi N(xi+1), 0≤i<M.
The length of the path |π(u, v)| = (xi+1 – xi). For unit cost this is the number of points on the
path (excluding either u or v). Of all paths that connect u to v the one having the
smallest length is called the minimal path π*(u, v).
2D Paths
3D Paths
Distance Function The distance d(u, v) between u, v (w.r.t. to a
neighborhood N(·)) is the length of the shortest path connecting them.
That is d(u, v) = |π*(u, v)|. Distance Function:
d: Rn x Rn R+
Digital Distance Function:d: Zn x Zn P
Also, d(u, v) = d(0, u – v) = d(0, |u – v|), where 0 is the origin. That is, d(u, v) = d(x), where x = |u – v|.
MetricA distance function d is said to be a metric if it is:
Total: d(u, v) is defined and finite;Note that for all u, v Zn, π(u, v) may not exist, and hence d(u, v) may
not be defined. Ref. super-knight’s distance. Positive: d(u, v) ≥ 0; Definite: d(u, v) = 0, iff u = v; Symmetric: d(u, v) = d(v, u), and; Triangular: d(u, v) + d(v, z) ≥ d(u, z); for all u, v, z Zn.
Euclidean distance: En(u, v) = (i(ui – vi)2)1/2
Also En(x) = En(u, v) for x = |u – v|.
Digital Distances in 2-D
Basic Digital Distances
For u, vZ2 and x = |u – v|,Cityblock: d4(u, v) = x1 + x2,
Chessboard: d8(u, v) = max(x1, x2),
Octagonal (uses non-uniform alternating neighborhoods):doct(u, v) = max(x1, x2, 2(x1 + x2)/3) .
Rosenfeld and Pfaltz ’68
Octagonal Distance
2 2 2
2 2 1 2 2
2 1 * 1 2
2 2 1 2 2
2 2 2
Neighborhood sequence {1,2}
d(a,b) = 10
a
b
Generalized Octagonal Distances
For u, v Z2, B being a neighborhood sequence.d(u, v; B) = d(x; B) = max(d1(x; B), d2(x; B)), where x = |u – v|,
ƒ(i) = 1≤j≤i b(j),
g(i) = ƒ(p) - ƒ(i - 1) – 1, p = |B|, d1(x; B) = max(x1, x2), and
d2(x; B) = 1≤j≤p ((x1 + x2) + g(j))/ƒ(p) .
Example: Let B = {1, 2}, So, p = 2, ƒ(0) = 0, ƒ(1) = 1, ƒ(2) = 3 and g(1) =
2, g(2) = 1.Thus d1(x) = max(x1, x2) and
d2(x) = (x1 + x2 + 2)/3 + (x1 + x2 + 1)/3 = 2(x1 + x2)/3.
Das et al 1987; Das & Chatterji 1990
Properties of Octagonal Distances
Metric:d(B) is a metric iff B is well-behaved, that is,
ƒ(i) + ƒ(j) ≤ ƒ(i + j), if i + j ≤ p; ≤ ƒ(p) + ƒ(i + j - p), if i + j ≥ p.
Lattice:Octagonal Distances form a Lattice where the
Partial Order is defined between B1 & B2 iff d(x; B1) ≤ d(x; B2) for all x Z2.
Das 1990
Simple Octagonal Distances
An Octagonal Distance with a single Integer Function is Simple.
d(x; B) is Simple iff b(j) = j.f(p)/p - (j-1).f(p)/p, gcd(p, f(p)) = 1.
d(x; B) = max(|x1|, |x2|, (|x1|+ |x2|)/m), where m = f(p)/p, called the effective neighborhood.
Example: Let p = 5, f(p) = 7. Then B = {1, 1, 2, 1, 2},
d(x; B) = max(|x1|, |x2|, 5(|x1|+ |x2|)/7)
Simple Octagonal Distances are always Metric.
Das 1992
Simple Octagonal Distances
Properties of Simple Octagonal Distances
Chamfer Computable repeated iterations of forward and reverse scans
Simple in Functional Form Simple in Neighborhood Unity in Cost Has good Circularity for Disks Works as Good Approximations for Euclidean Distance
Best Simple Octagonal Distances
A Simple Octagonal Distance that “Best” approximates the Euclidean Distance.
Best Distance is: B = {1, 1, 2, 1, 2}
d(x; B) = max(|x1|, |x2|, 5(|x1|+ |x2|)/7)
Other Good Candidates:B = {1, 1, 2}B = {1, 2}B = {2}
Das 1992
Fun Distances
Knight’s Distance in 2D
dknight(x) = max(x1/2 , (x1 + x2)/3) +
((x1 + x2) –
max(x1/2, (x1 + x2)/3)) mod 2,
if x (1, 0), (2, 2), = 3, if x = (1, 0), = 4, if x = (2, 2).
Das & Chatterji 1988
Knight’s Circle & Disk
Properties of Knight’s Distance
A Metric A non-Proximal Distance Results in Porous Disks Generalizations – Super-Knight's
Distances may not be well-defined
Digital Distances in 3-D
Digital Distances:For u, v Z3 and x = |u – v|,d6(u, v) = x1 + x2 + x3, (grid distance)
d18(u, v) = max(x1, x2, x3, (x1 + x2 + x3)/2)
d26(u, v) = max(x1, x2, x3) (lattice distance).
Yamashita and Ibaraki ‘86
Digital Distances in n-D
n-D Extension of Neighborhood
m-neighborhood distancesType – m neighbor:
im
i
n
i
i
nmO
miviu
2)(
)()(
0
1
Das, Chakrabarti and Chatterji ‘87
m-Neighbor Distance
m
vuvuvu
iviuvu
iviuvu
ddd
d
d
n
nn
m
ni
n
n
i
n
n
n
),(),,(max),(
)()(max),(
)()(),(
1
1
1
1
•All are metric
•n metrics in n-D
•Generalizes simple distances for 2-D & 3-D
t-cost Distance Cost between neighbors:
(u – v) = mini(t, |u(i) – v(i)|)
Cost bound: t, 1 ≤ t ≤ n i th maximum function
ntvufvu
uiu
P
t
ii
n
t
i
n
i
D
fZf
1 ,,
ofcomponent maximum th
,:
1
Das, Mukherjee and Chatterji ‘92
1 1 1
1 o 1
1 1 1
2 1 2
1 o 1
2 1 2
1 1 1
1 1 1
1 1 1
2 2 2
2 1 2
2 2 2
3 2 3
2 2 2
3 2 3
1 1 1
1 o 1
1 1 1
2 1 2
1 o 1
2 1 2
2 1 2
1 o 1
2 1 2
1 1 1
1 1 1
1 1 1
2 2 2
2 1 2
2 2 2
3 2 3
2 1 2
3 2 3
2D
3D
D2
1 D2
2
D3
3D3
2D3
1
t-cost neighbors
Path by t-Cost Distance
Properties of t-Cost Distance t-Cost Distances are Metrics Dn
1 = dnn
Dnn = dn
1
New Distance in 3-D:D3
2 = max(x1, x2, x3)+
max(min(x1, x2), min(x1, x3), min(x2, x3))
Generalized Octagonal Distance in n-D
Cyclic neighborhood sequence:
All sorted (in non decreasing order) sequences yield to metric.
There exists a necessary as well as sufficient condition on B for metricity.
Relative proportions of different neighborhood types in the sequence influence the shape of the discs.
},....,2,1{)(
)}(),.....,2(),1({
nib
nbbb
Das and Chatterji ‘ 90
Generalized Octagonal Distance in n-D: Special Cases
d({m}) = dmn, |B| = 1.
d(u, v; {m, m + 1}), |B| = 2 = d(x) = max(maxi xi, 2i xi/(2m + 1) )
(recollect doct where n = 2 and m = 1).
Das and Chatterji ‘ 90
Generalized Octagonal Distances in 3-D
Digital Distance Computation & Approximation
Chamfering for computing Distance Transform
o
a b a
Forward Scanning From Left to Right and Top to
Bottom
o
a b a
b
Backward Scanning From Right to Left and Bottom to
Top
b
Distance at o = min (Distance value at Neighboring pixel + local distance between them)
1. Initialize all distance values to a Maximum Value.
2. At every point o compute the distance value from its visited neighbors as follows:
Extend this concept with larger neighborhood and dimension.
Chamfer/Weighted distances
2c;db2b;cad;c2a;b : 4D
2b;cac;b2a;b : 3D
;2; :2D
:conditions Metric
0
.:,,, : 4D
.:,,:3D
.:, :2D
abba
xyzw
xayabzbcwcddcba
xayabzbccba
xayabba
Borgefors and her colleagues 1984-2004
b a b
a o a
b a b
c b c
b a b
c b c
b a b
a o a
b a b
c b c
b a b
c b c
2D
3D
Weighted Distance Template
s
Benchmarking with Euclidean Metric: Analytical Approach
Maximum Absolute Error(MAE)
Mean Square Error(MSE)
),(),(max vudvuEE na
vudvuEE navgm ,,
2
Borgefors ’84-04, Das and Chatterji ’92
Benchmarking Euclidean Metric: Geometric Approach
Comparing Geometric Properties of hyper-spheres.
Perimeter, area, shape-descriptors in 2-D
Surface Area, Volume, Shape-descriptors in 3-D.
Danielsson’93, Kumar et al’95, Butt and Maragos’98, Mukherjee et al’2000
Optimal m-neighbor Distance in Bounded Images
Solution of the following equation:
m: neighborhood typeM: maximum size along a dimensionn: dimension
nn
m
m
nMMm
111
11
Relative Error: t-cost distance
n
tt
vu
vuvu
EDE
n
n
tn1,1max
,
,,
3 1 ,1 ,
:boundupper theminimisingin t – Optimal
topt nn
n 1 2 3 4 … 55 56 …
topt 1 1 2 2 … 2 3 …
Finding Best Octagonal Distance
Compare the area, perimeter, volume, surface etc. with the Euclidian Discs.
Best in 2D: {1,1,2} Best in 3D: {1,1,3} They also minimize the MAE & MSE
in a finite space
Mukherjee et al’2000
Benchmarking 2D Distances
Distance Function
MAE MSE
{1,1,2} 0.087 0.026
{1,1,1,2} 0.187 0.056
{1,2} 0.118 0.043
<2,3> 0.134 0.068
<3,4> 0.081 0.025
<5,7> 0.083 0.035
<8,11> 0.073 0.030
Benchmarking 3D Distances
Distance Function
MAE MSE
{1,1,3} 0.105 0.027
{1,1,1,2,3} 0.146 0.034
{1,2} 0.269 0.070
<3,4,5> 0.118 0.043
<8,11,13> 0.107 0.043
<13,17,22>
0.107 0.043
<13,17,23>
0.107 0.034
Good Weighted distancesDimension Weights MSE MAE
2
<2,3><3,4><5,7>
<8,11>
0.0680.0250.0350.03
0.1340.0810.0830.073
3
<3,4,5><8,11,13>
<13,17,22><13,17,23><16,21,27><16,21,28>
0.0430.0430.0430.0340.0360.043
0.1180.1070.1070.1070.1030.103
4
<3,4,5,6><6,8,10,11><6,9,10,11><7,10,12,13
><8,11,13,15
>
-----
0.1840.1670.1670.1550.143
Neighborhood :: Digital Distance
m-Neighbor
t-Cost Sequence-based
(Octagonal)
Others (Knight’s /
Super-Knight’s)
Chamfer / Weighted
Proximity Proximal Proximal Proximal Non-Proximal
Proximal
Separating Dimension
Graded Maximal Graded Undefined Maximal
Separating Cost
Unity Non-Unity Unity Unity Fn of Separating Dimension
Isotropy & Symmetry
Isotropic Isotropic Isotropic Isotropic Isotropic
Uniformity
Position Independent
Position Independent
Position Dependent
Position Independent
Position Independent
Glimpses of Applications
Distance Transform
Minimum distance of a feature point from the back ground.
SuvuduDTSv
)},,({ min)(
Medial Axis Transform
A set of maximal blocks contained in the pattern.
Computation of Medial Axis Transform
• Compute the distance transform.
• Compute local maxima in the distance transformed image.
Computation of minimal set of maximal disks
1. Compute Local Maximum Blocks from the distance transformed image.
Form a relational table expressing the relationships between boundary pixels and individual disks.The problem is mapped to the covering of the list of boundary pixels with the optimal set of maximal blocks.
2.
3.
Nilson-Danielsson’96
Digital discs
RR2D
3D
d6 d26d18
RxOdxROB ,;
d4d8
Vertices of octagonal discs:
R) R, R,of(n permutatio : :3D
R)R,of(n permutatio : :2D
321
21
cba
c
cba
cbba
a
cba
ba
Application of MAT in Image Analysis
• Geometric Transformation (Kumar et al ’96)• Computation of Normals (Mukherjee et al ’02)• Thinning of binary pattern (Costa ’00, Pudney
’98)• Computation of cross-sections of 3D objects
(Mukherjee et al ’00)• Visualization of 3D objects (Mukherjee et al ’99,
Prevost and Lucas ‘00)• Image compression (Kumar et al ’95).• Shape Description (Baja and Svensson ’02)
Thinning from Distance Transform
Compute the set of Maximal Blocks.
Use them as anchor points while iteratively deleting boundary points preserving the topology.
Vincent ’91, Ragnemalm ’93, Svensson-Borgefors-Nystrom ’99
Normal Computation Normal at a point p computed by
computing the resultant vector from that point to the neighboring medial circles.
Normal Computations: Examples
Discrete Shading
Render individual medial sphere independently using Z-buffering.
Discrete Shading: Examples
Discrete Shading: Examples
Discrete Shading: Examples
Decomposition of 3D Objects
Identification of seed of a component from inner layers of Distance Transformed Image.
Seed-fusion by expansion and shrinking
Region growing by reversed DT.
Surface smoothing and merging.
Svensson-Saniti di Baja’02
Cross-sectioning
Cross-sectioning with different distance functions.
A set of objects for experimentation
Cross-sectioning: Voxel data, MAT & Sphere Approx.
Voxel Data MAT Euclidean Sphere
Approximation
Acknowledgement Azriel Rosenfeld B N Chatterji Gunilla Borgefors Hanan Samet Jayanta Mukhopadhayay P P Chakrabarti R A Melter Y V Venkatesh Innumerable others whose results have been used in this
presentation and all other works in the area. And the ICVGIP 2004 Committee for the opportunity to
present.
Thank you !