Quadtrees, Octrees and their Applications in Digital Image Processing.
Quadtrees Raster and vector. Quadtrees Finkel and Bentley, 1974 Raster structure: divides space, not...
-
Upload
edward-wilfrid-wilkins -
Category
Documents
-
view
222 -
download
1
Transcript of Quadtrees Raster and vector. Quadtrees Finkel and Bentley, 1974 Raster structure: divides space, not...
Quadtrees
• Finkel and Bentley, 1974• Raster structure: divides space, not objects• Form of block coding: compact storage of a
large 2-dimensional array• Vector versions exist too
Quadtrees
• Grid with 2k times 2k pixels• Depth is k +1• Internal nodes always have 4 children• Internal nodes represent a non-homogeneous
region• Leaves represent a homogeneous region and
store the common value (or name)
Quadtree complexity theorem
• A subdivision with boundary length r pixels in a grid of 2k times 2k gives a quadtree with O(k r) nodes.
• Idea: two adjacent, different pixels “cost” at most 2 paths in the quadtree.
Overlay algorithm
• If color Q1 is specified, and Q2 is a leaf,then return a leaf for Q3 with as color the combination of those of Q1 and Q2
• If color Q2 is specified, and Q1 is a leaf,then return a leaf for Q3 with as color the combination of those of Q1 and Q2
• If Q1 and Q2 are both a leaf,then return a leaf for Q3 with as color the combination of those of Q1 and Q2
Overlay algorithm
• If color Q1 is specified or Q1 is a leaf, and Q2 is an internal nodethen recurse in the four subtrees of Q2 (with the color of Q1 as specified)
• If color Q2 is specified or Q2 is a leaf, and Q1 is an internal nodethen recurse in the four subtrees of Q1 (with the color of Q2 as specified)
• If Q1 and Q2 are both internal nodesthen recurse in the four corresponding subtrees of Q1 and Q2
Overlay, efficiency
• Result is quadtree Q3 that represents overlay
• Assume n nodes in Q1 and m nodes in Q2: O(n+m) time
• If Q3 need only contain the overlay where Q1 has a particular theme, then it can be done more efficiently by pruning
Quadtree construction from raster, I
• Construct complete quadtree on all pixels• Merge bottom-up groups of four with same
attribute
• Disadvantage: Temporarily a lot of storage needed (quadtree on all pixels), and not efficient in time
Quadtree construction from raster, II
• Construct quadtree top-down and recursively • Merge four subtrees immediately (when
returning from recursion) into a leaf if they are four leaves with the same attribute
Various queries
• Point location: trivial• Windowing: descend into subtree(s) that
intersect query window • Traversal boundary polygon: up and down in
the quadtree
Vector quadtree
• PM quadtree in naming of Samet• Divide each square if there are:
- 2 or more vertices inside- a vertex and an edge inside that are not incident- 2 (or more) edges inside, unless these edges are all incident to the same vertex and this vertex is also in the square
Leaf in vector quadtree
• Empty (inside a region; pointer to cell)• One edge (pointer to edge in leaf)• One vertex with incident edges (pointer to
vertex in leaf)
Point location in vector quadtree
• Go down quadtree to leaf that contains the query point
• At the leaf, resolve the query
f v
e
O(1) time O(degree(v)) timeO(1) time
Complexity vector quadtree
• Cannot be expressed in the number of stored objects only
• Depends on inter-distance of vertices compared to region size
• Depends on “accidental” distance of a vertex to a side of a square
Alleviating the problem
• Allow a small number (e.g. 3 or 4) of points or independent edges in a square
• Do not split squares beyond a certain size