Efficient filter computation with symmetric matrix kernels

Size: px
Start display at page:

Download "Efficient filter computation with symmetric matrix kernels"

Transcription

1 Efficient filter computation with symmetric matrix ernels Manfred opp nstitute of Computer raphics, Visualization and Animation roup Technical University of Vienna, arlsplatz 3/86-2, A-040 Wien Abstract This paper presents an algorithm for filter calculations using symmetric matrix ernels. This algorithm outperforms traditional methods for ernels larger than or equal to 5x5 on machines based on RSC designs, where the time needed to calculate an addition equals the time needed for a multiplication. The algorithm is based on a decomposition of the ernel matrix into several ernel matrices of decreasing size, which can be computed very fast because of spatial coherence. A comparison with traditional methods shows the efficiency of the presented approach. eywords: image processing, anti-aliasing, filtering, symmetric matrix ernels, spatial coherence ntroduction iltering using matrix ernels is a common technique in image processing [Russ92][abe89] and anti-aliasing [ole90][watt92]. The filtered pixel is the weighted sum of the original and its neighbouring pixels within a rectangle defined by a maximum distance in x- and y- direction which is determined by the ernel size. The weights form a (M x ) matrix called the ernel matrix. The dimensions M and of the ernel matrix are usually odd, which guarantees that the maximum distance of accounted neighbouring pixels from the original pixel in one dimension is the same in positive and in negative direction. Equation () describes the filter computation using a ernel matrix: M p p m M + + xy, = ij, x+ i m, y+ j n; = ; n = ; () 2 2 i= j= p xy,... filtered pixel at position (x,y) p xy,... original pixel at position (x,y)... (M x ) ernel matrix According to Equation (), a straight forward implementation of a general ernel filter would require (M ) multiplications and (M -) additions for each filtered pixel. Since a picture usually contains several hundreds of thousands to several millions of pixels, efficient filtering is important to get the results in resonable time.

2 n this paper we want to cope with ernel filters, which are symmetric with respect to the x- axis and the y-axis. iven a (M x ) ernel matrix, is symmetric with respect to the x- axis, iff ij, = M + i, j; i M; j (2a) and symmetric with respect to the y-axis, iff ij, = i, + j ; i M; j (2b) Most of the frequently used filter ernels are symmetric with respect to the x- and y-axis, including auss ernels [Russ92], Box ernels [Watt92], and Bartlett ernels [Crow8]. A simple improvement for symmetric ernels to the general ernel filter algorithm could mae use of the symmetry to reduce the number of multiplications: The four symmetric pixels are added and the common weight ij, = M + i, j= M + i, + j = i, + j is multiplied afterwards. This improved method needs only /4 (M ) multiplications if M and are even and a little bit more, if M or are odd, but still (M -) additions. 2 Basic algorithm 2. Concept of our proposed algorithm Our goal is to reduce the number of operations, consisting of additions and multiplications, needed in the filtering. This goal will be reached through the reduction of additions, but the number of multiplications will be larger than or equal to those in traditional methods. Therefore we are assuming, that the calculation time for a multiplication equals the calculation time for an addition, which is usually true on RSC based machines. The efficiency of our algorithm is based on spatial coherence [röl93], the use of information gained from the filtering of neighbouring pixels for the actual filtering. To achieve the goal we will recursively decompose the ernel matrix into the sum of a smaller ernel matrix and two less computational expensive ernel matrices of the same size. Equation (3) shows this decomposition of the ernel into three simpler to compute ernels. rom () it can be derived, that the sum of the filtering with the ernels i, i=,2,...,anz, is equal to the filtering with ernel Chapter 2.2 describes our decomposition scheme, chapter 2.3 explains the filter algorithm based on the decomposition and appendix B shows an example of the proposed algorithm with a 5x5 ernel filter. anz i i=.

3 , 2, L,, 2, 22, 2, 2, + = M L M = A + B+ = () 3 M M M, 2,, M, M, M, 2 L M, M, A, A2, L A A,, S 0 L 0 S 0 0 L 0 0 A2, A22, A2, A + + 2, , L, 2 0 M L M + M... M + M M L M M + + AM AM AM A, 2,, M, M 2, L M 2 2 0, AM, AM, 2 L AM, AM, S S 0 0 L Matrix decomposition The first step in the algorithm is a decomposition of the (M x ) ernel matrix in a scalar value S, a (M x ) matrix A and a ((M-2)x(-2)) matrix 2. S, A and 2 are computed according to the following equations with =: S =, (4) A, = AM 2 + 2, = A, = A M 2 + 2, = (5a) Ai, = Ai, = i, ; < i < M (5b) A, j AMj,, j j 2 2 (5c) Aij, = Ai, A, j; < i< M 2 + 2; < j< (5d) + ij, = i+, j+ Ai+, j+ ; i M 2 ; j 2 (6) urthermore A can be written as the product of a vertical vector v and a horizontal vector h: h = A, j; v = Ai, ; A= v h; (7) i M 2 + 2; j With this recursive calculation scheme, S, v, h and + are calculated from,, until one of the dimensions of the matrix + reaches one or two. The result of this recursive decomposition are q scalar values S, q vertical vectors v, and q horizontal vectors h and the remaining ernel matrix q+ MM P with q = M P min, M P Q. 2 2 M QP 2.3 ilter computations with the components irst we can sum up the pixels affected by the scalar values S i, i q. This leads to the first intermediate sum:

