11 views

Uploaded by Vishal Falake

raster

save

- GPU fundamentals
- Include PDF
- Intern Brochure
- Kayla Moffatt Resume
- NON-PROJECTED AV AIDS,
- 4355 ADV Graphic Design Syllabus Spring 2019
- The Cognitive Process Dimensions
- Marketing Info Packet
- SGI-RealityEngine
- Said_pres
- Catalog - Arroway Textures - Stone Volume One (EN).pdf
- Contrast Stretching dengan Java
- Priprema Na Engl
- 2012 SDNA Better Newspapers Contest Advertising Results
- cv_jjv
- The Freiburg Groceries Dataset
- Accordion Book With Pockets
- Photoshop Tutorials Cc
- 148 Midterm Review
- a Novel Approach for Image Enhancement by Using Contrast Limited Adaptive Histogram Equalization Method
- ARUSA
- Ccna Notes
- Line Algorithms
- Line Algorithms
- Line Algorithms
- Java Swing Tutorial
- Java Swing Tutorial
- Java Swing Tutorial
- IBPS CLERK NOTIFICATION 2013
- IBPS CLERK NOTIFICATION 2013
- Complexity Space n Time
- ATM_1
- use cases
- ba
- Ccna Notes
- MCS-043
- Advanced Bash Shell Scripting Guide (Linux)
- 11 Basic Shell Programs Enough for IGNOU Exams Observe Syntax
- Chen_rpt
- Poster
- IMAGE ACQUISITION AND ENHANCEMENT
- 2013_9_9_3659_3666
- s2010 Physically Based Shading Hoffman b
- 09-Segmentacion
- video object extraction
- HW3 Image Processing
- CCL
- Bay Surf Cviu
- Raspberry Pi Augmentation: A Cost Effective Solution To Google Glass
- Unwrap UVW
- Noise Models in Image processing
- Guía Con Medidas y Especificaciones Para Imágenes y Vídeos en Redes Sociales
- fourier.m
- Automatic 3D View Generation From a Single 2D Image for Both Indoor and Outdoor Scenes
- 19761
- caso-citrosol[2050].pdf
- OpenCV By Example - Sample Chapter
- Brisk
- Robust Single-Image Super-Resolution Based on Adaptive Edge-Preserving Smoothing Regularization
- When Customising Your Own Twitter Profile
- Expresion grafica.pptx
- An Approach to Medical Image Classification Using Neuro Fuzzy Logic and ANFIS Classifier
- 3D Morphable Model
- ACM Sistema de Clasificación
- Computer Graphics 3D Display Methods
- UpdateOnFeatures_StefanHaller
- Adaptive Histogram Equalization is a Computer Image Processing Technique Used to Improve Contrast
- Shaders in Unity3D

You are on page 1of 25

2D Graphics Pipeline

Clipping Object World Coordinates Applying world window Object subset window to viewport mapping

**Simple 2D Drawing Pipeline
**

Object Screen coordinates

Display

Rasterization

y coordinates determine pixel colors to draw line Two ways to create an image: n n Scan existing photograph Procedurally compute values (rendering) Rasterization Viewport Transformation .Rasterization (Scan Conversion) n n n Convert high-level geometry description to pixel colors in the frame buffer Example: given vertex x.

etc. textures. illuminations.Rasterization A fundamental computer graphics function Determine the pixels’ colors. Implemented by graphics hardware Rasterization algorithms n n n n n n n n Lines Circles Triangles Polygons .

rotating.Rasterization Operations n n n n Drawing lines on the screen Manipulating pixel maps (pixmaps): copying. etc n Aliasing and antialiasing methods . etc Compositing images. defining and modifying regions Drawing and filling polygons n Previously glBegin(GL_POLYGON). scaling.

