1 efficient bitmap resemblence under translation klara kedem & daniel cohen this presentation...
TRANSCRIPT
1
EFFICIENT BITMAP EFFICIENT BITMAP RESEMBLENCE UNDER RESEMBLENCE UNDER
TRANSLATIONTRANSLATION
Klara Kedem & Daniel Cohen
2
Introduction
“Whether two point set A and B resemble each other ?”
minimum Hausdorff distance under translation
Use of the graphic hardware in order to speed-up run-times of the existing algorithms
3
The algorithms
Huttenlocher, Kedem and Sharir Huttenlocher, Klanderman and Rucklidge Chew and Kedem
4
Graphic Hardware
Pixel planeWord for each pixel Processor for each pixelOperations that supported are restricted
(or, and, …) Parallel execution
5
In order to use graphic hardware the input for the algorithms will be in raster form, i.e., matrices of pixels, each having value 0 or 1, standing for white or black color of the image
110010011000100100110000101010
1111101111
Bitmaps
6
Automatic navigation.In automatic navigation two successive
images are taken by a camera attached to an autonomous vehicle, with a short time interval between them. We need to find the matching features in the images in order to determine the exact motion and the new location of the vehicle
The application
7
Assume that we have two consecutive images and we have a vague knowledge of motion between them, which consist of a translation value and a tolerance
We compute a rasterized approximation of the exact motion within window W
9
Theoretical Background
A, B –point sets(a,b) – any metric (for example L1, L2, L)Directed Hausdorf distance from a A to B
)1(),(min),( baBadBb
d(a, B)
a
10
Theoretical Background
Directed Hausdorff distance from A to B
It measures the distance of the point of A which is farthest from the set B
Attention: h(A, B) is not symetric
)2(),(minmax),( badBAhBbAa
13
Theoretical BackgroundThe measure of resemblance D(A, B), between the sets A and B - the minimum value of the Hausdorff distance under translation.
A is fixed, B is allowed to translate in the plane
where B + x is the set B translated by x
),(min),(2
xBAHBADRx
14
Theoretical Background
we discuss the directed Hausdorff distance only
Consider the directed distances in (*) as function that depends on the translation x of the set B.
(*)),(minmax),( axbdAxBhAaBb
15
Voronoi Surface
Consider the function
The graph of this function
is the Voronoi surface of A
)6(),(min)( axdxgAa
A
}|))(,{( 2Rxxgx A
18
Upper Envelope
For each bB, we shift by –b f(x) is the upper envelope of these shifts
)(xg A
bAaBbbA
Bbaxdxgxf
),(minmax)(max)(
),(minmax),(minmax axbdbaxdAaBbAaBx
),( AxBh
19
)(xf
Upper Envelope
x
Goal – is to find the translation x that minimize f(x)
- this is directed minimum Hausdorff distance
20
Algorithm 1:Huttenlocher, Kedem and Sharir
(i) Initialization: Generate ; Set f(x) to zero;
(ii) For each b B do f(x) = max (f(x), )), for all x W.
(iii) Find the minimum of f(x) for all x W.
)(xg A
)( bxg A
minf
21
Speed-ups
Encode the distance values in the distance transform gA(x) into words in the pixel plane
distance i = gA(x) present by its unary representation U(i) = 2i-1
min(U(i), U(j) = and (U(i), U(j)) max(U(i), U(j) = or (U(i), U(j))
22
Speed-ups
If the length of a word in the pixel plane is 6 bits, then gA(x) = 1 encoded by 000001
gA(x) = 6 encoded by 111111
Restricts the distance we can represent to be smaller then the size (in bits) of words in the pixel plane
truncate gA(x)
23
Speed-upsk –size of a word in the pixel plane in bits
first – transform gA(x) to k-gA(x)
truncate all the negative values of k-gA(x) => get
k-gA(x ) if gA(x) <= k g’A(x) =
0 otherwise
24
)(xg A
)(xgk A
)(' xg A
Horizontal mirroring of
)(xg ATruncated horizontal mirroring of
)(xg A
k
k
26
By the transformation above we compute a truncated lower envelope f’(x) of g’A(x+b)
Maximum of f’(x) is desired minimum Hausdorff distance (under k-bit limitation)
27
Algorithm 3: The Huttenlocher, Klanderman and Rucklidge
1. Initialization: Compute ; Initialize
2. For each x W do
(a) For each b B do d = max(d, );
(b) = min( , d);
)(xg A minf
)( bxg A
minf minf
28
Search of the minimum is done in the inner loop Speed-up: as soon as for some b the computed
distance d is grater that the current value of fmin
leave the inner loop since x will not yield a better Hausdorff distance
29
The framework of Chew and Kedem examines certain cross-sections of Voronoi surfaces.
Disc of radius is put about each point of A,creating set A (the union of these discs)
A={3, 9}, B={5, 12}
0
30
Consider the set A - b; the set A shifted by –b A-b – set of all translations that map b into A F = b B A - b : set of all translations that map
all points b B into A
A={3, 9}, B={5, 12}
0
0
31
Hausdorff decision problem – for a given whether the minimum Hausdorff distance under translation is less then
The answer is true if there exists a translation x such that the Hausdorff distance between A and B+x is less than or equal to => F above is not empty
32
Algorithm 2:Chew and Kedem
Algorithm 2:Rasterization of the Chew and Kedem algorithm
1. Given a distance , compute a disk of this radius, C().
2. For each point a A put C() centered around a, thus
creating .
3. For each point b B shift by –b and compute the
intersection, , of the overlaid (shifted) with
former ones, over W.
4. Check whether the intersection, , is not empty
A
A
F
A
F
33
Given an initial Create a disc of radius filled with 1’s and fill the rest
of the bitmap with 0’s Shift this bitmap about all point a A such that the
center of the disc is at a; or operation over all the shifts gets the union A Shifting A by –b for all b B, and intersecting these
shifted copies, generates F ; this can be computed by the and operation
Implementation of Alg.2
34
we can perform k decision algorithms simultaneously (k –number of bits in the pixel plane)
1, 2, … , k – ascending sequence of the values which we chose to check simultaneously by alg.2
Number the bits in the pixel plane from 1 to k (1 and k the most significant and the least significant bits, respectively)
Relate to bit number j as to the layer representing the discs of radius j (this layer will represent Aj )
A - pixel plane with al the Aj , j = 1,…,k
Interleaving algorithms 1 and 2
35
word size = k
The k-bit pixel plane for discs of various radius about
a A (the template)
klayer 2: = 3
layer 4: = 7
point a
36
The intersection areas , F1, F2, … , Fk, will indicate whether A and B are closer then the corresponding ’s
The and operation that we used for radius can answer k decision problems and here yields a pixel plane that contains f’ –
all of the intersected Fi together
37
If for 1, … , i the answer the decision problem is false, and for i+1, … , k is true, refine the range(i,i+1 ) by creating a new sequence of ’s in this range and we run Alg.2 again
In practice the range diminishes very quickly (this procedure runs at most twice)
38
Template
Define template about the pixel a A to be the pixel plane with 0 everywhere and the unary representation the set of all words in the pixel plane which get a value other than 0 by drawing the disc about a
39
Algorithm 4: a combination of 1 and 2
1. Initialization : zero f’(x) for all x W ;2. Build template: Given an ascending sequence of
possible Hausdorff distances , create a template of disks in the pixel plane for one point a A;
3.Create : for each point a A copy the template, centered at a, performing an or operation between the pixel planes;
4. for each b B shift the pixel of by –b, performing the and operation between the pixel plane containing f’ and the current shift of ,
f’ = and (f’, -b)5. For each x W , find the maximum point in
f’, by performing = or(f’(x)| x W)
i ,...,1
A
A
AA
minfminf
40
in algorithm 4 the distance transform g’A is replaced by A
The word size k which restrict the largest distance that could be stored in g’A is not restricting any more
41
Implementation and resultsAlg.4 and Alg.3 were implemented in C on a Silicon Graphics Indigo with 8-bits pixel-plane
Performances of Alg.4 and Alg.3 were compared under different parameters
42
Implementation and resultsTwo images were taken by a moving camera, camera slightly shifted downwards
A binary images were obtained
The matching has been applied between windows in 1 and corresponding windows in 2
1 2
43
Implementation and results
A comparison between the algorithms for the matching times as a function of the window size with max=20
Window size
AlgorithmFig. 1Fig. 2Fig. 3
3043
0.340.38
0.641.53
1.162.16
4043
0.490.67
1.143.90
1.993.78
5043
0.761.12
1.704.40
2.966.38
6043
1.001.54
2.375.33
4.139.34
7043
1.311.92
3.146.00
5.3711.48
8043
1.712.41
4.206.60
7.2612.69
44
Implementation and results
The mathcing times as function of max . Window size = 80
maxAlgorithmFig. 1Fig. 2Fig. 3
1543
1.471.34
4.273.80
7.257.87
2043
1.502.41
4.306.60
7.1612.69
2543
1.483.49
4.3011.80
7.3021.22
3043
1.684.51
4.2915.84
7.3332.80
3543
1.675.71
4.2619.71
7.3444.90