310 likes | 498 Views
Storing Images. Quad Trees. Justin Griffin COT 4810 09/23/04. Outline. What is a Quad Tree? Example walkthrough Quad Tree manipulations Summary. What is a Quad Tree?.
E N D
Storing Images Quad Trees Justin Griffin COT 4810 09/23/04
Outline • What is a Quad Tree? • Example walkthrough • Quad Tree manipulations • Summary
What is a Quad Tree? • Can be thought of as a B-tree of order 4. Each node represents one quadrant of its parent. The tree is filled out by a process of subdividing an image matrix into four quadrants recursively until the quadrant is one solid color, or the pixel level is reached. • The number of pixels in the image must be a power of 2.
B A C D A B C D The principal nodes of a quad tree Example
Root (entire image) B A C D
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D • The 16x16 image matrix needs to store 256 pixels by conventional storage methods. • We have compressed the image into 77 nodes.
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D
Root (entire image) B C A D
Manipulations Rotations Rotate the image 90° counter-clockwise
Manipulations Rotations Rotate the image 90° counter-clockwise
Manipulations Rotations Rotate the image 90° counter-clockwise
Manipulations Rotations Rotate the image 90° counter-clockwise
Manipulations Rotations Rotate the image 90° counter-clockwise
Manipulations Rotations Rotate the image 90° counter-clockwise
Manipulations Scaling Remove all terminal nodes. Reinterpret the root node as one of the principal nodes. This reduces the size of the image by a factor of 2. B D A C
Manipulations Scaling B D A C
Manipulations Scaling B D A C
Manipulations Scaling
Manipulations Scaling • Shrinking the image reduces the resolution by a power of 2 for each level removed from tree.
Summary • Quad Trees are efficient image storing data structures. • Easy to manipulate the image with simple recursive tree rotations. • Algorithms exist to: • Detect neighboring images • Image recognition
Sources • “The New Turing Omnibus”, by A.K. Dewdney A.W.H. Freeman/Owl Book, 2001 New York • http://www.cs.ubc.ca/~pcarbo/cs251/welcome.html • http://www.laesieworks.com/digicom/Lossless_Quadtree.html • http://www.cs.umd.edu/users/brabec/quadtree/rectangles/cifquad.html