4 q i $ ii, $ M + i, i $ M + i, + i $ i, + i i= sum = S cp + p + p + p h (8) p$ ij, = px+ i my, + i n; i M; j The next step is to compute the ernel filtering with the ernel A, q and add these filterings to the intermediate sum. But instead of applying the whole matrix A on the window of neighbouring pixels, we apply the horizontal filter h on each line of this window, followed by the vertical filter v applied on the result of the horizontal filtering. rom () and (7) it can be proved, that this method produces the same results as applying A itself. ote that because of the symmetry of v and h, only one multiplication has to be performed in the filtering for each pair of opposite pixels. The ernel calculations with the horizontal filters can be reused in filtering of the neighbouring vertical pixels. Therefore only one new horizontal filter has to be applied for the calculation of one ernel A on a new pixel window except in the calculation of the first lines of the picture. inally the ernel matrix filtering with q+ is computed and added to the previous sum using the conventional method with symmetry enhancements described in chapter. ote that the size of the remaining ernel q+ is less than or equal to ((M-+2) x 2) or (2 x ( - M + 2), respectively. or square ernels the remaining ernel q+ is (x) or (2x2), respectively. 3 Optimizations One obvious optimization is to stop the recursive decomposition, if the last computed intermediate ernel equals the null matrix O. ote that the Box ernel and the Bartlett ernel need only one decomposition step, because these ernels can directly be written as the product of a vertical and a horizontal vector with integer values. Also obvious, scalar values S can be ignored, if they are 0. Our algorithm outperforms traditional ones, if the size of the ernel is big and is beaten, if the size is small. Therefore one optimization is to alter the decomposition scheme to stop decomposing, if the remaining ernel + can be computed faster with a traditional algorithm. Often integer arithmetic is used for the calculation of the filtering with integer values in the ernel and the result is divided by a scaling value. This is because the frame buffer only deals with integer color values and the filtering is made for direct display. Therefore floating point arithmetic would cause some additional conversion overhead. f floating point arithmetic is used because of the needed precision of the result, the decomposition of the ernel matrix can be modified to get rid of most of the scalar values S :

5 (, = 0) DO calculate decomposition according to (4),(5),(6),(7) ELSE DO S =0 (9) A, = AM 2 + 2, = A, = AM 2 + 2, =, (0) calculate rest of matrix A and + according to (5b)-(5d), (6) Ai, h = A, j; v = ; i M 2 + 2; A, j () With this decomposition scheme, S can only be - or 0, therefore most additions in (8) can be sipped, because S =0. Therefore (8) can be replaced with: $ ii, $ M + i, i $ M + i, + i $ i, + i S 0 ; i q sum = cp + p + p + p h (2) i 4 Results Table shows a comparison of operations needed for the computation of one filtered pixel using square matrix ernels with odd dimensions which are symmetric with respect to the x- and y-axis. We used odd square matrix ernels for our comparison, because these are the most frequently used ernels in image processing and anti-aliasing. Standard is the brute force implementation of general ernel matrix filtering. Symmetric refers to the standard method improved by reducing multiplications through adding up the symmetric pixels before the multiplication. Base is the algorithm described in chapter 2 and Optimized uses our basic algorithm enhanced with the optimization to stop decomposing, if the remaining ernel + can be computed faster with the Symmetric algorithm. The decomposition threshold for this algorithm with odd square matrix ernels is 3x3. To calculate the operations needed for the Base algorithm with a x ernel, we need: the operations needed for a (-2)x(-2) ernel 4 additions and multiplication for the addition of the four corner points multiplied with S - additions and (-)/2 multiplications for the filtering with the horizontal vector - additions and (-)/2 multiplications for the filtering with the vertical vector addition to add the result of the vector filtering to the rest. Because the first and the last weights in the horizontal and vertical vector are, only (-)/2 and not (+)/2 multiplications are needed for the vector filtering. Therefore to calculate the operations needed for a x ernel with odd we need the operations needed for a (-2)x(-2) ernel filter plus 2 +3 additions plus multiplications. The only difference in the calculation of operations for the Optimized algorithm is that it starts from a 3x3 ernel filtering computed with the Symmetric algorithm.

6 Standard Symmetric (Sym) Base Optimized Add Mul Op Add Mul Op Add Mul Op Add Mul Op 3x Sym Sym Sym 5x x x x x x Table - Comparison of algorithms with ernel symmetric with respect to the x- and y-axis Usually square ernel filters, which are symmetric with respect to the x- and y-axis are also symmetric with respect to the diagonals. Therefore the Symmetric algorithm can be extended to cope with the diagonal symmetry, which reduces the number of multiplications needed for a filter computation to be smaller than that of our algorithm. But the number of operations is still lower in our proposed algorithm, therefore it beats the Symmetric algorithm on RSC machines, where the time needed for an addition equals the time needed for a multiplication. Table 2 shows the actual numbers. Symmetric (Sym) Optimized general case Optimized Box ernels Optimized Bartlett ernels Add Mul Op Add Mul Op Add Mul Op Add Mul Op 3x3 8 3 Sym Sym Sym x x x x x x Table 2 - Comparison of algorithms with ernel symmetric with respect to the x- and y-axis and the diagonals and optimized algorithms for Box and Bartlett ernels Table 2 also contains the number of operations needed for a highly optimized filtering with Bartlett ernels and Box ernels, described in chapter 3. The Bartlett ernels itself are shown in appendix A. The Optimized Box ernel computation does not need a multiplication, because all values in the ernel matrix are. ote that in these optimizations the number of operations needed for the filtering of one pixel is only linear to the horizontal or vertical dimension of the ernel.

7 5 Conclusions This paper presented an algorithm for efficient computation of matrix ernels filtering with symmetry with respect to the x- and y-axis. Our proposed algorithm clearly beats the brute force method and also the enhanced method using the symmetry to reduce the number of multiplications for ernels larger than or equal to 5x5. n the case of square matrix ernels, which are also symmetric with respect to the diagonals, the proposed algorithm uses less operations, but more multiplications with large ernels than the standard algorithm improved for exploiting these symmetries. Therefore the proposed algorithm also performs better than the symmetry enhanced standard algorithm on RSC machines, where the calculation time for an addition equals the calculation time for a multiplication. Also optimizations of the basic algorithm using special properties of some specific ernels were exploited. Examples for these include the Box and the Bartlett ernels. Acnowledgements want to than Martin eda, Eduard röller and Werner Purgathofer for their helpful comments. ote This paper is also available online as a Technical Report from the World-Wide Web server of the nstitute of Computer raphics at the Technical University of Vienna at or via TP at ftp://ftp.cg.tuwien.ac.at/pub/tr/94/tr ps.gz References [Crow8]. C. Crow, A Comparison of Anti-aliasing Techniques, EEE Computer raphics and Applications (), 40-48, an 98. [ole90] ames D. oley, Andries van Dam, Steven. einer and ohn. ughes, Computer raphics - Principles and Practice, Second Edition, Addison-Wesley Publishing Company 990, pp [röl93] Eduard röller, Coherence in Computer raphics, PhD Thesis at the Technical University of Vienna, Verband der wissenschaftlichen esellschaften Österreichs (VWÖ) 993. [abe89] Peter aberäcer, Digitale Bildverarbeitung - rundlagen und Anwendungen, Third Edition, Carl anser Verlag 989, pp [Russ92] ohn C. Russ, The mage Processing andboo, CRC Press 992.

8 [Watt92] Alan Watt and Mar Watt, Advanced Animation and Rendering Techniques, Addison-Wesley and ACM Press 992, pp -54. A Bartlett ernels B 2 B = B = B = B = = B Example of the algorithm with a 5x5 ernel filter iven a 5x5 ernel matrix and the 5x5 matrix W containing the original and neighbouring pixels: = W= To chec the results of our algorithm, we compute the ernel filtering directly: p direct = =79.

9 According to (4), S = 2- =, A can be computed from (5a)-(5d) and 2 from (6): A = rom A h and vcan be computed via (7): = = = h= b g v= ow we enter the second level of the recursion and compute S, A,, h and v: S 2 = 5- = A = = b 5 24g= b 29g h= b 6 g v= = Since the dimension of 3 is one, the decomposition is halted. Let us loo at the filter computations with the components: irst we compute the sum of the pixels affected by the scalar values S and S 2 using (8): sum = (+3+0+2) + 4 ( )= 22 The next step to do is to compute the ernel filters h and v on W, 2 h and 2 v on the inner 3x3 window of W and add it to the sum v hbwg v = = v 0 = = v h 0 v 6 0 v = + + = = + + = sum 2 = sum = 79 inally we have to add the x ernel filter 3 on the inner point of W to the sum: 3 p = sum 2+ ( 0) = 79+ ( 29) 0= 79 This yields to the same result as with the direct ernel filter computation. 4

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into 2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into the viewport of the current application window. A pixel

More information

From Ver(ces to Fragments: Rasteriza(on

From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments 3D vertices vertex shader rasterizer fragment shader final pixels 2D screen fragments l determine fragments to be covered l interpolate

More information

For example, the system. 22 may be represented by the augmented matrix

For example, the system. 22 may be represented by the augmented matrix Matrix Solutions to Linear Systems A matrix is a rectangular array of elements. o An array is a systematic arrangement of numbers or symbols in rows and columns. Matrices (the plural of matrix) may be

More information

1 Motivation for Improving Matrix Multiplication

1 Motivation for Improving Matrix Multiplication CS170 Spring 2007 Lecture 7 Feb 6 1 Motivation for Improving Matrix Multiplication Now we will just consider the best way to implement the usual algorithm for matrix multiplication, the one that take 2n

More information

Graphics (Output) Primitives. Chapters 3 & 4

Graphics (Output) Primitives. Chapters 3 & 4 Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Pipeline Scan conversion converts primitives such as lines, circles, etc. into pixel values geometric description a finite scene area

More information

Weighted Powers Ranking Method

Weighted Powers Ranking Method Weighted Powers Ranking Method Introduction The Weighted Powers Ranking Method is a method for ranking sports teams utilizing both number of teams, and strength of the schedule (i.e. how good are the teams

More information

Why Use the GPU? How to Exploit? New Hardware Features. Sparse Matrix Solvers on the GPU: Conjugate Gradients and Multigrid. Semiconductor trends

Why Use the GPU? How to Exploit? New Hardware Features. Sparse Matrix Solvers on the GPU: Conjugate Gradients and Multigrid. Semiconductor trends Imagine stream processor; Bill Dally, Stanford Connection Machine CM; Thinking Machines Sparse Matrix Solvers on the GPU: Conjugate Gradients and Multigrid Jeffrey Bolz Eitan Grinspun Caltech Ian Farmer

More information

Accelerated Precalculus 1.2 (Intercepts and Symmetry) Day 1 Notes. In 1.1, we discussed using t-charts to help graph functions. e.g.

Accelerated Precalculus 1.2 (Intercepts and Symmetry) Day 1 Notes. In 1.1, we discussed using t-charts to help graph functions. e.g. Accelerated Precalculus 1.2 (Intercepts and Symmetry) Day 1 Notes In 1.1, we discussed using t-charts to help graph functions. e.g., Graph: y = x 3 What are some other strategies that can make graphing

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2013 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2013 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

Topics. From vertices to fragments

Topics. From vertices to fragments Topics From vertices to fragments From Vertices to Fragments Assign a color to every pixel Pass every object through the system Required tasks: Modeling Geometric processing Rasterization Fragment processing

More information

Lecture 5: Matrices. Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur

Lecture 5: Matrices. Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur Lecture 5: Matrices Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur 29 th July, 2008 Types of Matrices Matrix Addition and Multiplication

More information

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Downloaded from :www.comp.dit.ie/bmacnamee/materials/graphics/006- Contents In today s lecture we ll have a loo at:

More information

Rotation with Quaternions

Rotation with Quaternions Rotation with Quaternions Contents 1 Introduction 1.1 Translation................... 1. Rotation..................... 3 Quaternions 5 3 Rotations Represented as Quaternions 6 3.1 Dynamics....................

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2018 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2018 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

UNIT 2 2D TRANSFORMATIONS

UNIT 2 2D TRANSFORMATIONS UNIT 2 2D TRANSFORMATIONS Introduction With the procedures for displaying output primitives and their attributes, we can create variety of pictures and graphs. In many applications, there is also a need

More information

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions: Matrices A Matrix is an array of numbers: We talk about one matrix, or several matrices. There are many things we can do with them... Adding A Matrix (This one has 2 Rows and 3 Columns) To add two matrices:

More information

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored. From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)

More information

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels Pixels Pixel: Intensity or color sample. Raster Image: Rectangular grid of pixels. Rasterization: Conversion of a primitive s geometric representation into A set of pixels. An intensity or color for each

More information

Realtime 3D Computer Graphics Virtual Reality

Realtime 3D Computer Graphics Virtual Reality Realtime 3D Computer Graphics Virtual Reality From Vertices to Fragments Overview Overall goal recapitulation: Input: World description, e.g., set of vertices and states for objects, attributes, camera,

More information

Matrix Inverse 2 ( 2) 1 = 2 1 2

Matrix Inverse 2 ( 2) 1 = 2 1 2 Name: Matrix Inverse For Scalars, we have what is called a multiplicative identity. This means that if we have a scalar number, call it r, then r multiplied by the multiplicative identity equals r. Without

More information

Precalculus Notes Unit 1 Day 1

Precalculus Notes Unit 1 Day 1 Precalculus Notes Unit Day Rules For Domain: When the domain is not specified, it consists of (all real numbers) for which the corresponding values in the range are also real numbers.. If is in the numerator

More information

Linear Loop Transformations for Locality Enhancement

Linear Loop Transformations for Locality Enhancement Linear Loop Transformations for Locality Enhancement 1 Story so far Cache performance can be improved by tiling and permutation Permutation of perfectly nested loop can be modeled as a linear transformation

More information

Divide and Conquer. Algorithm Fall Semester

Divide and Conquer. Algorithm Fall Semester Divide and Conquer Algorithm 2014 Fall Semester Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances

More information

CHAPTER 2 REVIEW COORDINATE GEOMETRY MATH Warm-Up: See Solved Homework questions. 2.2 Cartesian coordinate system

CHAPTER 2 REVIEW COORDINATE GEOMETRY MATH Warm-Up: See Solved Homework questions. 2.2 Cartesian coordinate system CHAPTER 2 REVIEW COORDINATE GEOMETRY MATH6 2.1 Warm-Up: See Solved Homework questions 2.2 Cartesian coordinate system Coordinate axes: Two perpendicular lines that intersect at the origin O on each line.

More information

A Bintree Representation of Generalized Binary. Digital Images

A Bintree Representation of Generalized Binary. Digital Images A intree Representation of Generalized inary Digital mages Hanspeter ieri gor Metz 1 inary Digital mages and Hyperimages A d-dimensional binary digital image can most easily be modelled by a d-dimensional

More information

EFFICIENT INTEGER ALGORITHMS FOR THE GENERATION OF CONIC SECTIONS

EFFICIENT INTEGER ALGORITHMS FOR THE GENERATION OF CONIC SECTIONS Comput. & Graphics, Vol. 22, No. 5, pp. 621±628, 1998 # 1998 Elsevier Science Ltd. All rights reserved PII: S0097-8493(98)00069-7 Printed in Great Britain 0097-8493/98/$ - see front matter EFFICIENT INTEGER

More information

UNIT 2 GRAPHIC PRIMITIVES

UNIT 2 GRAPHIC PRIMITIVES UNIT 2 GRAPHIC PRIMITIVES Structure Page Nos. 2.1 Introduction 46 2.2 Objectives 46 2.3 Points and Lines 46 2.4 Line Generation Algorithms 48 2.4.1 DDA Algorithm 49 2.4.2 Bresenhams Line Generation Algorithm

More information

Recursion. What is Recursion? Simple Example. Repeatedly Reduce the Problem Into Smaller Problems to Solve the Big Problem

Recursion. What is Recursion? Simple Example. Repeatedly Reduce the Problem Into Smaller Problems to Solve the Big Problem Recursion Repeatedly Reduce the Problem Into Smaller Problems to Solve the Big Problem What is Recursion? A problem is decomposed into smaller sub-problems, one or more of which are simpler versions of

More information

Lecture 5. If, as shown in figure, we form a right triangle With P1 and P2 as vertices, then length of the horizontal

Lecture 5. If, as shown in figure, we form a right triangle With P1 and P2 as vertices, then length of the horizontal Distance; Circles; Equations of the form Lecture 5 y = ax + bx + c In this lecture we shall derive a formula for the distance between two points in a coordinate plane, and we shall use that formula to

More information

Matrix Multiplication and All Pairs Shortest Paths (2002; Zwick)

Matrix Multiplication and All Pairs Shortest Paths (2002; Zwick) Matrix Multiplication and All Pairs Shortest Paths (2002; Zwick) Tadao Takaoka, University of Canterbury www.cosc.canterbury.ac.nz/tad.takaoka INDEX TERMS: all pairs shortest path problem, matrix multiplication,

More information

(Refer Slide Time: 00:02:00)

(Refer Slide Time: 00:02:00) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 18 Polyfill - Scan Conversion of a Polygon Today we will discuss the concepts

More information

Program Optimization. Jo, Heeseung

Program Optimization. Jo, Heeseung Program Optimization Jo, Heeseung Today Overview Generally Useful Optimizations Code motion/precomputation Strength reduction Sharing of common subexpressions Removing unnecessary procedure calls Optimization

More information

You used set notation to denote elements, subsets, and complements. (Lesson 0-1)

You used set notation to denote elements, subsets, and complements. (Lesson 0-1) You used set notation to denote elements, subsets, and complements. (Lesson 0-1) Describe subsets of real numbers. Identify and evaluate functions and state their domains. set-builder notation interval

More information

MA 511: Computer Programming Lecture 3: Partha Sarathi Mandal

MA 511: Computer Programming Lecture 3: Partha Sarathi Mandal MA 511: Computer Programming Lecture 3: http://www.iitg.ernet.in/psm/indexing_ma511/y10/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2010-11 Last

More information

End Behavior and Symmetry

End Behavior and Symmetry Algebra 2 Interval Notation Name: Date: Block: X Characteristics of Polynomial Functions Lesson Opener: Graph the function using transformations then identify key characteristics listed below. 1. y x 2

More information

Principles of Computer Game Design and Implementation. Lecture 6

Principles of Computer Game Design and Implementation. Lecture 6 Principles of Computer Game Design and Implementation Lecture 6 We already knew Game history game design information Game engine 2 What s Next Mathematical concepts (lecture 6-10) Collision detection and

More information

Problem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3?

Problem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3? Multiple-choice Problems: Problem 1. Which of the following is true of functions =100+log and =+log? a) = b) =Ω c) =Θ d) All of the above e) None of the above Problem 2. Which of the following is true

