CS 4731: Computer Graphics Lecture 21: Raster Graphics Part 2 Emmanuel Agu.

Slides:



Advertisements
Similar presentations
Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
Advertisements

CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
Image Processing … computing with and about data, … where "data" includes the values and relative locations of the colors that make up an image.
Computer Graphics Tz-Huan Huang National Taiwan University (Slides are based on Prof. Chen’s)
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Compositing and Blending Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Compositing and Blending - Chapter 8 modified by Ray Wisman Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Buffers Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Buffers Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Sep 21, Fall 2005ITCS4010/ Computer Graphics Overview Color Displays Drawing Pipeline.
Raster Displays Images are composed of arrays of pixels displayed on a raster device. Two main ways to create images: –Scan and digitize an existing image.
Sep 21, Fall 2006IAT 4101 Computer Graphics Overview Color Displays Drawing Pipeline.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphicsIntroduction Dr. Eng. Farag Elnagahy
First Bytes - LabVIEW. Today’s Session Introduction to LabVIEW Colors and computers Lab to create a color picker Lab to manipulate an image Visual ProgrammingImage.
CS 4731: Computer Graphics Lecture 17: Texturing Emmanuel Agu.
OpenGL Pixel Operations, Bitmaps, Fonts and Images The Current Raster Position Current raster position: A position in window coordinates where the next.
V Obtained from a summer workshop in Guildford County July, 2014
Data starts with width and height of image Then an array of pixel values (colors) The number of elements in this array is width times height Colors can.
COMP Bitmapped and Vector Graphics Pages Using Qwizdom.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
 Bitmap: A bitmap is a rectangular array of 0s and 1s that serves as a drawing mask for a corresponding rectangular portion of the window.  Applications:
Tools for Raster Displays CVGLab Goals of the Chapter To describe pixmaps and useful operations on them. To develop tools for copying, scaling, and rotating.
I-1 Steps of Image Generation –Create a model of the objects –Create a model for the illumination of the objects –Create an image (render) the result I.
Chapter 2 Getting Started: Drawing Figures. The Framebuffer Lecture 2 Fri, Aug 29, 2003.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 14 Introduction to Computer Graphics.
Computer Graphics Raster Devices Transformations Areg Sarkissian.
2D Graphics: Rendering Details
2002 by Jim X. Chen: 1 So far, we only concerned with the rendering of geometric data. Two other important classes of data:
Geometric Transformations
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Using the JImageViewer classes. JImageViewer classes JImageViewer class JImageViewer class ImagePanel class ImagePanel class Image class Image class.
Lecture 4 Pixels, Images and Image Files 1. In this Lecture, you will learn the following concepts: Image files (in particular, the BMP file format) How.
Computer Graphics Bitmaps & Sprites CO2409 Computer Graphics Week 3.
Pixels, Images and Image Files 1 By Dr. HANY ELSALAMONY.
Lecture 15: Intro to Graphics Yoni Fridman 7/25/01 7/25/01.
INT 840E Computer graphics Introduction & Graphic’s Architecture.
111/17/ :24 UML Solution Involves Selection of Discrete Representation Values.
Graphics: Conceptual Model Real Object Human Eye Display Device Graphics System Synthetic Model Synthetic Camera Real Light Synthetic Light Source.
12/5/2015 EEC492/693/793 - iPhone Application Development 1 EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 4 Wenbing Zhao
Images. Digital Images Rectangular arrays of pixel data Pixel - picture element, smallest addressable part of the frame buffer. Color depth - the depth.
1 Graphics CSCI 343, Fall 2015 Lecture 5 Color in WebGL.
Fall UI Design and Implementation1 Lecture 6: Output.
UniS CS297 Graphics with Java and OpenGL Blending.
Buffers Computer Graphics I, Fall 2010.
Buffers. 2 Objectives Introduce additional OpenGL buffers Learn to read and write buffers Learn to use blending.
Lecture 13: Raster Graphics and Scan Conversion
Advanced Java Screen Update Techniques SD’98 - Session 4406 Ted Faison Faison Computing Inc.
Computer Graphics I, Fall 2008 Compositing and Blending.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
Computer Graphics Overview
Computer Graphics Lecture 3 Computer Graphics Hardware
Buffers Ed Angel Professor Emeritus of Computer Science
Computer Graphics Raster Devices Transformations
Week 7 - Monday CS361.
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
Basic Graphics Drawing Shapes 1.
Introduction to Computer Graphics with WebGL
Making the Applications Interesting
Geb Thomas Adapted from the OpenGL Programming Guide
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Class 26 more textures environmental textures Color ramps
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Computer Graphics Buffers
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
Buffers Ed Angel Professor Emeritus of Computer Science
Game Programming Algorithms and Techniques
Class 27 more textures environmental textures Color ramps
Presentation transcript:

