Image Rotation Using Quad Tree

Similar documents
Organizing Spatial Data

1. Meshes. D7013E Lecture 14

CS535 Fall Department of Computer Science Purdue University

Mesh Generation. Quadtrees. Geometric Algorithms. Lecture 9: Quadtrees

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

إستخدام األشجار الرباعية و تقسيم المسافة الهرمي

Module 4: Index Structures Lecture 13: Index structure. The Lecture Contains: Index structure. Binary search tree (BST) B-tree. B+-tree.

Ray Tracing Acceleration Data Structures

UNIVERSITY OF WATERLOO Faculty of Mathematics

Spatial Data Structures

Code Transformation of DF-Expression between Bintree and Quadtree

Module 8: Range-Searching in Dictionaries for Points

Spatial Data Structures

Quadtrees and Meshing

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

Trees. Eric McCreath

Self-Balancing Search Trees. Chapter 11

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

REGION BASED SEGEMENTATION

Second degree equations - quadratics. nonparametric: x 2 + y 2 + z 2 = r 2

Geometric Structures 2. Quadtree, k-d stromy

Data Representation in Visualisation

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Uses for Trees About Trees Binary Trees. Trees. Seth Long. January 31, 2010

A Tutorial on Spatial Data Handling

CS301 - Data Structures Glossary By

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Multidimensional Indexes [14]

Geometric Algorithms. Geometric search: overview. 1D Range Search. 1D Range Search Implementations

A QUAD-TREE DECOMPOSITION APPROACH TO CARTOON IMAGE COMPRESSION. Yi-Chen Tsai, Ming-Sui Lee, Meiyin Shen and C.-C. Jay Kuo

Subdivision Of Triangular Terrain Mesh Breckon, Chenney, Hobbs, Hoppe, Watts

Indexing. Week 14, Spring Edited by M. Naci Akkøk, , Contains slides from 8-9. April 2002 by Hector Garcia-Molina, Vera Goebel

Multidimensional Indexing The R Tree

MODELING AND HIERARCHY

11 - Spatial Data Structures

Comparison of Compressed Quadtrees and Compressed k-d Tries for Range Search

Spatial Data Management

Data Structures and Algorithms

Spatial Data Management

Solution READ THIS NOW! CS 3114 Data Structures and Algorithms

Advanced Algorithm Design and Analysis (Lecture 12) SW5 fall 2005 Simonas Šaltenis E1-215b

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Advanced Data Types and New Applications

Spatial Data Structures for GIS Visualization. Ed Grundy

9. Three Dimensional Object Representations

Ray Tracing: Intersection

Indexing and Hashing

ECE 242 Data Structures and Algorithms. Trees IV. Lecture 21. Prof.

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Chapter 12: Indexing and Hashing. Basic Concepts

Angle, symmetry and transformation

CMSC 425: Lecture 10 Geometric Data Structures for Games: Index Structures Tuesday, Feb 26, 2013

CS251-SE1. Midterm 2. Tuesday 11/1 8:00pm 9:00pm. There are 16 multiple-choice questions and 6 essay questions.

Chapter 12: Indexing and Hashing

Algorithms. AVL Tree

Spatial Data Structures for Computer Graphics

Morphological track 1

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Lecture 17: Solid Modeling.... a cubit on the one side, and a cubit on the other side Exodus 26:13

Intersection Acceleration

The Unified Segment Tree and its Application to the Rectangle Intersection Problem

Advanced Data Types and New Applications

Computer Graphics. Bing-Yu Chen National Taiwan University

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu.

Algorithms. Deleting from Red-Black Trees B-Trees

Unit Maps: Kindergarten Math

Digital Image Processing Fundamentals

Geometric Rectification of Remote Sensing Images

Consolidation of Grade 6 EQAO Questions Geometry and Spatial Sense

Speeding Up Ray Tracing. Optimisations. Ray Tracing Acceleration

Properties of red-black trees

In-Memory Searching. Linear Search. Binary Search. Binary Search Tree. k-d Tree. Hashing. Hash Collisions. Collision Strategies.

Fourier analysis of low-resolution satellite images of cloud

Orthogonal range searching. Orthogonal range search

Compressing 2-D Shapes using Concavity Trees

Accelerated Raytracing

Binary Search Trees. Analysis of Algorithms

Chap4: Spatial Storage and Indexing. 4.1 Storage:Disk and Files 4.2 Spatial Indexing 4.3 Trends 4.4 Summary

Chapter 12: Indexing and Hashing

Maths Checklist Stage 2 - Year 4

EE 368. Weeks 5 (Notes)

Search. The Nearest Neighbor Problem

1 The range query problem

CPSC / Sonny Chan - University of Calgary. Collision Detection II

An improvement in the build algorithm for Kd-trees using mathematical mean

CSE 554 Lecture 5: Contouring (faster)

Module 4. Stereographic projection: concept and application. Lecture 4. Stereographic projection: concept and application

Year 6 Summer Term Week 1 to 2 Geometry: Properties of Shapes

What we have covered?