More information

Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections.

Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections. Image Interpolation 48 Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections. Fundamentally, interpolation is the process of using known

More information

AH Matrices.notebook November 28, 2016

AH Matrices.notebook November 28, 2016 Matrices Numbers are put into arrays to help with multiplication, division etc. A Matrix (matrices pl.) is a rectangular array of numbers arranged in rows and columns. Matrices If there are m rows and

More information

Dynamic Programming Algorithms

Dynamic Programming Algorithms CSC 364S Notes University of Toronto, Fall 2003 Dynamic Programming Algorithms The setting is as follows. We wish to find a solution to a given problem which optimizes some quantity Q of interest; for

More information

Dense Matrix Algorithms

Dense Matrix Algorithms Dense Matrix Algorithms Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text Introduction to Parallel Computing, Addison Wesley, 2003. Topic Overview Matrix-Vector Multiplication

More information

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines COMP30019 Graphics and Interaction Scan Converting Polygons and Lines Department of Computer Science and Software Engineering The Lecture outline Introduction Scan conversion Scan-line algorithm Edge coherence

More information

Performance of PGA (Programmable Graph Architecture) for Matrix Multiplications

Performance of PGA (Programmable Graph Architecture) for Matrix Multiplications Performance of PGA (Programmable Graph Architecture) for Matrix Multiplications Muling Peng, Sreekanth Ramani, K. Wendy Tang Department of Electrical and Computer Engineering State University of Y at Stony

More information

6.189 IAP Lecture 11. Parallelizing Compilers. Prof. Saman Amarasinghe, MIT IAP 2007 MIT

6.189 IAP Lecture 11. Parallelizing Compilers. Prof. Saman Amarasinghe, MIT IAP 2007 MIT 6.189 IAP 2007 Lecture 11 Parallelizing Compilers 1 6.189 IAP 2007 MIT Outline Parallel Execution Parallelizing Compilers Dependence Analysis Increasing Parallelization Opportunities Generation of Parallel

More information

Stage 4 Help Sheet. S4/2 Round to nearest 10, 100, 1000, S4/1 Count in multiples Now you must learn these multiples. S4/3 Negative numbers

Stage 4 Help Sheet. S4/2 Round to nearest 10, 100, 1000, S4/1 Count in multiples Now you must learn these multiples. S4/3 Negative numbers thousands hundreds tens thousands hundreds tens thousands hundreds tens Stage Help Sheet S/ Count in multiples Now you must learn these multiples Multiples of 6 Multiples of 7 Multiples of 9 Multiples

More information

Computer Graphics. - Rasterization - Philipp Slusallek

Computer Graphics. - Rasterization - Philipp Slusallek Computer Graphics - Rasterization - Philipp Slusallek Rasterization Definition Given some geometry (point, 2D line, circle, triangle, polygon, ), specify which pixels of a raster display each primitive

