Presentation in i3d

advertisement
Thanh-Tung Cao
Ke Tang
Anis Mohamed
Tiow-Seng Tan
Outline
• Distance transform and applications
• Related works
• Exact Euclidean distance transform
• Parallel Banding Algorithm (PBA)
• Experiment results
7/1/2016
i3D 2010 - Washington DC, USA
2
Distance Transform

Given a grid N = nd and a set of sites S, compute for
every grid point the distance to the nearest site.
n
n
Distance transform
Voronoi diagram
7/1/2016
i3D 2010 - Washington DC, USA
3
Applications

Image processing, graphics, computational geometry...
Morphological
operation
Integer medial axis
Stipple drawing
7/1/2016
i3D 2010 - Washington DC, USA
4
Related Work
• Approximate:
o
o
Danielsson [1980], O(n).
GPU based:
 Jump flooding [Rong and Tan, 2006, 2007]
 Schneider et al. [2009]
• Exact:
o
o
o
Vector propagation approach
Voronoi diagram-based
Maurer et al. [2003], O(n), parallelizable.
PRAM: Lee et al [2003], Wang et al [2001]
GPU: PBA is the first.
7/1/2016
i3D 2010 - Washington DC, USA
5
Euclidean Distance Transform
• Consider one column on the 2D image.
Column i
B
B'
Fact 1: Among all sites in the same column, only
the nearest matter.
7/1/2016
i3D 2010 - Washington DC, USA
6
Euclidean Distance Transform
• Consider one column on the 2D image.
Column i
A
B
C
Fact 2: The Voronoi region of A and C can
dominate that of B.
7/1/2016
i3D 2010 - Washington DC, USA
7
Euclidean Distance Transform
• Consider one column on the 2D image.
Column i
A
C
Fact 3: If A is on top of C then A’s region is also
on top of C’s region.
7/1/2016
i3D 2010 - Washington DC, USA
8
Parallel Banding Algorithm
Phase 1
Final result
Phase 2
Phase 3
7/1/2016
i3D 2010 - Washington DC, USA
9
The naïve approach
• Phase 1:
o
o
Left – Right sweep, each pixel updates with the
pixel on its left.
Right – Left sweep.
7/1/2016
i3D 2010 - Washington DC, USA
10
The naïve approach
• Phase 2: Finding proximate
points in linear time.
o Process sites from top to
bottom
o Store the current set of
proximate sites in a stack
dominated
7/1/2016
i3D 2010 - Washington DC, USA
11
The naïve approach
• Phase 3:
s1
o For a column, pixels are
“colored” from top to bottom
p-1
p
p is nearer to
s1 than to s2
Yes
p belongs to s1
s2
No
s1 can be removed
7/1/2016
i3D 2010 - Washington DC, USA
12
Parallel Banding Algorithm
• Motivations:
o Within a row/column, the computation is
sequential.
o Maximum number of threads used is n (512, 1024,
etc).
o We needs 104 – 105 threads to fully utilize the
latest GPUs.
7/1/2016
i3D 2010 - Washington DC, USA
13
Parallel Banding Algorithm
• Phase 1:
o
o
o
o
Updated!
A row is equally divided into m1 bands.
Within a band, perform the sweeping similar to
the naïve approach.
Propagate the information among the first and
the last pixel of different bands.
Pixels update with the first/last pixel of its band
7/1/2016
i3D 2010 - Washington DC, USA
14
Parallel Banding Algorithm
• Phase 2:
o
o
o
A column is equally
divided into m2 bands
For each band, we
compute the proximate
sites using the naïve
approach.
Bands are merged
hierarchically
7/1/2016
i3D 2010 - Washington DC, USA
15
Parallel Banding Algorithm

Phase 3:
o Color a band of m3 pixels
at a time, 1 thread per
pixel.
o Move to the next band
when the last pixel of the
current band confirms its
color.
s1
s2
confirmed
s3
remove s1
7/1/2016
i3D 2010 - Washington DC, USA
16
Experiment results

CUDA, nVidia GeForce GTX280
Naïve v.s. Banding approach
7/1/2016
i3D 2010 - Washington DC, USA
17
Experiment results
Scalability
Different bands for Phase 2
7/1/2016
i3D 2010 - Washington DC, USA
18
Experiment results

Compare with JFA [Rong et al. 2006] and SKW [Schneider
et al. 2009]
2D
3D
7/1/2016
i3D 2010 - Washington DC, USA
19
Conclusions

Advantages:
o
o
o

Accurate result → Algorithm to computing weighted
centroidal Voronoi Diagrams on GPU (see paper)
Optimal linear expected total work
High level of parallelism, GPU friendly
Limitations:
o
o
Load balancing in Phase 2
Worst case not work-optimal in Phase 3
7/1/2016
i3D 2010 - Washington DC, USA
20
The paper, video, presentation slides and
source code are available at:
http://www.comp.nus.edu.sg/~tants/pba.html
THANK YOU!
Download