19 quadtrees
play

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


  1. 19. Quadtrees Quadtrees, Collision Detection, Image Segmentation 514

  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

  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

  4. Example 1: Collision Detection Objects in the 2D-plane, e.g. particle simulation on the screen. Goal: collision detection 517

  5. Idea Many objects: n 2 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

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

  7. Adaptive Grids A grid often helps, but not always Improvement? Adaptively refine grid Quadtree! 520

  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

  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

  10. Example 2: Image Segmentation ⇒ + (Possible applications: compression, denoising, edge detection) 523

  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

  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

  13. Piecewise Constant Approximation (Grey-value) Image z ∈ ❘ S on pixel indices S . 31 Rectangle r ⊂ S . Goal: determine � ( z s − x ) 2 arg min x ∈ r s ∈ r � Solution: the arithmetic mean µ r = 1 s ∈ r z s | r | 31 we assume that S is a square with side length 2 k for some k ≥ 0 526

  14. Intermediate Result The (w.r.t. mean squared error) best approximation � µ r = 1 z s | r | s ∈ r and the corresponding error � ( z s − µ r ) 2 =: � z r − µ r � 2 2 s ∈ r can be computed quickly after a O ( | S | ) tabulation: prefix sums! 527

  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

  16. Which Quadtree? Idea: choose between data fidelity and complexity with a regularisation parameter γ ≥ 0 Choose quadtree T with leaves 32 L ( T ) such that it minimizes the following function � � z r − µ r � 2 H γ ( T, z ) := γ · | L ( T ) | + . 2 � �� � r ∈ L ( T ) Number of Leaves � �� � Cummulative approximation error of all leaves 32 here: leaf: node with null-children 529

  17. Regularisation Let T be a quadtree over a rectangle S T and let T ll , T lr , T ul , T ur be the four possible sub-trees and � � � z r − µ r � 2 H γ ( T, z ) := min γ · | L ( T ) | + 2 T r ∈ L ( T ) Extreme cases: γ = 0 ⇒ original data; γ → ∞ ⇒ a single rectangle 530

  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, M 1 := γ + � z S T − µ S T � 2 2 M 2 := � H γ ( T ll , z ) + � H γ ( T lr , z ) + � H γ ( T ul , z ) + � H γ ( T ur , z ) then � H γ ( T, z ) = min { M 1 ( T, γ, z ) , M 2 ( T, γ, z ) } � �� � � �� � no split split 531

  19. Algorithmus: Minimize( z , r , γ ) Input: Image data z ∈ ❘ S , rectangle r ⊂ S , regularization γ > 0 Output: min T γ | L ( T ) | + � z − µ L ( T ) � 2 2 if | r | = 0 then return 0 m ← γ + � s ∈ r ( z s − µ r ) 2 if | r | > 1 then Split r into r ll , r lr , r ul , r ur m 1 ← Minimize( z, r ll , γ ) ; m 2 ← Minimize( z, r lr , γ ) m 3 ← Minimize( z, r ul , γ ) ; m 4 ← Minimize( z, r ur , γ ) m ′ ← m 1 + m 2 + m 3 + m 4 else m ′ ← ∞ if m ′ < m then m ← m ′ return m 532

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

  21. Application: Denoising (with addditional Wedgelets) noised γ = 0 . 003 γ = 0 . 01 γ = 0 . 03 γ = 0 . 1 γ = 0 . 3 γ = 1 γ = 3 γ = 10 534

  22. Extensions: Affine Regression + Wedgelets 535

  23. Other ideas no quadtree: hierarchical one-dimensional modell (requires dynamic programming) 536

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend