Quadtree: Exploring Hierarchical Data Structures for Image Analysis
By Fouad Sabry
()
About this ebook
What is Quadtree
A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees are the two-dimensional analog of octrees and are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions. The data associated with a leaf cell varies by application, but the leaf cell represents a "unit of interesting spatial information".
How you will benefit
(I) Insights, and validations about the following topics:
Chapter 1: Quadtree
Chapter 2: Octree
Chapter 3: R-tree
Chapter 4: Binary tree
Chapter 5: B-tree
Chapter 6: AVL tree
Chapter 7: Red-black tree
Chapter 8: Binary search tree
Chapter 9: Binary heap
Chapter 10: Segment tree
(II) Answering the public top questions about quadtree.
(III) Real world examples for the usage of quadtree in many fields.
Who this book is for
Professionals, undergraduate and graduate students, enthusiasts, hobbyists, and those who want to go beyond basic knowledge or information for any kind of Quadtree.
Read more from Fouad Sabry
Related to Quadtree
Titles in the series (100)
Histogram Equalization: Enhancing Image Contrast for Enhanced Visual Perception Rating: 0 out of 5 stars0 ratingsComputer Stereo Vision: Exploring Depth Perception in Computer Vision Rating: 0 out of 5 stars0 ratingsImage Histogram: Unveiling Visual Insights, Exploring the Depths of Image Histograms in Computer Vision Rating: 0 out of 5 stars0 ratingsHadamard Transform: Unveiling the Power of Hadamard Transform in Computer Vision Rating: 0 out of 5 stars0 ratingsHuman Visual System Model: Understanding Perception and Processing Rating: 0 out of 5 stars0 ratingsImage Compression: Efficient Techniques for Visual Data Optimization Rating: 0 out of 5 stars0 ratingsGamma Correction: Enhancing Visual Clarity in Computer Vision: The Gamma Correction Technique Rating: 0 out of 5 stars0 ratingsBundle Adjustment: Optimizing Visual Data for Precise Reconstruction Rating: 0 out of 5 stars0 ratingsUnderwater Computer Vision: Exploring the Depths of Computer Vision Beneath the Waves Rating: 0 out of 5 stars0 ratingsAffine Transformation: Unlocking Visual Perspectives: Exploring Affine Transformation in Computer Vision Rating: 0 out of 5 stars0 ratingsComputer Vision: Exploring the Depths of Computer Vision Rating: 0 out of 5 stars0 ratingsColor Matching Function: Understanding Spectral Sensitivity in Computer Vision Rating: 0 out of 5 stars0 ratingsHomography: Homography: Transformations in Computer Vision Rating: 0 out of 5 stars0 ratingsInpainting: Bridging Gaps in Computer Vision Rating: 0 out of 5 stars0 ratingsVisual Perception: Insights into Computational Visual Processing Rating: 0 out of 5 stars0 ratingsRetinex: Unveiling the Secrets of Computational Vision with Retinex Rating: 0 out of 5 stars0 ratingsAdaptive Filter: Enhancing Computer Vision Through Adaptive Filtering Rating: 0 out of 5 stars0 ratingsNoise Reduction: Enhancing Clarity, Advanced Techniques for Noise Reduction in Computer Vision Rating: 0 out of 5 stars0 ratingsColor Space: Exploring the Spectrum of Computer Vision Rating: 0 out of 5 stars0 ratingsHough Transform: Unveiling the Magic of Hough Transform in Computer Vision Rating: 0 out of 5 stars0 ratingsOriented Gradients Histogram: Unveiling the Visual Realm: Exploring Oriented Gradients Histogram in Computer Vision Rating: 0 out of 5 stars0 ratingsTone Mapping: Tone Mapping: Illuminating Perspectives in Computer Vision Rating: 0 out of 5 stars0 ratingsColor Model: Understanding the Spectrum of Computer Vision: Exploring Color Models Rating: 0 out of 5 stars0 ratingsColor Management System: Optimizing Visual Perception in Digital Environments Rating: 0 out of 5 stars0 ratingsColor Mapping: Exploring Visual Perception and Analysis in Computer Vision Rating: 0 out of 5 stars0 ratingsJoint Photographic Experts Group: Unlocking the Power of Visual Data with the JPEG Standard Rating: 0 out of 5 stars0 ratingsFilter Bank: Insights into Computer Vision's Filter Bank Techniques Rating: 0 out of 5 stars0 ratingsDirect Linear Transformation: Practical Applications and Techniques in Computer Vision Rating: 0 out of 5 stars0 ratingsAnisotropic Diffusion: Enhancing Image Analysis Through Anisotropic Diffusion Rating: 0 out of 5 stars0 ratingsBlob Detection: Unveiling Patterns in Visual Data Rating: 0 out of 5 stars0 ratings
Related ebooks
Search Tree: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsFlood Fill: Flood Fill: Exploring Computer Vision's Dynamic Terrain Rating: 0 out of 5 stars0 ratingsBreadth First Search: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsDecision Tree Pruning: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsData Structures & Algorithms Interview Questions You'll Most Likely Be Asked Rating: 1 out of 5 stars1/5Mesh Generation: Advances and Applications in Computer Vision Mesh Generation Rating: 0 out of 5 stars0 ratingsBeginning Data Structures Using C Rating: 4 out of 5 stars4/5Visualizing Data Structures Rating: 0 out of 5 stars0 ratingsADVANCED DATA STRUCTURES FOR ALGORITHMS: Mastering Complex Data Structures for Algorithmic Problem-Solving (2024) Rating: 0 out of 5 stars0 ratingsAlternating Decision Tree: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsMinimum Bounding Box: Unveiling the Power of Spatial Optimization in Computer Vision Rating: 0 out of 5 stars0 ratingsDesign And Analysis Of Algorithm Rating: 0 out of 5 stars0 ratingsGeometric Hashing: Efficient Algorithms for Image Recognition and Matching Rating: 0 out of 5 stars0 ratingsCompetitive Learning: Fundamentals and Applications for Reinforcement Learning through Competition Rating: 0 out of 5 stars0 ratingsDepth First Search: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsMagic Data: Part 1 - Harnessing the Power of Algorithms and Structures Rating: 0 out of 5 stars0 ratingsJoe Celko's Trees and Hierarchies in SQL for Smarties Rating: 0 out of 5 stars0 ratingsScale Invariant Feature Transform: Unveiling the Power of Scale Invariant Feature Transform in Computer Vision Rating: 0 out of 5 stars0 ratingsSpatiotemporal Data Analysis Rating: 3 out of 5 stars3/5Two Dimensional Geometric Model: Understanding and Applications in Computer Vision Rating: 0 out of 5 stars0 ratingsGeometric Primitive: Exploring Foundations and Applications in Computer Vision Rating: 0 out of 5 stars0 ratingsPerceptrons: Fundamentals and Applications for The Neural Building Block Rating: 0 out of 5 stars0 ratingsRaster Graphics: Understanding the Foundations of Raster Graphics in Computer Vision Rating: 0 out of 5 stars0 ratingsSupport Vector Machine: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsIntroduction to Topology Rating: 0 out of 5 stars0 ratingsDigital Raster Graphic: Unveiling the Power of Digital Raster Graphics in Computer Vision Rating: 0 out of 5 stars0 ratingsConvolutional Neural Networks: Fundamentals and Applications for Analyzing Visual Imagery Rating: 0 out of 5 stars0 ratingsMatrix Theory Rating: 0 out of 5 stars0 ratingsBasic Structured Grid Generation: With an introduction to unstructured grid generation Rating: 0 out of 5 stars0 ratingsParticulate Morphology: Mathematics Applied to Particle Assemblies Rating: 0 out of 5 stars0 ratings
Intelligence (AI) & Semantics For You
Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/52084: Artificial Intelligence and the Future of Humanity Rating: 4 out of 5 stars4/5ChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratingsSummary of Super-Intelligence From Nick Bostrom Rating: 5 out of 5 stars5/5Artificial Intelligence: A Guide for Thinking Humans Rating: 4 out of 5 stars4/5ChatGPT For Fiction Writing: AI for Authors Rating: 5 out of 5 stars5/5ChatGPT: The Future of Intelligent Conversation Rating: 4 out of 5 stars4/5ChatGPT For Dummies Rating: 0 out of 5 stars0 ratings101 Midjourney Prompt Secrets Rating: 3 out of 5 stars3/5Dark Aeon: Transhumanism and the War Against Humanity Rating: 5 out of 5 stars5/5Impromptu: Amplifying Our Humanity Through AI Rating: 5 out of 5 stars5/5What Makes Us Human: An Artificial Intelligence Answers Life's Biggest Questions Rating: 5 out of 5 stars5/5The Algorithm of the Universe (A New Perspective to Cognitive AI) Rating: 5 out of 5 stars5/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5A Quickstart Guide To Becoming A ChatGPT Millionaire: The ChatGPT Book For Beginners (Lazy Money Series®) Rating: 4 out of 5 stars4/5Chat-GPT Income Ideas: Pioneering Monetization Concepts Utilizing Conversational AI for Profitable Ventures Rating: 4 out of 5 stars4/5The Secrets of ChatGPT Prompt Engineering for Non-Developers Rating: 5 out of 5 stars5/5The Age of AI: Artificial Intelligence and the Future of Humanity Rating: 0 out of 5 stars0 ratingsAI for Educators: AI for Educators Rating: 5 out of 5 stars5/510 Great Ways to Earn Money Through Artificial Intelligence(AI) Rating: 5 out of 5 stars5/5Humans Need Not Apply: A Guide to Wealth & Work in the Age of Artificial Intelligence Rating: 3 out of 5 stars3/5
Reviews for Quadtree
0 ratings0 reviews
Book preview
Quadtree - Fouad Sabry
Chapter 1: Quadtree
The data structure of a quadtree is a tree in which each internal node has exactly four offspring. Quadtrees are the two-dimensional equivalent of octrees and are typically used to partition a two-dimensional space into four quadrants or sections. The information associated with a leaf cell varies by application, but a leaf cell is a unit of interesting spatial information.
.
The partitioned zones may have arbitrary or square or rectangular shapes. 1974 saw the designation of this data structure as a quadtree by Raphael Finkel and J.L. Bentley. Q-tree is another term for a similar partitioning scheme. All types of quadtrees have certain characteristics:
They break space down into flexible cells.
Each compartment (or receptacle) has a maximum capacity. When the bucket's maximum capacity is reached, it separates.
The tree directory conforms to the quadtree's spatial decomposition.
A tree-pyramid (T-pyramid) is a full
tree; every node of the T-pyramid contains four child nodes, with the exception of leaf nodes; all leaves are on the same level, which corresponds to individual pixels in a picture. Similar to how a complete binary tree can be stored compactly in an array, tree-pyramid data can be stored compactly in an array as an implicit data structure.
Quadtrees can be categorized based on the types of data they represent, such as areas, points, lines, and curves. Quadtrees can also be categorized based on whether the shape of the tree is independent of the processing order. The subsequent are frequent forms of quadtrees:.
The region quadtree illustrates a two-dimensional partition of space by decomposing the region into four equal quadrants, subquadrants, etc., with each leaf node carrying data relating to a particular subregion. Each node in the tree has either precisely four children or none (a leaf node). This decomposition method (i.e. subdividing subquadrants as long as there is relevant data in the subquadrant for which greater refinement is sought) makes the height of quadtrees sensitive to and dependent on the spatial distribution of interesting areas in the space being decomposed. The region quadtree is a variant of the trie data structure.
A region quadtree with a depth of n may be used to represent an image consisting of 2n × 2n pixels, where every pixel is either 0 or 1.
The root node represents the totality of the image region.
If pixels in any region are not fully 0s or 1s, the region is considered invalid, It is segmented.
This is an application, Each leaf node represents a block of pixels consisting entirely of 0s or 1s.
Note the possible space savings when these trees are utilized for image storage; a common characteristic of visual depictions is the presence of numerous large areas with the same color value throughout.
Instead of storing a large 2-D array of every pixel in an image, a smaller array is used, A quadtree can capture the same information at possibly many more division levels than pixel-resolution sized cells.
Tree resolution and size are limited by pixel and picture dimensions.
A region quadtree may also be used to represent a data field with changeable resolution. For instance, a quadtree may be used to record the temperatures in a region, with each leaf node storing the average temperature for the subregion it represents.
The point quadtree
Following is how point quadtrees are built. Given the next point to insert, the corresponding cell is located and the point is added to the tree. The new point is inserted so that the cell containing it is partitioned into quadrants by the vertical and horizontal lines that pass through it. Cells are hence rectangular, but not always square. Each node in these trees holds one of the input points.
Due to the fact that the partition of the plane is determined by the order of point insertion, the height of the tree is sensitive and depends on insertion order. Inserting in a wrong
order may result in a tree whose height is proportional to the number of input points (at which point it becomes a linked-list). Preprocessing can be used to generate a tree with balanced height if the point set is static.
A node of a point quadtree is similar to a node of a binary tree, with the primary distinction being that it has four pointers (one for each quadrant) as opposed to two (left
and right
) like in a conventional binary tree. In addition, a key is typically divided into two components that refer to x and y coordinates. Consequently, a node contains the following data::
four pointers: quad[‘NW’], quad[‘NE’], quad[‘SW’], and quad[‘SE’]
point; which contains in turn:
identifier; typically stated as x, y coordinates
a value, such as a name
Point-region (PR) quadtrees resemble region quadtrees quite closely. The difference lies in the type of cell-related data saved. In a region quadtree, a value that applies to the full area of a leaf cell is kept. However, the cells of a PR quadtree hold a list of points that reside within a leaf cell. As previously stated, the height of trees employing this decomposition approach is dependent on the spatial distribution of the points. Similar to the point quadtree, the PR quadtree may have a linear height when a bad
set is provided.
Edge quadtrees (similar to PM quadtrees) are employed to hold lines as opposed to points. Cells are subdivided to an extremely fine resolution in order to approximate curves, precisely till there is a single line segment per cell. Edge quadtrees will continue to divide until they reach their maximum level of decomposition near corners/vertices. This may lead to severely imbalanced trees that negate the goal of indexing.
The polygonal map quadtree (or PM Quadtree) is a variant of quadtree used to hold groups of potentially degenerate polygons (meaning that they have isolated vertices or edges). A significant distinction between PM quadtrees and edge quadtrees is that the cell under examination is not partitioned if the segments within the cell intersect at a vertex.
There are three primary kinds of PM Quadtrees, which differ based on the data stored in each black node. PM3 quadtrees can hold an arbitrary number of non-intersecting edges and a single point at most. PM2 quadtrees are identical to PM3 quadtrees with the exception that all edges must terminate at the same position. PM1 quadtrees are similar to PM2 quadtrees, but black nodes may include a point and its edges or only a set of edges that share a point, but a point and a set of edges that do not contain the point are not permitted.
This section provides a summary of a chapter from Sariel Har-book. Peled's.
If we were to store every node corresponding to a subdivided cell, the storage need would be prohibitive, We may wind up storing a substantial number of empty nodes.
We can reduce the size of these sparse trees by saving only the subtrees whose leaves include interesting data (i.e.
significant subbranches
).
We can actually reduce the size much more.
When we retain just essential subtrees, The procedure of pruning may leave long routes in the tree with degree two intermediary nodes (a link to one parent and one child).
It turns out that we only need to store the node u at the beginning of this path (and associate some meta-data with it to represent the removed nodes) and attach the subtree rooted at its end to u .
When given poor
input points, it is nevertheless possible for these compressed trees to have a linear height.
Although a substantial amount of the tree is pruned during this compression,, Logarithmic-time search is still possible, insertion, and deletion by the use of Z-order curves.
The Z-order curve maps each cell of the full quadtree (and hence even the compressed quadtree) in O(1) time to a one-dimensional line (and maps it back in O(1) time too), establishing a complete order on the elements.
Therefore, We can store the quadtree in an ordered set data structure (in which we store the nodes of the tree).
We must state a reasonable assumption before we continue: we assume that given two real numbers {\displaystyle \alpha ,\beta \in [0,1)} expressed as binary, we can compute in O(1) time the index of the first bit in which they differ.
We also assume that we can compute in O(1) time the lowest common ancestor of two points/cells in the quadtree and establish their relative Z-ordering, and we can compute the floor function in O(1) time.
With these premises, point location of a given point q (i.e.
determining the cell that would contain q ), insertion, and deletion operations can all be performed in O(\log {n}) time (i.e.
time required to perform a search within the underlying ordered set data structure).
To perform a point location for q (i.e.
find the corresponding cell in the compressed tree):
Find the existing cell in the compressed tree that comes before q in the Z-order.
Call this cell v .
If {\displaystyle q\in v} , return v .
Else, find what would have been the lowest common ancestor of the point q and the cell v in an uncompressed quadtree.
Call this ancestor cell u .
Find the existing cell in the compressed tree that comes before u in the Z-order and return it.
Without delving into specifics, to do insertions and deletions, we first perform a point placement for the item to be inserted or deleted, and then insert or remove it. Care must be made to reshape the tree as necessary by adding or removing nodes.
Image representation
Bitmap and its compressed quadtree representationImage processing
Mesh generation
Spatial indexing, point-based and range-based searches
Two-dimensional collision detection efficiency
View data frustum culling for terrain
Sparse data storage, such as format information for a spreadsheet or matrix calculations
Multidimensional field solution (computational fluid dynamics, electromagnetism)
Program for Conway's Game of Life simulation.
State estimation
Quadtrees are also utilized in fractal picture analysis.
Maximum disjoint sets
Quadtrees, namely the region quadtree, have adapted themselves nicely to applications in image processing. Although region quadtrees and the image processing procedures done on them are equally applicable to color images, we will restrict our discussion to binary image data.
A benefit of employing quadtrees for picture processing is that set operations such as union and intersection may be performed rapidly and easily. Given two binary images, the image union (also known as overlay) produces an image in which a pixel is black if one of the input images contains a black pixel at the same place. In other words, a pixel in the output image is only white if the matching pixel in both input images is white; otherwise, it is black. Instead of doing the operation pixel-by-pixel, we can efficiently compute the union by using the quadtree's capacity to represent multiple pixels with a single node. For the purposes of the following explanation, if a subtree contains both black and white pixels, we shall claim that the subtree's root is gray.
The algorithm works by traversing the two input quadtrees ( T_{1} and T_{2} ) while building the output quadtree T .
Informally, the algorithm is described as follows:.
Consider the nodes {\displaystyle v_{1}\in T_{1}} and {\displaystyle v_{2}\in T_{2}} corresponding to the same region in the images.
If v_{1} or v_{2} is black, the corresponding node is created in T and is colored black.
If one is black and the other is gray, just one is black, Underneath the gray node will be a subtree.
This subtree is unnecessary to navigate.
If v_{1} (respectively, v_{2} ) is white, v_{2} (respectively, v_{1} ) and the subtree underneath it (if any) is copied to T .
If both v_{1} and v_{2} are gray, then the corresponding children of v_{1} and v_{2} are considered.
While the algorithm is effective, It does not ensure a minimum-sized quadtree by itself.
For example, consider the result if we were to union a checkerboard (where every tile is a pixel) of size {\displaystyle 2^{k}\times 2^{k}} with its complement.
The outcome is a massive black square that should be represented by a