20. 21) Rounded pixel value is off actual line path (jaggy!!) Sloped lines end up having jaggies Vertical.51) rounded to (10. E.Line drawing algorithm n n n n n n n n Programmer specifies (x. horizontal lines.g.48.y) values constrained to integer values Actual computed intermediate line values may be floats Rounding may be required. computed point (10.y) values of end pixels Need algorithm to figure out which intermediate pixels are on line path Pixel (x. no jaggies .

6) ? Which intermediate pixels to turn on? 0 1 2 3 4 5 6 7 8 9 10 11 12 .2) -> (9.Line Drawing Algorithm 8 7 6 5 4 3 2 1 Line: (3.

(x1. how to compute m and b? dy y1 − y 0 m= = dx x1 − x0 (x1.y0) dx .y1) dy b = y 0 − m * x0 (x0.Line Drawing Algorithm n Slope-intercept line equation n n y = mx + b Given two end points (x0.y0). y1).

5392 Bx − Ax 125 − 23 102 . Ay) = (23.Line Drawing Algorithm n n Numerical example of finding slope m: (Ax. 41). 96) By − Ay 96 − 41 55 m= = = = 0. (Bx. By) = (125.

starting at (x0. compute and round y §Case b: y is incrementing faster (m > 1) §Step in y=1 increments.Digital Differential Analyzer (DDA): Line Drawing Algorithm §Walk through the line.y1) dy m=1 m<1 (x0. y increments to values in [0.1] range §Case a: x is incrementing faster (m < 1) §Step in x=1 increments.y0) §Constrain x.y0) dx . compute and round x m>1 (x1.

round(y)) … Until x == x1 (x0. round(y)) x = x0 + 1 y = y0 + 1 * m Illuminate pixel (x. round(y)) x=x+1 y=y+1*m Illuminate pixel (x. y0) .y1) x = x0 y = y0 Illuminate pixel (x.DDA Line Drawing Algorithm (Case a: m < 1) y k +1 = y k + m (x1.

y1) y = y0 Illuminate pixel (round(x).DDA Line Drawing Algorithm (Case b: m > 1) x k +1 1 = xk + m x = x0 (x1.y0) Until y == y1 . y) y = y0 + 1 x = x0 + 1 * 1/m Illuminate pixel (round(x). y) … (x0. y) y=y+1 x = x + 1 /m Illuminate pixel (round(x).

y). // initial value for(int y = y0.DDA Line Drawing Algorithm Pseudocode compute m.y <= y1. } else // m > 1 { float x = x0. y) writes current color into pixel in column x and row y in frame buffer . } n Note: setPixel(x. x++. y++. // initial value for(int x = x0. x += 1/m) setPixel(round(x). if m < 1: { float y = y0. y += m) setPixel(x.x <= x1. round(y)).

4.g.Line Drawing Algorithm Drawbacks DDA is the simplest line drawing algorithm n n n Not very efficient Round operation is expensive Integer DDA E.Bresenham algorithm (Hill. n n n Bresenham algorithm n n n . 10.1) Incremental algorithm: current value uses previous value Integers only: avoid floating point arithmetic Several versions of algorithm: we’ll describe midpoint version of algorithm n Optimized algorithms typically used.

want to determine best sequence of intervening pixels First make two simplifying assumptions (remove later): n n (Ax < Bx) and (0 < m < 1) Width W = Bx – Ax Height H = By . Ay) and (Bx.Ay) . By) of a line.Bresenham’s Line-Drawing Algorithm n n Problem: Given endpoints (Ax.Ay (Bx.By) n Define n n (Ax.

Bresenham’s Line-Drawing Algorithm n Based on assumptions: n n W. H are +ve H<W n n n As x steps in +1 increments. y incr/decr by <= +/–1 y value sometimes stays same. sometimes increases by 1 Midpoint algorithm determines which happens .

y stays same If midpoint is below line. y0) .y1) What Pixels to turn on or off? Consider pixel midpoint M(Mx. y increases + 1 … (x0. Y0 + ½) Build equation of line through and compare to midpoint M(Mx. My) M = (x0 + 1.My) If midpoint is above line.Bresenham’s Line-Drawing Algorithm (x1.

Ay) H(x – Ax) = W(y – Ay) -W(y – Ay) + H(x – Ax) = 0 Above is ideal equation of line through (Ax. Ay) and (Bx.y) = -2W(y – Ay) + 2H(x – Ax) . and give it a name.By) (x. any point (x. By) Thus.Bresenham’s Line-Drawing Algorithm n Using similar triangles: (Bx.y) that lies on ideal line makes eqn = 0 Double expression (to avoid floats later).y) y − Ay H = x − Ax W n n n n n (Ax. F(x.

y) = 0 is on line Increase y keeping x constant. y) above line F(x. (x. F(x. y) below line n n Hint: F(x. y) > 0. If: n n n n F(x. y) becomes more negative . F(x. y) < 0. (x.Bresenham’s Line-Drawing Algorithm So.y) = -2W(y – Ay) + 2H(x – Ax) Algorithm.

(7. 29/3). 4) lies below line since F = 44 B = (5. 11) F(x. 7) and (9.Bresenham’s Line-Drawing Algorithm Example: to find line segment between (3.g. 9) lies above line since F = -8 .y) = -2W(y – Ay) + 2H(x – Ax) = (-12)(y – 7) + (8)(x – 3) n n n n For points on line. y) = 0 A = (4. E. F(x.

y0) .y1) What Pixels to turn on or off? Consider pixel midpoint M(Mx.My) If F(Mx. Y0 + ½) If F(Mx. shade lower pixel (same y as before) M(Mx. M lies below line. M lies above line. My) M = (x0 + 1. shade upper pixel … (x0.Bresenham’s Line-Drawing Algorithm (x1.My) < 0.My) > 0.

My) -= 2(W – H) . My) += 2H If we increment x +1. midpoint M = (Ax + 1. y + 1 F(Mx.Can compute F(x.y) incrementally Initially. Ay + ½) F(Mx. My) = -2W(y – Ay) + 2H(x – Ax) = 2H – W Can compute F(x. compute new F(Mx.y) for next midpoint incrementally If we increment x + 1. y stays same.My) F(Mx.

// current error term for(int x = a.x. else{ Y++. InPoint b) { // restriction: a.x – a.y. x++) { setpixel at (x.x.Bresenham’s Line-Drawing Algorithm Bresenham(IntPoint a. x <= b. H = b.y – a. F = F + 2(H – W) } } } n Recall: F is equation of line . y).y. int F = 2 * H – W.x and 0 < H/W < 1 int y = a.x.x < b. // to desired color value if F < 0 F = F + 2H. W = b.

4.Bresenham’s Line-Drawing Algorithm Final words: we developed algorithm with restrictions 0 < m < 1 and Ax < Bx Can add code to remove restrictions n n n n n n To get the same line when Ax > Bx (swap and draw) Lines having m > 1 (interchange x with y) Lines with m < 0 (step x++.x = b.x and skip tests) n Important: Read Hill 9. decrement y not incr) Horizontal and vertical lines (pretest a.1 .

References n Hill. chapter 9 .

- GPU fundamentalsUploaded byi_luxi
- Include PDFUploaded byjimusos
- Intern BrochureUploaded byCourier Journal
- Kayla Moffatt ResumeUploaded bykmoffatt125
- NON-PROJECTED AV AIDS,Uploaded byshyamdas005
- 4355 ADV Graphic Design Syllabus Spring 2019Uploaded byJesus De La Rosa
- The Cognitive Process DimensionsUploaded byLeoncio Lumaban
- Marketing Info PacketUploaded bycbwailea
- SGI-RealityEngineUploaded bybugmenomore
- Said_presUploaded byFreddy Forero Longas
- Catalog - Arroway Textures - Stone Volume One (EN).pdfUploaded byKopopo90
- Contrast Stretching dengan JavaUploaded byTomi Hartanto
- Priprema Na EnglUploaded bydinkyny
- 2012 SDNA Better Newspapers Contest Advertising ResultsUploaded byDavid Bordewyk
- cv_jjvUploaded byTrung Manh Huynh
- The Freiburg Groceries DatasetUploaded byVivek Bhadouria
- Accordion Book With PocketsUploaded bylorenitag32
- Photoshop Tutorials CcUploaded byFabiana Go
- 148 Midterm ReviewUploaded bydammitpoo113
- a Novel Approach for Image Enhancement by Using Contrast Limited Adaptive Histogram Equalization MethodUploaded byzakifikrii
- ARUSAUploaded byM Tahir Khan

- Ccna NotesUploaded byRajumallepoola
- Line AlgorithmsUploaded byKunal
- Line AlgorithmsUploaded byKunal
- Line AlgorithmsUploaded byKunal
- Java Swing TutorialUploaded byVishal Falake
- Java Swing TutorialUploaded byVishal Falake
- Java Swing TutorialUploaded byVishal Falake
- IBPS CLERK NOTIFICATION 2013Uploaded byscang55
- IBPS CLERK NOTIFICATION 2013Uploaded byscang55
- Complexity Space n TimeUploaded byapi-3814408
- ATM_1Uploaded byDevneet Singh Virdi
- use casesUploaded byVishal Falake
- baUploaded bypuby101
- Ccna NotesUploaded byRajumallepoola
- MCS-043Uploaded byVishal Falake
- Advanced Bash Shell Scripting Guide (Linux)Uploaded bymohammad
- 11 Basic Shell Programs Enough for IGNOU Exams Observe SyntaxUploaded byVishal Falake

- Chen_rptUploaded bynikpik8276
- PosterUploaded byvietbinhdinh
- IMAGE ACQUISITION AND ENHANCEMENTUploaded byWahyu Rahmaniar
- 2013_9_9_3659_3666Uploaded bysindhu bhargavi
- s2010 Physically Based Shading Hoffman bUploaded byTommy Dräger
- 09-SegmentacionUploaded byBrayan Suaza
- video object extractionUploaded byNijo John
- HW3 Image ProcessingUploaded byhamidnasiri1369
- CCLUploaded bydawadhali
- Bay Surf CviuUploaded byKirthi Rk
- Raspberry Pi Augmentation: A Cost Effective Solution To Google GlassUploaded byAnonymous kw8Yrp0R5r
- Unwrap UVWUploaded byQaisar rehman
- Noise Models in Image processingUploaded byChinmay Patil
- Guía Con Medidas y Especificaciones Para Imágenes y Vídeos en Redes SocialesUploaded byClementine Clementine
- fourier.mUploaded byaamontesinosm
- Automatic 3D View Generation From a Single 2D Image for Both Indoor and Outdoor ScenesUploaded byAnonymous lVQ83F8mC
- 19761Uploaded byrambabs369
- caso-citrosol[2050].pdfUploaded byAntonela Porta
- OpenCV By Example - Sample ChapterUploaded byPackt Publishing
- BriskUploaded bycaleksa123
- Robust Single-Image Super-Resolution Based on Adaptive Edge-Preserving Smoothing RegularizationUploaded byLeMenizInfotech
- When Customising Your Own Twitter ProfileUploaded byJoe Tobias
- Expresion grafica.pptxUploaded byPatricia Barahona Roces
- An Approach to Medical Image Classification Using Neuro Fuzzy Logic and ANFIS ClassifierUploaded byseventhsensegroup
- 3D Morphable ModelUploaded byMontúfar JJ
- ACM Sistema de ClasificaciónUploaded byIván Soria Solís
- Computer Graphics 3D Display MethodsUploaded bySyedkareem_hkg
- UpdateOnFeatures_StefanHallerUploaded byAnto Padaunan
- Adaptive Histogram Equalization is a Computer Image Processing Technique Used to Improve ContrastUploaded byViwin Singh
- Shaders in Unity3DUploaded bysigfusjonsson