Professional Documents
Culture Documents
CG Raster
CG Raster
Raster Displays Image Format RGB Color Physics of Color and Color Perception
Advanced topics, will not be on exams
cg-raster.ppt
February 22 March 29
March 6 April 26
February 15 March 15
March 6 April 5
Programming Project 4
Final Exam
1/2/2013 4:42:02 PM
Optional/April 26
May 3
cg-raster.ppt
April 26
May 3
2
1/2/2013 4:42:02 PM
cg-raster.ppt
Display Process
1/2/2013 4:42:02 PM
cg-raster.ppt
1/2/2013 4:42:02 PM
cg-raster.ppt
Transmissive: LCD: Liquid crystal display 1/2/2013 4:42:01 PM Emissive: Light Emitting Diode (LED) cg-raster.ppt
Input Devices
Images can also be generated by input devices
Commonly used ones are cameras and scanners Cameras typically use a Bayer mosaic array
Some use three separate arrays (3CCD cameras)
Scanners use a moving 1-D array of sensors We will not go into details of cameras and scanners beyond what we need for this class.
An Abstract Model of Displays and Input Devices We assume that the pixels are laid out in a rectangular array
It is also called a raster Adopted convention in the textbook
For a display with nx columns and ny rows of pixels, the bottom-left element pixel is (0, 0) and the top-right pixel is (nx-1, ny-1) A pixel is indexed by (x, y), indicating the column and row of the pixel
1/2/2013 4:42:01 PM
cg-raster.ppt
Example
1/2/2013 4:42:01 PM
cg-raster.ppt
Digital Images
Mathematically, an image can be represented by a 2-D matrix
Each entry (i, j) represents the pixel value at the corresponding location The value of a pixel can have different types, depending on the image types
Binary Unsigned char Int Float A vector (Color image, for example)
cg-raster.ppt 10
1/2/2013 4:42:01 PM
Image as a File
Image formats
TIFF GIF JPEG PBM/PPM PNG
1/2/2013 4:42:01 PM
cg-raster.ppt
11
Data
Uncompressed Compressed
1/2/2013 4:42:01 PM
cg-raster.ppt
12
1/2/2013 4:42:00 PM
Image Sequences
There are many different kinds of formats for movie or video sequences
avi mpeg
cg-raster.ppt
17
Visualization of Images
ImageMagick package (installed on linprog)
convert display animate available at http://www.simplesystems.org/ImageMagick/
1/2/2013 4:41:59 PM
cg-raster.ppt
18
RGB Color
In computer graphics colors are commonly represented by redgreen-blue triplet
Called the RGB color space
The range is from zero to one
Zero is fully off One is fully on
cg-raster.ppt
19
True Color
Index Color
1/2/2013 4:41:59 PM
cg-raster.ppt
20
1/2/2013 4:41:59 PM
cg-raster.ppt
21
c c f (1 ) cb
1/2/2013 4:41:59 PM
cg-raster.ppt
22
1/2/2013 4:41:59 PM
cg-raster.ppt
23
1/2/2013 4:41:58 PM
cg-raster.ppt
24
Physics of Graphics
Source emits photons And then some reach the eye/camera.
cg-raster.ppt
25
Physics of Color
Light is electromagnetic radiation
Different colors correspond to radiation of different wavelengths Intensity of each wavelength specified by amplitude We perceive electromagnetic radiation within the 380-800 nm range, the tiny piece of spectrum between infra-red and ultraviolet
1/2/2013 4:41:58 PM
cg-raster.ppt
26
1/2/2013 4:41:58 PM
cg-raster.ppt
27
The Eye
1/2/2013 4:41:58 PM
cg-raster.ppt
28
1/2/2013 4:41:58 PM
cg-raster.ppt
29
Cone Receptors
There are three types of cones, referred to as S, M, and L
They are roughly corresponding to blue, green, and red sensors, respectively Their peak sensitivities are located at approximately 430nm, 560nm, and 610nm for the "average" observer
1/2/2013 4:41:57 PM
cg-raster.ppt
30
1/2/2013 4:41:57 PM
cg-raster.ppt
31
CIE Standard
CIE
International Commission on Illumination Human perception based standard (1931), established using color matching experiment
1/2/2013 4:41:57 PM
cg-raster.ppt
32
CIE Standard
CIE tristimulus values
X 683 x ( ) A( )d Y 683 y ( ) A( )d
380 380 800 800
Z 683 z ( ) A( )d
380
800
1/2/2013 4:41:57 PM
cg-raster.ppt
33
1/2/2013 4:41:57 PM
cg-raster.ppt
34
Color Gamut
The range of color representation of display devices
1/2/2013 4:41:57 PM
cg-raster.ppt
35
RGB (Monitors)
The de facto standard
1/2/2013 4:41:56 PM
cg-raster.ppt
36
CMY(K): Printing
Cyan, Magenta, Yellow (Black) CMY(K) A subtractive color model
dye color absorbs reflects
cyan
magenta yellow black
red
green blue all
1/2/2013 4:41:56 PM
cg-raster.ppt
37
HSV
This color model is based on polar coordinates, not Cartesian coordinates
1/2/2013 4:41:56 PM
cg-raster.ppt
38
1/2/2013 4:41:56 PM
cg-raster.ppt
39
OpenGL Pipeline
1/2/2013 4:41:56 PM
cg-raster.ppt
40
OpenGL Architecture
1/2/2013 4:41:56 PM
cg-raster.ppt
41
OpenGL as a Renderer
Geometric primitives
Points, lines and polygons Image Primitives Images and bitmaps
1/2/2013 4:41:55 PM
cg-raster.ppt
42
Relate APIs
AGL, GLX, WGL
Glue between OpenGL and windowing systems
1/2/2013 4:41:55 PM
cg-raster.ppt
43
1/2/2013 4:41:55 PM
cg-raster.ppt
44
Preliminaries
Header Files #include <GL gl.h> #include <GL glu.h> #include <GL glut.h> Libraries Enumerated types OpenGL defines numerous types for compatibility
GLfloat, GLint, GLenum, etc.
1/2/2013 4:41:55 PM
cg-raster.ppt
45
Makefile
1/2/2013 4:41:55 PM
cg-raster.ppt
46
GLUT Basics
Application Structure Configure and open window Initialize OpenGL state Register input callback functions
render resize input: keyboard, mouse, etc.
1/2/2013 4:41:55 PM
cg-raster.ppt
47
GLUT Framework
1/2/2013 4:41:54 PM
cg-raster.ppt
48
Sample Program
1/2/2013 4:41:54 PM
cg-raster.ppt
49
OpenGL Initialization
Set up whatever state youre going to use
1/2/2013 4:41:54 PM
cg-raster.ppt
50
Register callbacks with GLU glutDisplayFunc(display); glutMouseFunc(mouse); glutKeyboardFunc(ssd_keyboard); glutReshapeFunc(reshape); void glutIdleFunc ( void(*)(void) callback ) void glutTimerFunc ( unsigned int msec, void(*)(int data) callback, int data)
1/2/2013 4:41:54 PM
cg-raster.ppt
51
Rendering Callback
Do all of our drawing here glutDisplayFunc(display);
void display(void) { Render_SSD(&thescene, &vcamera); }
1/2/2013 4:41:54 PM
cg-raster.ppt
52
Idle Callbacks
Use for animation and continuous update
glutIdleFunc( idle ); void idle( void ) {
t += dt; glutPostRedisplay();
1/2/2013 4:41:54 PM
cg-raster.ppt
53
1/2/2013 4:41:53 PM
cg-raster.ppt
54
Elementary Rendering
Geometric Primitives Managing OpenGL State OpenGL Buffers
1/2/2013 4:41:53 PM
cg-raster.ppt
55
1/2/2013 4:41:53 PM
cg-raster.ppt
56
Simple Example
void drawRhombus( GLfloat color[] ) {
glBegin( GL_QUADS );
glColor3fv( color ); glVertex2f( 0.0, 0.0 ); glVertex2f( 1.0, 0.0 ); glVertex2f( 1.5, 1.118 ); glVertex2f( 0.5, 1.118 );
glEnd();
1/2/2013 4:41:53 PM
cg-raster.ppt
57
1/2/2013 4:41:53 PM
cg-raster.ppt
58
glEnd();
1/2/2013 4:41:53 PM
cg-raster.ppt
59
1/2/2013 4:41:52 PM
cg-raster.ppt
60
Controlling Rendering
Appearance
From wireframe to texture mapped
1/2/2013 4:41:52 PM
cg-raster.ppt
61
1/2/2013 4:41:52 PM
cg-raster.ppt
62
1/2/2013 4:41:52 PM
cg-raster.ppt
63
Enabling Features
glEnable( GL_ LIGHTING ); glDisable( GL_TEXTURE_2D );
1/2/2013 4:41:52 PM
cg-raster.ppt
64
Transformations in OpenGL
Modeling Viewing
orient camera projection
1/2/2013 4:41:52 PM
cg-raster.ppt
65
Each step uses transformations Every transformation is equivalent to a change in coordinate systems
1/2/2013 4:41:52 PM
cg-raster.ppt
66
Transformation Pipeline
1/2/2013 4:41:51 PM
cg-raster.ppt
67
glOrtho
For example, glOrtho specifies a transformation matrix
1/2/2013 4:41:51 PM
cg-raster.ppt
68
1/2/2013 4:41:51 PM
cg-raster.ppt
69
Aspect Ratio
1/2/2013 4:41:51 PM
cg-raster.ppt
70
1/2/2013 4:41:47 PM
cg-raster.ppt
71
Summary
Abstractly, we can treat a monitor (a display device) as an image as they are equivalent to us Color and its perception involve complex processes
Physics of light Color perception and manipulation
cg-raster.ppt
72