CS552: Computer Graphics Lecture 16: Polygon Filling.

Slides:



Advertisements
Similar presentations
Polygon Scan Conversion – 11b
Advertisements

Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 7 Scanline algorithm and polygon clipping Taku Komura.
Computer Graphics 4: Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling By:Kanwarjeet Singh.
CHAPTER 3 2D GRAPHICS ALGORITHMS
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
College of Computer and Information Science, Northeastern UniversityApril 17, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture 9.
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
CPCS 391 Computer Graphics 1 Lecture 5: Polygon Filling
CSCE 441: Computer Graphics Scan Conversion of Polygons
Graphics Programming: Polygon Filling
CS 454 Computer graphics Polygon Filling
CS 4731: Computer Graphics Lecture 22: Raster Graphics Part 3 Emmanuel Agu.
Rasterization Foley, Ch: 3. Pixels are represented as disjoint circles centered on uniform grid Each (x,y) of the grid has a pixel Y X (1,1) (1,2) (0,0)
TOPIC 4 PART III FILL AREA PRIMITIVES POLYGON FILL AREAS CGMB214: Introduction to Computer Graphics.
IT- 601: Computer Graphics Lecture-04 Scan Conversion Jesmin Akhter Lecturer,IIT Jahangirnagar University, Savar, Dhaka,Bangladesh 9/3/2015.
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
1/24/20061 Fill-Area Algorithms and Functions. 1/24/20062 Learning Objectives OpenGL state variables Color and gray scale Color functions Point attributes.
Polygon Scan Conversion and Z-Buffering
1 CS 430/536 Computer Graphics I Circle Drawing and Clipping Week 3, Lecture 6 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent.
3/4/04© University of Wisconsin, CS559 Spring 2004 Last Time Clipping Lines –Cohen-Sutherland: The use of outcodes and early reject/accept tests –Liang-Barsky:
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
1 CS 430/536 Computer Graphics I Polygon Clipping and Filling Week 3, Lecture 5 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent.
Computer Graphics using OpenGL, 3 rd Edition F. S. Hill, Jr. and S. Kelley Chapter 9.4 – 9.7 Tools for Raster Displays S. M. Lea University of North Carolina.
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
CAP4730: Computational Structures in Computer Graphics
10/15/02 (c) 2002 University of Wisconsin, CS559 Who Am I? Prof Stephen Chenney These notes will be online after the lecture – in fact they’re online already.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner Rasterization.
Computer Graphics Filling. Filling Polygons So we can figure out how to draw lines and circles How do we go about drawing polygons? We use an incremental.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Lecture 15: Raster Graphics and Scan Conversion
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
Lecture 13: Raster Graphics and Scan Conversion
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics CC416 Week 14 Filling Algorithms.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 14.
OUTPUT PRIMITIVES CEng 477 Computer Graphics METU, 2004.
Chapter- 3 & Unit-2 Graphics PRIMITIVES 1. Objectives Introduction to Primitives Points & Lines Line Drawing Algorithms Digital Differential Analyzer.
Graphics PRIMITIVES Chapter- 3 & Unit-2.
Computer Graphics Filling.
Scan Conversion of Polygons
Introduction to Polygons
Computer Graphics CC416 Week 13 Clipping.
CS G140 Graduate Computer Graphics
Polygons.
(c) 2002 University of Wisconsin, CS559
Computer Graphics Filled Area Primitives II Lecture 09 Taqdees A
Lecture 05: Mid-point Ellipse algorithm Dr. Manal Helal – Fall 2014
Fill Area Algorithms Jan
Polygon Filling Algorithms
Mean Shift Segmentation
Computer Vision Lecture 5: Binary Image Processing
Prof. Harriet Fell Spring 2007 Lecture 9 – January 29, 2007
© University of Wisconsin, CS559 Fall 2004
Scan Conversion of Circles
Agenda Polygon Terminology Types of polygons Inside Test
Computer Graphics, KKU. Lecture 7
Prepared by Narendra V G CSE MIT
Agenda Polygon Terminology Types of polygons Inside Test
Prof. Harriet Fell Fall 2011 Lecture 9 – September 26, 2011
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007.
Primitive Drawing Algorithm
Rasterizing Polygons Lecture 29 Wed, Dec 7, 2005.
Primitive Drawing Algorithm
Where We Stand At this point we know how to: Next thing:
Polygons.
Presentation transcript:

CS552: Computer Graphics Lecture 16: Polygon Filling

Recap Midpoint ellipse drawing algorithm Inside-Outside Test Filling rectangle Issues related to polygon filling

Objective After completing this lecture students will be able to Describe different polygon filling algorithm Solve numerical problems

Coherence Example Slope of the edge Change in y coordinates between the two scan lines is ? Given the current x-intercept, the next x-intercept coordinate =

Different situations while scanning Intersection point change by the amount of the slope of the line Edges may start / end Tracking of intersection points is the key o Vertices o Edges Edge table (ET), Active Edge Table (AET)

Scan Line Polygon Filling Algorithm Pixels within the boundary of a polygon belong to the polygon Moving from bottom to top up the polygon Starting at a left edge, fill pixels in spans until a right edge is reached Once we have an intersection o Incrementally compute the next intersection from the current one.

Algorithm

Example (10,10) (10,50) (70,10) (40,20) (40,40)

Filling Ellipse Arcs The Same general strategy works here too Span table

Boundary Fill Algorithm Start at a point inside a region and paint the interior outward toward the boundary. If the boundary is specified in a single color, o the fill algorithm processed outward pixel by pixel  until the boundary color is encountered. Input: the coordinate of the interior point (x, y), a fill color, and a boundary color.

Algorithm 1.Start from an interior point. 2.If the current pixel is not already filled and if it is not an edge point, then 1.Set the pixel with the fill color, 2.Store its neighbouring pixels (4 or 8-connected) in the stack for processing. 3.Store only neighboring pixel that is not already filled and is not an edge point. 3.Select the next pixel from the stack, and continue with step 2.

Boundary Fill Algorithm The order of pixels that should be added to stack using 4-connected above, below, left, and right. 8-connected is above, below, left, right, above-left, above-right, below-left, and below-right.

Start Position Boundary Fill Algorithm 4-connected (Example)

Boundary Fill Algorithm 4-connected (Example)

Boundary Fill Algorithm 4-connected (Example)

Boundary Fill Algorithm 4-connected (Example)

Boundary Fill Algorithm 4-connected (Example)

1 1 Boundary Fill Algorithm 4-connected (Example)

Boundary Fill Algorithm 4-connected (Example)

Start Position Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

1 1 Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm 8-connected (Example)

Boundary Fill Algorithm Considerable stacking of neighboring pixels was required Fill horizontal pixel spans across scan lines Only stack a beginning position for each horizontal pixel spans

Algorithm 1.Starting from the initial interior pixel, then fill in the contiguous span of pixels on this starting scan line. 2. Locate and stack starting positions for spans on the adjacent scan lines, where spans are defined as the contiguous horizontal string of positions bounded by pixels displayed in the area border color. 3. At each subsequent step, unstack the next start position and repeat the process.

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

S Span Flood-Fill Algorithm (example)

Flood Fill Algorithm Fill in (recolor) an area that is not defined within a single color boundary. Replace a specified interior color instead of searching for a boundary color value. This approach is called a flood-fill algorithm.

Flood Fill Algorithm 1.Start from a specified interior pixel (x, y) and reassign all pixel values that are currently set to a given interior color with the desired fill color. 2.If the area has more than one interior color, we can first reassign pixel values so that all interior pixels have the same color. 3.Using either 4-connected or 8-connected approach, we then step through pixel positions until all interior pixels have been repainted.

Thank you Next Lecture: Scan Converting Patterns