More information

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics Announcements Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class 1 Scan Conversion Overview of Rendering Scan Conversion Drawing Lines Drawing Polygons

More information

(Refer Slide Time: 00:03:51)

(Refer Slide Time: 00:03:51) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 17 Scan Converting Lines, Circles and Ellipses Hello and welcome everybody

More information

On Your Own. ). Another way is to multiply the. ), and the image. Applications. Unit 3 _ _

On Your Own. ). Another way is to multiply the. ), and the image. Applications. Unit 3 _ _ Applications 1 a 90 clockwise rotation matrix: - b As can be seen by the diagram, the image of P is Q and the image of R is P The coordinate of Q can be found by symmetry y R 1 P, Thus, the 45 clockwise

More information

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives. D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,

More information

Space Filling Curves and Hierarchical Basis. Klaus Speer

Space Filling Curves and Hierarchical Basis. Klaus Speer Space Filling Curves and Hierarchical Basis Klaus Speer Abstract Real world phenomena can be best described using differential equations. After linearisation we have to deal with huge linear systems of

More information

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k Idea 1 m 0 candidates last pixel Note that line could have passed through any part of this pixel Decision variable: d = x(a-b) d is an integer d < 0 use upper pixel d > 0 use lower pixel Incremental Form

More information

Prewitt, Sobel and Scharr gradient 5x5 convolution matrices

