parallel banding algorithm to compute exact distance transform with the gpu

39
Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU Thanh-Tung Cao Ke Tang Anis Mohamed Tiow-Seng Tan

Upload: kuame-hancock

Post on 03-Jan-2016

26 views

Category:

Documents


2 download

DESCRIPTION

Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU. Thanh -Tung Cao Ke Tang Anis Mohamed Tiow-Seng Tan. Euclidean Distance. if  p  = ( p 1 ,  p 2 ,...,  p n ) and  q  = ( q 1 ,  q 2 ,...,  q n ) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm to Compute

Exact Distance Transform with the GPU

Thanh-Tung Cao Ke Tang Anis Mohamed Tiow-Seng Tan

Page 2: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Euclidean Distance

• if p = (p1, p2,..., pn) and 

q = (q1, q2,..., qn)

are two points in Euclidean n-space, then the distance from p to q, or from q to p is given by:

Page 3: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Voronoi diagram• A set of points (called seeds, sites,

or generators) is specified beforehand and for each seed there will be a corresponding region consisting of all points closer to that seed than to any other.

Page 4: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Euclidean Distance Transform

100100

Page 5: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Exact Euclidean Distance Transform

• Let Si,j be the nearest site, among all sites in row j, of the pixel (i, j), and let Si = {Si,j | Si,j NULL, j = 0, 1, 2, . . . , n−1} be the collection of such closest sites for all pixels in column i. Note that Si,j is NULL when there is no site in row j.

• Let Pi be the set of sites whose Voronoi regions intersect the pixels in column i. These sites are termed the proximate sites of column i.

Page 6: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Fact 1• Consider column i and let b(i1, j) and b′(i2, j) be

two sites in row j. If |i1 − i| < |i2 − i|, then the Voronoi region of b′ cannot intersect column i.

• This fact means that for each column i, there can be at most one site along a row that can potentially be a proximate site, or basically, Pi ⊆ Si. As a result, |Pi| ≤ n.

Page 7: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Fact 2• Consider column i and let a(i1, j1), b(i2, j2), c(i3, j3)

be any three sites with j1 < j2 < j3. Let the intersection of the perpendicular bisector of a and b and column i be p(i, u), and that of b and c be q(i, v). If u > v then the Voronoi region of b cannot intersect column i.

• When the mentioned situation happens, we say that a and c dominate b on column i. In this case, b Pi.

Page 8: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Fact 3• Let q(i, v) and p(i, u) be two pixels in column i

such that u > v, and let a(i1, j1) and c(i3, j3) be the closest sites to q and p respectively. Then we have j1 ≤ j3.

• This fact means that the proximate sites of column i have their Voronoi regions appear in exactly the same order as when they are sorted by their y-coordinates.

Page 9: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Exact Euclidean Distance Transform

• Phase 1: For each pixel (i, j), compute Si,j .

• Phase 2: Compute the set Pi for each column i using Si.

• Phase 3: Compute the closest site for each pixel (i, j) using Pi

Page 10: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 1 - Band Sweeping

Band 1 Band 2 Band 3 Band 4

Page 11: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 1 - Band Sweeping

Band 1 Band 2 Band 3 Band 4

(i,j)

si,j

sii

si,j

Page 12: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 1 - Band Sweeping

Band 1 Band 2 Band 3 Band 4

Page 13: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 1 - Band Sweeping

Band 1 Band 2 Band 3 Band 4

Page 14: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 1 - Band Sweeping

Band 1 Band 2 Band 3 Band 4

Page 15: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 2 - Hierarchical Merging

Band 1

Band 2

Band 3

Band 4

Page 16: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

Page 17: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Page 18: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,3

(i,v)

(i,u)

v u

Page 19: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,3

(i,v)

(i,u)

Page 20: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

(i,v)

(i,u)

v u

Page 21: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,4

(i,v)

(i,u) v u

Page 22: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,4

(i,v)

(i,u)v u

Page 23: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,4

Si,5

(i,v)

(i,u) v u

Page 24: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,4

Si,5

Si,6

Si,7

Page 25: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,4

Si,5

Si,6

Si,7

(i,v)

(i,u)

v u

Page 26: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,4

Si,5

Si,7

(i,v)

(i,u)

v u

Page 27: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,4

Si,7

(i,v)

(i,u)v u

Page 28: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

iSi,1

Si,2

Si,3

Si,4

Si,5

Si,6

Si,7

si

stack

Si,1

Si,2

Si,4

Si,7

Page 29: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

i

stack

Si,1

Si,2

Si,4

Si,7

Band 2

i

Si,8

Si,9

Si,12

Si,13

Page 30: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

i

stack

Si,1

Si,2

Si,4

Si,7Band 2 Si,8

Si,9

Si,12

Si,13

Page 31: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm• Phase 2 - Hierarchical Merging

Band 1

i

stack

Si,1

Si,2

Si,4

Si,7Band 2

Si,8

Si,9

Si,12Si,13

Page 32: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm

Band 1

i

Phase 2 - Hierarchical Merging

proximate texture

Page 33: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 3 - Block Coloring

Case 1

i

m3

pi

a

b

a

b

Page 34: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 3 - Block Coloring

Case 2

i

m3

pi

a

b

a

b

Page 35: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding AlgorithmPhase 3 - Block Coloring

Case 2

i

m3

pi

a

b

a

ba

b

a

b

Page 36: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm

Page 37: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm

Page 38: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm

Page 39: Parallel Banding Algorithm to Compute Exact Distance Transform with the GPU

Parallel Banding Algorithm