19. Quadtrees Quadtrees, Collision Detection, Image Segmentation - - PowerPoint PPT Presentation

19 quadtrees
SMART_READER_LITE
LIVE PREVIEW

19. Quadtrees Quadtrees, Collision Detection, Image Segmentation - - PowerPoint PPT Presentation

19. Quadtrees Quadtrees, Collision Detection, Image Segmentation 514 Quadtree A quad tree is a tree of order 4. ... and as such it is not particularly interesting except when it is used for ... 515 Quadtree - Interpretation und Nutzen


slide-1
SLIDE 1
  • 19. Quadtrees

Quadtrees, Collision Detection, Image Segmentation

514

slide-2
SLIDE 2

Quadtree

A quad tree is a tree of order 4. ... and as such it is not particularly interesting except when it is used for ...

515

slide-3
SLIDE 3

Quadtree - Interpretation und Nutzen

Separation of a two-dimensional range into 4 equally sized parts.

[analogously in three dimensions with an octtree (tree of order 8)]

516

slide-4
SLIDE 4

Example 1: Collision Detection

Objects in the 2D-plane, e.g. particle simulation on the screen. Goal: collision detection

517

slide-5
SLIDE 5

Idea

Many objects: n2 detections (naively) Improvement? Obviously: collision detection not required for objects far away from each other What is „far away”? Grid (m × m) Collision detection per grid cell

518

slide-6
SLIDE 6

Grids

A grid often helps, but not always Improvement? More finegrained grid? Too many grid cells!

519

slide-7
SLIDE 7

Adaptive Grids

A grid often helps, but not always Improvement? Adaptively refine grid Quadtree!

520

slide-8
SLIDE 8

Algorithm: Insertion

Quadtree starts with a single node Objects are added to the node. When a node contains too many objects, the node is split. Objects that are on the boundary of the quadtree remain in the higher level node.

521

slide-9
SLIDE 9

Algorithm: Collision Detection

Run through the quadtree in a recursive way. For each node test collision with all objects contained in the same or (recursively) contained nodes.

522

slide-10
SLIDE 10

Example 2: Image Segmentation

⇒ +

(Possible applications: compression, denoising, edge detection)

523

slide-11
SLIDE 11

Quadtree on Monochrome Bitmap

Similar procedure to generate the quadtree: split nodes recursively until each node only contains pixels of the same color.

524

slide-12
SLIDE 12

Quadtree with Approximation

When there are more than two color values, the quadtree can get very

  • large. ⇒ Compressed representation: approximate the image piecewise

constant on the rectangles of a quadtree.

525

slide-13
SLIDE 13

Piecewise Constant Approximation

(Grey-value) Image z ∈ ❘S on pixel indices S. 31 Rectangle r ⊂ S. Goal: determine arg min

x∈r

  • s∈r

(zs − x)2 Solution: the arithmetic mean µr =

1 |r|

  • s∈r zs

31we assume that S is a square with side length 2k for some k ≥ 0

526

slide-14
SLIDE 14

Intermediate Result

The (w.r.t. mean squared error) best approximation µr = 1 |r|

  • s∈r

zs and the corresponding error

  • s∈r

(zs − µr)2 =: zr − µr2

2

can be computed quickly after a O(|S|) tabulation: prefix sums!

527

slide-15
SLIDE 15

Which Quadtree?

Conflict As close as possible to the data ⇒ small rectangles, large quadtree . Extreme case: one node per pixel. Approximation = original Small amount of nodes ⇒ large rectangles, small quadtree Extreme case: a single rectangle. Approximation = a single grey value.

528

slide-16
SLIDE 16

Which Quadtree?

Idea: choose between data fidelity and complexity with a regularisation parameter γ ≥ 0 Choose quadtree T with leaves32 L(T) such that it minimizes the following function Hγ(T, z) := γ · |L(T)|

Number of Leaves

+

  • r∈L(T)

zr − µr2

2

  • Cummulative approximation error of all leaves

.

32here: leaf: node with null-children

529

slide-17
SLIDE 17

Regularisation

Let T be a quadtree over a rectangle ST and let Tll, Tlr, Tul, Tur be the four possible sub-trees and

  • Hγ(T, z) := min

T

γ · |L(T)| +

  • r∈L(T)

zr − µr2

2

Extreme cases: γ = 0 ⇒ original data; γ → ∞ ⇒ a single rectangle

530

slide-18
SLIDE 18

Observation: Recursion

If the (sub-)quadtree T represents only one pixel, then it cannot be split and it holds that

  • Hγ(T, z) = γ

Let, otherwise, M1 := γ + zST − µST 2

2

M2 := Hγ(Tll, z) + Hγ(Tlr, z) + Hγ(Tul, z) + Hγ(Tur, z) then

  • Hγ(T, z) = min{M1(T, γ, z)
  • no split

, M2(T, γ, z)

  • split

}

531

slide-19
SLIDE 19

Algorithmus: Minimize(z,r,γ)

Input: Image data z ∈ ❘S, rectangle r ⊂ S, regularization γ > 0 Output: minT γ|L(T)| + z − µL(T)2

2

if |r| = 0 then return 0 m ← γ +

s∈r(zs − µr)2

if |r| > 1 then Split r into rll,rlr,rul,rur m1 ← Minimize(z, rll, γ); m2 ← Minimize(z, rlr, γ) m3 ← Minimize(z, rul, γ); m4 ← Minimize(z, rur, γ) m′ ← m1 + m2 + m3 + m4 else m′ ← ∞ if m′ < m then m ← m′ return m

532

slide-20
SLIDE 20

Analysis

The minimization algorithm over dyadic partitions (quadtrees) takes O(|S| log |S|) steps.

533

slide-21
SLIDE 21

Application: Denoising (with addditional Wedgelets)

noised γ = 0.003 γ = 0.01 γ = 0.03 γ = 0.1 γ = 0.3 γ = 1 γ = 3 γ = 10

534

slide-22
SLIDE 22

Extensions: Affine Regression + Wedgelets

535

slide-23
SLIDE 23

Other ideas

no quadtree: hierarchical one-dimensional modell (requires dynamic programming)

536