Date post: | 16-Apr-2017 |
Category: |
Technology |
Upload: | anyline |
View: | 1,065 times |
Download: | 1 times |
Introduction to Graphs and their Ability to Represent Images
Martin Cerman
• Graph G = (V,E) • Set of vertices V
• Set of edges E, where E ⊂ V x V
• Edges can be directed or undirected
Graph Definition
2
V = {1, 2, 3, 4, 5} E = {(1,2), (2,3), (3,2), (4,3), (4,1), (4,5), (5,5)}
1 2
3
4
5
1
1
=
• Parallel / Double edges
• Self-loops
• Simple graph: contains NO parallel edges and NO self-loops
• Multigraph: contains parallel edges and/or self-loops
Graph Definition
3
• Planar graphs • Contains no crossing edges
• Tree • Connects all vertices without cycles
• Forest • All connected components are trees
Graph Definition
4
• Vertices generally stored in array or vector
• Most common data-structures to store edges • Adjacency list
• Adjacency matrix
• Incidence matrix
• Edge data-structure defines complexity of graph operations • Storage- and computational cost
• Operations for example: add edge, remove edge, check adjacency,…
Graph Data-structure
5
• Collection of unordered linked lists, one for each vertex
• Great for representation of sparse graphs
Adjacency List
6
1 2
3
4
5
1 2 3 4 5
2 3 2 1 5
4 3
5
Graph opera*on Complexity
Store graph O(|V|+|E|)
Add Vertex O(1)
Add Edge O(1)
Remove Vertex O(|E|)
Remove Edge O(|E|)
Adjacency check O(|V|)
V
• Square matrix with side length |V|
• Describes if two vertices are adjacent
• Symmetric if undirected graph, binary if simple graph
Adjacency Matrix
7
1 2
3
4
5
Graph opera*on Complexity
Store graph O(|V|²)
Add Vertex O(|V|²)
Add Edge O(1)
Remove Vertex O(|V|²)
Remove Edge O(1)
Adjacency check O(1)
1
1
1 1
1 1 1
1
V
V
• Matrix of size |V| x |E|
• Describes incidence relationship between vertices and edges
Incidence Matrix
8
1 2
3
4
5
Graph opera*on Complexity
Store graph O(|V|*|E|)
Add Vertex O(|V|*|E|)
Add Edge O(|V|*|E|)
Remove Vertex O(|V|*|E|)
Remove Edge O(|V|*|E|)
Adjacency check O(|E|)
1 2 3 4 5
a 1 1
b 1 1
c 1 1
d 1 1
e 1 1
f 1
V
E
c
b
d
a
e f
Complexity Comparison
9
Adjacency List Adjacency Matrix Incidence Matrix
Store graph O(|V|+|E|) O(|V|²) O(|V|*|E|)
Add Vertex O(1) O(|V|²) O(|V|*|E|)
Add Edge O(1) O(1) O(|V|*|E|)
Remove Vertex O(|E|) O(|V|²) O(|V|*|E|)
Remove Edge O(|E|) O(1) O(|V|*|E|)
Adjacency check O(|V|) O(1) O(|E|)
• Choose data-structure based on algorithm needs !
• Vertex merging (Edge contraction)
• Edge removal
Graph Reduction Operations
10
• Built by applying reduction operations to a graph
• Lowest level stores original graph
• Top level stores maximally reduced graph (single vertex)
Graph Pyramid
11
• Vertices describe pixels
• Edges describe adjacency relationships between pixels • 4-connected image graph is always planar
Graphs and Images
12
• Simplified image graph
• Vertices describe connected regions of any shape and size
• Edges describe adjacency relationships between regions
• Simple graph – no multiple edges, no self-loops
Region Adjacency Graph
13
• Does not uniquely describe a “setting” of regions
• Cannot describe inclusion relationship and multiple borders
Region Adjacency Graph
14
• Every planar graph has a dual graph
• Primal graph • Vertices describe regions
• Edges describe adjacency relationships between regions
• Dual graph • Vertices describe faces
• Edges describe borders of faces
Dual Graphs
15
• Primal edge contraction = dual edge removal
• Primal edge removal = dual edge contraction
Duality of Reduction Operations
16
• Differentiates between adjacency and inclusion relationship
• Preserves multiple borders
Dual Graphs
17
1
4
• Differentiates between adjacency and inclusion relationship
• Preserves multiple borders
• Does not uniquely describe a “setting” of regions
Dual Graphs
18
1
4
• Different representation of a graph
• Combinatorial Map CM = (D, α, σ) • Set of “darts” D
• α involution connecting two darts
• σ permutation connecting two darts
• Can be stored in single array
Combinatorial Maps
19
1
2 3 4
σ
α
• Modification of the σ permutation
• Vertex merging (edge contraction)
• Edge removal
CM Reduction Operations
20
• Primal combinatorial map implicitly stores dual map CM’=(D, α, γ) • Dual map can be computed anytime from the primal, and vice-versa
• Combination of α involution and σ permutation
• γ = (α * σ) or γ = (σ * α)
Dual Combinatorial Maps
21
Combinatorial Maps
22
• Uniquely describe “setting” of regions • Because of implicitly storing direction of darts around each vertex
Dual Combinatorial Maps
23
• Task: group pixels with “similar” properties • Color, texture, higher level features,…
• Iterative Approach: • Represent image as graph
• Assign weights to edges (similarity)
• Iteratively contract edges with lowest weights
• Other approaches: • Minimum spanning tree based approaches
• Graph cuts
Application: Image Segmentation
24
Thank you!
Martin Cerman