Prewitt, Sobel and Scharr gradient 5x5 convolution matrices Prewitt, Sobel and Scharr gradient x convolution matrices First Draft, February Second Draft, June Guennadi Henry Levkine Email hlevkin at yahoo.com Vancouver, Canada. Abstract. Prewitt, Sobel and Scharr

More information

Control flow graphs and loop optimizations. Thursday, October 24, 13

Control flow graphs and loop optimizations. Thursday, October 24, 13 Control flow graphs and loop optimizations Agenda Building control flow graphs Low level loop optimizations Code motion Strength reduction Unrolling High level loop optimizations Loop fusion Loop interchange

More information

Algebraic method for Shortest Paths problems

Algebraic method for Shortest Paths problems Lecture 1 (06.03.2013) Author: Jaros law B lasiok Algebraic method for Shortest Paths problems 1 Introduction In the following lecture we will see algebraic algorithms for various shortest-paths problems.

More information

Multi-Operand Addition Ivor Page 1

Multi-Operand Addition Ivor Page 1 Multi-Operand Addition 1 Multi-Operand Addition Ivor Page 1 9.1 Motivation The motivation for multi-operand adders comes from the need for innerproduct calculations and multiplication (summing the partial

More information

POLYNOMIALS Graphing Polynomial Functions Common Core Standard

POLYNOMIALS Graphing Polynomial Functions Common Core Standard K Polynomials, Lesson 6, Graphing Polynomial Functions (r. 2018) POLYNOMIALS Graphing Polynomial Functions Common Core Standard Next Generation Standard F-BF.3 Identify the effect on the graph of replacing

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS LECTURE 14 RASTERIZATION 1 Lecture Overview Review of last class Line Scan conversion Polygon Scan conversion Antialiasing 2 Rasterization The raster display is a matrix of picture

More information

PROGRAMS. EXCELLENT ACADEMY OF ENGINEERING. Telephone: / NORMAL PROGRAM

PROGRAMS. EXCELLENT ACADEMY OF ENGINEERING. Telephone: / NORMAL PROGRAM PROGRAMS NORMAL PROGRAM 1. Wap to display months in words where month in number is input. 2. Wap to print Fibonacci series till n elements. 3. Wap to reverse 4 digit numbers. 4. Wap to accept a number

More information

9. Visible-Surface Detection Methods

9. Visible-Surface Detection Methods 9. Visible-Surface Detection Methods More information about Modelling and Perspective Viewing: Before going to visible surface detection, we first review and discuss the followings: 1. Modelling Transformation:

More information

Digital Differential Analyzer Bresenhams Line Drawing Algorithm

Digital Differential Analyzer Bresenhams Line Drawing Algorithm Bresenham s Line Generation The Bresenham algorithm is another incremental scan conversion algorithm. The big advantage of this algorithm is that, it uses only integer calculations. Difference Between

More information

CSE 417 Dynamic Programming (pt 4) Sub-problems on Trees

CSE 417 Dynamic Programming (pt 4) Sub-problems on Trees CSE 417 Dynamic Programming (pt 4) Sub-problems on Trees Reminders > HW4 is due today > HW5 will be posted shortly Dynamic Programming Review > Apply the steps... 1. Describe solution in terms of solution

More information

Scan Conversion. Lines and Circles

Scan Conversion. Lines and Circles Scan Conversion Lines and Circles (Chapter 3 in Foley & Van Dam) 2D Line Implicit representation: αx + βy + γ = 0 Explicit representation: y y = mx+ B m= x Parametric representation: x P= y P = t y P +

More information

Locating Restricted Facilities on Binary Maps

Locating Restricted Facilities on Binary Maps Locating Restricted Facilities on Binary Maps Mugurel Ionut Andreica, Politehnica University of Bucharest, mugurel.andreica@cs.pub.ro Cristina Teodora Andreica, Commercial Academy Satu Mare Madalina Ecaterina

More information

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014 CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014 TA: Josh Bradley 1 Linear Algebra Review 1.1 Vector Multiplication Suppose we have a vector a = [ x a y a ] T z a. Then for some

More information

Systems of Inequalities and Linear Programming 5.7 Properties of Matrices 5.8 Matrix Inverses

Systems of Inequalities and Linear Programming 5.7 Properties of Matrices 5.8 Matrix Inverses 5 5 Systems and Matrices Systems and Matrices 5.6 Systems of Inequalities and Linear Programming 5.7 Properties of Matrices 5.8 Matrix Inverses Sections 5.6 5.8 2008 Pearson Addison-Wesley. All rights

More information

CS 534: Computer Vision Segmentation and Perceptual Grouping

CS 534: Computer Vision Segmentation and Perceptual Grouping CS 534: Computer Vision Segmentation and Perceptual Grouping Ahmed Elgammal Dept of Computer Science CS 534 Segmentation - 1 Outlines Mid-level vision What is segmentation Perceptual Grouping Segmentation

More information

A Summary of Projective Geometry

A Summary of Projective Geometry A Summary of Projective Geometry Copyright 22 Acuity Technologies Inc. In the last years a unified approach to creating D models from multiple images has been developed by Beardsley[],Hartley[4,5,9],Torr[,6]

More information

Chapter Introduction

Chapter Introduction Chapter 4.1 Introduction After reading this chapter, you should be able to 1. define what a matrix is. 2. identify special types of matrices, and 3. identify when two matrices are equal. What does a matrix

More information

Lecture 15: Caches and Optimization Computer Architecture and Systems Programming ( )

Lecture 15: Caches and Optimization Computer Architecture and Systems Programming ( ) Systems Group Department of Computer Science ETH Zürich Lecture 15: Caches and Optimization Computer Architecture and Systems Programming (252-0061-00) Timothy Roscoe Herbstsemester 2012 Last time Program

More information

Cache Memories. Lecture, Oct. 30, Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition

Cache Memories. Lecture, Oct. 30, Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition Cache Memories Lecture, Oct. 30, 2018 1 General Cache Concept Cache 84 9 14 10 3 Smaller, faster, more expensive memory caches a subset of the blocks 10 4 Data is copied in block-sized transfer units Memory

More information

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care? Where does a picture come from? Rasterization and Graphics Hardware CS559 Course Notes Not for Projection November 2007, Mike Gleicher Result: image (raster) Input 2D/3D model of the world Rendering term

More information

Bulgarian Math Olympiads with a Challenge Twist

Bulgarian Math Olympiads with a Challenge Twist Bulgarian Math Olympiads with a Challenge Twist by Zvezdelina Stankova Berkeley Math Circle Beginners Group September 0, 03 Tasks throughout this session. Harder versions of problems from last time appear

More information

Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1

Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1 Polygon Filling 2 parts to task which pixels to fill what to fill them with First consider filling unclipped primitives with solid color Which pixels to fill consider scan lines that intersect primitive

More information

CPSC 4040/6040 Computer Graphics Images. Joshua Levine

CPSC 4040/6040 Computer Graphics Images. Joshua Levine CPSC 4040/6040 Computer Graphics Images Joshua Levine levinej@clemson.edu Lecture 19 Projective Warping and Bilinear Warping Nov. 3, 2015 Agenda EC Quiz Review PA06 out Refresher from Lec18 https://en.wikipedia.org/wiki/affine_transformation

More information

DISTANCE FORMULA: to find length or distance =( ) +( )

DISTANCE FORMULA: to find length or distance =( ) +( ) MATHEMATICS ANALYTICAL GEOMETRY DISTANCE FORMULA: to find length or distance =( ) +( ) A. TRIANGLES: Distance formula is used to show PERIMETER: sum of all the sides Scalene triangle: 3 unequal sides Isosceles

More information

Catalan Numbers. Table 1: Balanced Parentheses

Catalan Numbers. Table 1: Balanced Parentheses Catalan Numbers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 00 We begin with a set of problems that will be shown to be completely equivalent. The solution to each problem

More information

Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM

Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM 1 Instructions Labs may be done in groups of 2 or 3 (i.e., not alone). You may use any programming language you wish but MATLAB is highly suggested.

More information

Intermediate Mathematics League of Eastern Massachusetts

Intermediate Mathematics League of Eastern Massachusetts Meet # January 010 Intermediate Mathematics League of Eastern Massachusetts Meet # January 010 Category 1 - Mystery Meet #, January 010 1. Of all the number pairs whose sum equals their product, what is

More information

CS1 Lecture 22 Mar. 6, 2019

CS1 Lecture 22 Mar. 6, 2019 CS1 Lecture 22 Mar. 6, 2019 HW 5 due Friday Questions? In discussion exams next week Last time Ch 12. Zip, lambda, etc Default/keyword function parameters Ch 19 conditional expresssions, list comprehensions

More information

Null space basis: mxz. zxz I

Null space basis: mxz. zxz I Loop Transformations Linear Locality Enhancement for ache performance can be improved by tiling and permutation Permutation of perfectly nested loop can be modeled as a matrix of the loop nest. dependence

More information

Stage 4 PROMPT sheet. 4/2 Round to nearest 10, 100, 1000, 4/1 Count in multiples Now you must learn these multiples. 4/3 Negative numbers

Stage 4 PROMPT sheet. 4/2 Round to nearest 10, 100, 1000, 4/1 Count in multiples Now you must learn these multiples. 4/3 Negative numbers Stage PROMPT sheet / Count in multiples Now you must learn these multiples Multiples of 6 Multiples of 7 Multiples of 9 Multiples of 6 7 9 0 7 7 6 00 0 6 0 9 6 7 6 7 00 6 60 70 90 0 / Round to nearest

More information

CS 325 Computer Graphics

CS 325 Computer Graphics CS 325 Computer Graphics 02 / 06 / 2012 Instructor: Michael Eckmann Today s Topics Questions? Comments? Antialiasing Polygons Interior points Fill areas tiling halftoning dithering Antialiasing Aliasing

More information

Solutions for Operations Research Final Exam

Solutions for Operations Research Final Exam Solutions for Operations Research Final Exam. (a) The buffer stock is B = i a i = a + a + a + a + a + a 6 + a 7 = + + + + + + =. And the transportation tableau corresponding to the transshipment problem

More information

Monday, 12 November 12. Matrices

Monday, 12 November 12. Matrices Matrices Matrices Matrices are convenient way of storing multiple quantities or functions They are stored in a table like structure where each element will contain a numeric value that can be the result

More information

Visible Surface Detection Methods

Visible Surface Detection Methods Visible urface Detection Methods Visible-urface Detection identifying visible parts of a scene (also hidden- elimination) type of algorithm depends on: complexity of scene type of objects available equipment

More information

A semi-separable approach to a tridiagonal hierarchy of matrices with application to image flow analysis

A semi-separable approach to a tridiagonal hierarchy of matrices with application to image flow analysis A semi-separable approach to a tridiagonal hierarchy of matrices with application to image flow analysis Patric Dewilde Klaus Diepold Walter Bamberger Abstract Image flow analysis (e.g. as derived by Horn

More information

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001 Computer graphics Assignment 5 1 Overview Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001 In this assignment you will implement the camera and several primitive objects for a ray tracer. We

More information

Section 8.3 Vector, Parametric, and Symmetric Equations of a Line in

Section 8.3 Vector, Parametric, and Symmetric Equations of a Line in Section 8.3 Vector, Parametric, and Symmetric Equations of a Line in R 3 In Section 8.1, we discussed vector and parametric equations of a line in. In this section, we will continue our discussion, but,

More information

Fast Algorithms for Octagon Abstract Domain

Fast Algorithms for Octagon Abstract Domain Research Collection Master Thesis Fast Algorithms for Octagon Abstract Domain Author(s): Singh, Gagandeep Publication Date: 2014 Permanent Link: https://doi.org/10.3929/ethz-a-010154448 Rights / License:

More information

Edge and local feature detection - 2. Importance of edge detection in computer vision

Edge and local feature detection - 2. Importance of edge detection in computer vision Edge and local feature detection Gradient based edge detection Edge detection by function fitting Second derivative edge detectors Edge linking and the construction of the chain graph Edge and local feature

More information

Chapter 8: Implementation- Clipping and Rasterization

Chapter 8: Implementation- Clipping and Rasterization Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or

More information

2D and 3D Transformations AUI Course Denbigh Starkey

2D and 3D Transformations AUI Course Denbigh Starkey 2D and 3D Transformations AUI Course Denbigh Starkey. Introduction 2 2. 2D transformations using Cartesian coordinates 3 2. Translation 3 2.2 Rotation 4 2.3 Scaling 6 3. Introduction to homogeneous coordinates

More information

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York 11794-2424 Tel: (631)632-845; Fax: (631)632-8334 qin@cs.stonybrook.edu

More information

1 Definition of Reduction

1 Definition of Reduction 1 Definition of Reduction Problem A is reducible, or more technically Turing reducible, to problem B, denoted A B if there a main program M to solve problem A that lacks only a procedure to solve problem

More information

Werner Purgathofer

Werner Purgathofer Einführung in Visual Computing 186.822 Visible Surface Detection Werner Purgathofer Visibility in the Rendering Pipeline scene objects in object space object capture/creation ti modeling viewing projection

More information

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms Visible Surface Determination Visibility Culling Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms Divide-and-conquer strategy:

More information

On The Computational Cost of FFT-Based Linear Convolutions. David H. Bailey 07 June 1996 Ref: Not published

On The Computational Cost of FFT-Based Linear Convolutions. David H. Bailey 07 June 1996 Ref: Not published On The Computational Cost of FFT-Based Linear Convolutions David H. Bailey 07 June 1996 Ref: Not published Abstract The linear convolution of two n-long sequences x and y is commonly performed by extending

More information

California Standard Study Island Topic Common Core Standard

California Standard Study Island Topic Common Core Standard State: CA Subject: Math Grade Level: 4 California Standard Study Island Topic Standard NUMBER SENSE 1.0: Students understand the place value of whole numbers and decimals to two decimal places and how

More information

Extraction of Level Sets from 2D Images

Extraction of Level Sets from 2D Images Extraction of Level Sets from 2D Images David Eberly, Geometric Tools, Redmond WA 98052 https://www.geometrictools.com/ This work is licensed under the Creative Commons Attribution 4.0 International License.

More information