CSG obj. oper3. obj1 obj2 obj3. obj5. obj4

Red-Black, Splay and Huffman Trees

Multi-way Search Trees. (Multi-way Search Trees) Data Structures and Programming Spring / 25

Collision Detection. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

POSITION, DIRECTION AND MOVEMENT Year 1 Year 2 Year 3 Year 4 Year 5 Year 6 Use mathematical

CSE 167: Introduction to Computer Graphics Lecture 11: Scene Graph 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Overview of Unstructured Mesh Generation Methods

DATA STRUCTURES AND ALGORITHMS. Hierarchical data structures: AVL tree, Bayer tree, Heap

Nearest Neighbors Classifiers

Transcription:

80 Image Rotation Using Quad Tree Aashish Kumar, Lec. ECE Dept. Swami Vivekanand institute of Engneering & Technology, Ramnagar Banur ABSTRACT This paper presents a data structure based technique of rotating an image.the data structure used is Quad trees. In a Quad tree the Image can be represented using 2-d arrays.this array representation helps to rotate the image by changing the quadrants. The image can be rotated in clockwise and anti-clockwise direction. Firstly, the image is splittedupto a level so that a solid colored block remains at the end. Then, as per requirements the blocks are rotated and join to get the final image. INTRODUCTION Image processing is any form of signal processing for which the input is an image, such as a photograph or video frame; the output of image processing may be either an image or, a set of characteristics or parameters related to the image. Most imageprocessing techniques involve treating the image as a two-dimensional signal and applying standard signalprocessing techniques to it. a. Image Processing Elements Fig. 1 Fundamental Elements of Image Processing system Why do we need Image Processing? Improvement of Pictorial information for human perception Image processing for autonomous machine application Efficient storage of Image Faster &efficient Transmission over communication channels. n electrical engineering and computer science, image processing is any form of signal processing for which the input is an image, such as a photograph or video frame; the output of image processing may be either an image or, a set of characteristics or parameters related to the image. Most image-processing techniques involve treating the image as a twodimensional signal and applying standard signalprocessing techniques to it. Image processing usually refers to digital image processing, but optical and analog image processing also are possible. This article is about general techniques that apply to all of them. The acquisition of images (producing the input image in the first place) is referred to as imaging. TYPICAL OPERATIONS Euclidean geometry transformations such as enlargement, reduction, and rotation Color corrections such as brightness and contrast adjustments, color mapping, color balancing, quantization, or color translation to a different color space Digital compositing or optical compositing (combination of two or more images), which is used in film-making to make a "matte" Interpolation, demosaicing, and recovery of a full image from a raw image format using a Bayer filter pattern Image registration, the alignment of two or more images Image differencing and morphing Image recognition, for example, may extract the text from the image using optical character recognition or checkbox and bubble values using optical mark recognition Image segmentation High dynamic range imaging by combining multiple images Geometric hashing for 2-D object recognition with affine invariance www.borjournals.com Blue Ocean Research Journals 80

81 INTRODUCTION TO QUAD TREE a) Quad tree: A quad tree for representing a picture is a tree in which successively deeper levels represent successively finer subdivisions of picture areas. Each node represents the quadrant of its parent. The tree is filled up by a process of subdividing an image matrix into four quadrants recursively until the quadrant is one solid color. A Quad tree is a tree whose nodes are either leaves or have four children. The children are ordered: 1, 2, 3 and 4. b) Quad tree for pictures: A quad tree for, or representing, a picture is a quad tree whose leaves represent areas of the picture; each leaf is labeled with the color of the area of the picture. Each node is associated with the square region of the picture. The root is associated with the entire picture. Besides the root, each other node is associated with one of the four quadrants of its parent s square. The ith child is associated with the ith quadrant of its parent s square. No parent node may have all its descendants represent the same region of the picture, if all descendants have the same color. c) Quad Tree Types: Quad trees may be classified according to the type of data they represent, including areas, points, lines and curves. Quadtrees may also be classified by whether the shape of the tree is independent of the order data is processed. Some common types of quadtrees are: 1)The region quadtree: The region quadtree represents a partition of space in two dimensions by decomposing the region into four equal quadrants, subquadrants, and so on with each leaf node containing data corresponding to a specific subregion. Each node in the tree either has exactly four children, or has no children (a leaf node). The region quadtree is not strictly a 'tree' - as the positions of subdivisions are independent of the data. They are more precisely called 'tries'. A region quadtree with a depth of n may be used to represent an image consisting of 2 n 2 n pixels, where each pixel value is 0 or 1. The root node represents the entire image region. If the pixels in any region are not entirely 0s or 1s, it is subdivided. In this application, each leaf node represents a block of pixels that are all 0s or all 1s.A region quadtree may also be used as a variable resolution representation of a data field. For example, the temperatures in an area may be stored as a quadtree, with each leaf node storing the average temperature over the subregion it represents.if a region quadtree is used to represent a set of point data (such as the latitude and longitude of a set of cities), regions are subdivided until each leaf contains at most a single point. 2) Point quadtree: The point quadtree is an adaptation of a binary tree used to represent two dimensional point data. It shares the features of all quadtrees but is a true tree as the center of a subdivision is always on a point. The tree shape depends on the order data is processed. It is often very efficient in comparing two dimensional ordered data points, usually operating in O (log n)time. A node of a point quadtree is similar to a node of a binary tree, with the major difference being that it has four pointers (one for each quadrant) instead of two ("left" and "right") as in an ordinary binary tree. Also a key is usually decomposed into two parts, referring to x and y coordinates. Therefore a node contains following information: 4 Pointers: quad[ NW ], quad[ NE ], quad[ SW ], and quad[ SE ] point; which in turn contains: o key; usually expressed as x, y coordinates o value; for example a name 3) Edge quad tree: Edge quad trees are specifically used to store lines rather than points. Curves are approximated by subdividing cells to a very fine resolution. This can result in extremely unbalanced trees which may defeat the purpose of indexing. d) Quad Tree Properties: 1) Image Representation www.borjournals.com Blue Ocean Research Journals 81