CS 4731: Computer Graphics Lecture 21: Raster Graphics Part 2 Emmanuel Agu

Manipulating Pixmaps Pixmap = rectangular array of numerical values Pixmap copied to frame buffer = rendered Change frame buffer entry = onscreen picture changes Each pixel location has fixed number of bits (color depth) Example: if color depth is b bits, can store up to 2 b values

Manipulating Pixmaps Operations of interest: Copying pixmaps glReadPixels: frame buffer to off-screen memory glCopyPixels: frame buffer to frame buffer glDrawPixels: pixmap to frame buffer memCopy: off-screen to off-screen Comparing pixmaps Representing and coloring regions in pixmap

Manipulating Pixmaps Data types for pixmaps Bitmap: 1 bit, on or off Gray scale: one byte, values RGB: 3 bytes (red, green, blue) RGBA: 4 byte (red, green, blue, alpha) Declaration of RGB triple: class RGB{ public: unsigned char r, g, b; };

RGBpixmap Class OpenGL convention: pixmap (bottom to top, left to right) Add draw, read and copy methods (which use openGL) Class RGB{ public: unsigned char r, g, b; RGBpixmap( ); // constructor void setPixel(int x, int y, RGB color); RGB getPixel(int x, y); void draw( ){ glDrawPixels(nCols, nRows, GL_RGB, GL_UNSIGNED_BYTE, pixel); void read( ){glReadPixels(x, y, nCols, nRows, GL_RGB, GL_UNSIGNED_BYTE, pixel);

RGBpixmap Class // ….. contd. void copy( ){ glCopyPixels(.. Parameters..); int readBMPFile(char *fname); void writeBMPFile(char *fname); }; Note: refer to Hill fig for full RGBPixmap declaration

Scaling and Rotating Images Scaling: want a pixmap that has s times more pixels in x, y s > 1: enlargement s < 1: reduction (information is lost!) openGL scaling: glPixelZoom(float sx, float sy) Sets scale factors for drawing pixmaps Note: pixmaps not scaled, pictures drawn are scaled Original Pixmap element s > 1s < 1 Original Pixmap element

Scaling and Rotating Images glPixelZoom(float sx, float sy) Sets scale factors for subsequent glDrawPixels command Scaling is about current raster position, pt. Pixel row r and column c of pixmap Drawn as rectangle with bottom left current screen coordinates Draws (pt.x + sx*r, pt.y + sy.c) 90, 180 and 270 degree rotations: Copy one pixmap to another doing matrix transposes General rotations: affine transform of pixmap points to get new pixmap

Combining Pixmaps Two pixmaps A and B combined pixelwise to form third pixel C i.e. C[i][j] = A[i][j]  B[i][j] Averaging: C[i][j] = ½ *(A[i][j] + B[i][j]) Subtraction: C[i][j] = A[i][j] - B[i][j] Generalized weighting: C[i][j] = (1-f).A[i][j] + f.B[i][j]

Combining Pixmaps Generalized weighting: C[i][j] = (1-f).A[i][j] + f.B[i][j] Example: A = (14, 246, 97), B = (82, 12, 190), f = 0.2 C = (27, 199, 115) = 0.8 A B Question: How to dissolve image A into B?

Alpha Channel and Image Blending Even more generalized weighting = blending/compositing Blending: draw partially transparent image over another Add 4 th component, alpha value (A) to RGB Interpretation: alpha specifies how opaque each pixel is Transparent (A = 0), Total opacity (A = 255) Alpha most frequently used in scaling colors class RGB{ public: unsigned char r, g, b,a; };

Alpha Channel and Image Blending Alpha channel: series of alpha values in a pixmap openGL alpha blending: glBlendFunc( ) Other alpha blending applications: Simulating Chromakey: forcing certain colors to be transparent Applying paint with a paintbrush: apply percentage of new color with each mouse stroke

References Hill, chapter 10