82 c) SW (South West) d) SE (South East) Fig 1. Image and its quad tree 2) Decompose space into adaptable cells and each cell (or bucket ) has a maximum capacity (or threshold ). 3) When max capacity is reached the cell is split. 4) Algorithms for search are generally log d N, where d is the dimensionality (4 for true quadtree) 5) Related to kd-trees, space is partitioned in rectilinear subdivisions. Difference is kd-trees always bisect space, while quadtrees quarter it. 6) Spatial indexing. 7) Efficient collision detection in two dimensions. 8) View frustum culling of terrain data. 9) Storing sparse data, such as a formatting information for a spreadsheet or for some matrix calculations. 10) Solution of multidimensional fields (computational fluid dynamics, electromagnetism). 11) Conway's Game of Life simulation program. 12) State estimation. 2)Split: Root node Broken into children. The image can be broken into the 4 quadrants as shown below. It is done upto one level only. Now, we will check whether each node is representing only one solid color or not. Here, each node is not representing only one solid color. So, it is to be broken down further. NE Fig. 3.2 Split Image NW SW 3) Split: Further each node breakdown of each quadrant into children. Here, each child is representing only one solid color. SE ROTATION a) Rotate Image by 90 0 in counter-clockwise direction 1) Initial Image: Given is the Image to be rotated through given Angle Fig. 3.1 Initial Image 4 children of the root node respectively represent Fig. 3.3 Split Image 4)Rotate:Here, rotation is performed recursiely to perform 90 0 counter clockwise rotation.it is done as follows: a) NE NW b) NW SW c) SW SE d) SE NE a) NE (North East) b) NW (North West) www.borjournals.com Blue Ocean Research Journals 82

83 ALGORITHM Fig. 3.4 Rotate 5) Join: Here, the join is performed recursively to get the final image.each single color solid pixel is arranged in the prescribed fashion of four quadrants. Fig. 3.5 Join 6) Rotate: Here, Rotation is performed in the already described fashion and each quadrant is rearranged Fig. 3.6 Rotate 7) Join: The final image after join is as shown. This is the required counter clockwise rotation of the image Fig. 3.7 Join 1. Recursive Algorithm for Rotation: a) If root is a leaf, return. b) Rotate the children of the root. (NE, NW, SW, SE) (NW, SW, SE, NE) c) Recursively perform the rotation in the subtrees of the root. d) Complexity is Q (size of quad tree).. e) Quad tree size = # nodes. f) Quad tree size is usually substantially less than matrix size. 2. Rotations Possible: a) Clockwise rotations by 180 and 270 degreesare similar. b) Counterclockwise rotations by 90, 180, and 270 degrees are similar. c) Rotation by 360 degrees is null. 3. Image Representation: a) n x n matrix. 1. Q (n2) space. 2. Q (n2) time for rotation, scaling, union, intersection and so on. b) Quad tree. 1. O (n2) space. 2. O (n2) time for rotation, scaling, union, intersection and so on. For some images, the space and time could be as little as O (1) (e.g., all white or all black images). CONCLUSION This paper has worked over the image rotation using quad trees, a major concern in advanced data structures. Quad trees are very efficient in representing the 2-D images. So, we have used this property of Quad trees to work over a major operation on images i.e. rotation. The images can be rotated only at 90 0, 180 0, 270 0 or 360 0.We has observed that image rotation algorithm is very easy to understand for a person and is present with very much less computations and calculations. SO, for simple rotations, we can use this algorithm so as to maintain the soul of the software engineering i.e. complexity. The work done with the quad trees is space as well as time efficient. For future work, we plan to find the pitfalls of using quad trees to work with image rotations at some other angels that are not multiple of 90 0.We will compare the quad tree algorithms with some other image processing algorithms and will try to make quad trees to work on more complex image rotation situations. www.borjournals.com Blue Ocean Research Journals 83

84 We will construct the algorithm to handle such a complex scenario with an acceptable level of accuracy and low computational overhead. www.borjournals.com Blue Ocean Research Journals 84