CG for Vision Research - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

CG for Vision Research

Description:

Choose lens or adjust lens zoom. Projection. Map to screen coordinate. Choose final print size ... World (Fixed) Camera/Eye. Object ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 33
Provided by: quocv
Category:

less

Transcript and Presenter's Notes

Title: CG for Vision Research


1
CG for Vision Research
  • Lecture 1
  • Winter Term 05-06
  • Quoc Vuong, Franck Caniard, MPI

2
OpenGL Projections Transformations Graphics
Primitives Textures Lighting Material Properties
Vision Research Viewpoint Effect Structure from X
(Motion, Shading, Stereo) Active
Exploration Navigation
GLUT Window Management Input Devices Event
Loop Timing
Fun/Advanced Modeling Animations Mapping (bumps,
terrains) Physics Simulation Sound (OpenAL)
3
Viewing Objects
The Ambassadors, Hans Holbein, 1533
4
Setting the SceneThe Camera Analogy
5
Coordinate Systems
  • Three coordinate systems
  • World (Fixed)
  • Camera/Eye
  • Object
  • Relative position and orientation of eye and
    objects within world space inter-related
  • Modelview transformation
  • Eye also has projection
  • Projection transformation

6
Projections
  • Define viewing volume
  • Determines how an object is projected onto screen
    (2-D image plane)
  • Determines what is visible (view clipping)

top
left
viewing volume
right
bottom
near
far
7
Perspective glFrustum() gluPerspective()
Orthographic glOrtho() gluOrtho2D()
8
  • Perspective
  • Parallel lines in 3-D not parallel in 2-D
    (foreshortening)
  • Distortions larger at closer distances
  • VP vanishing point
  • Orthographic
  • Parallel lines in 3-D remain parallel in 2-D
  • Approximated by very distant objects
  • Vanishing point at infinity

PlaneView3D www.mtsu.edu/csjudy/planeview3D/tuto
rial.html
9
Transformations
  • Three classes of model transformations
  • Translation glTranslate()
  • Rotation glRotate()
  • Scaling glScale()
  • gluLookAt()
  • Combines all 3 transformations

10
Move eye or object?
11
Which transformation first? (matrix
multiplication is non-commutative AM ? MA)
12
3-D Object Geometry
  • 3-D object collection of vertices
  • Position
  • Surface Normal
  • Normal is
  • Object-centered
  • Specifies orientation of points on surface, with
    respect to object coordinate system

13
Surface Normals
  • Vector perpendicular to tangent plane
  • Has a direction (sign)!
  • Used for calculating
  • Shading angle between light ray and surface
    normal
  • Visibility sign of direction with respect to eye
  • Two methods to calculate normals (Appendix E in
    Redbook)
  • Analytic solution If you know the surface
    function, you can calculate the normal exactly
  • Polygonal approximation Calculate normal of
    polygon from 3 vertices

14
Ballard Brown 82, Chap 3
15
Projections and Transformations in OpenGL
  • Redbook, Chap 3

16
Enter the Matrix
  • Projections and transformations are implemented
    as 4 x 4 matrices
  • Eye and object transformations combined into
    modelview matrix
  • Only one active current matrix
  • Must switch between projection matrix and
    modelview matrix
  • OpenGL functions to set current matrix
  • Calls to glRotate(), glTranslate(), glScale(),
    etc. change values of active matrix
  • Can directly change values of current matrix
  • Can save and restore current matrix using Matrix
    Stack

17
Transformation Matrix Multiplication
18
Matrix Commands
19
Modelview Matrix
Redbook, Appendix F
20
Modelview Matrix
Scaling
glScalef(x,y,z)
Translation
glTranslatef(x,y,z)
Redbook, Appendix F
21
Projection Matrix
Perspective
glFrustum()
Orthographic
glOrtho()
Redbook, Appendix F
22
Matrix Stack

glPushMatrix()
glPopMatrix()
Top (current matrix)
  • Keep track of matrix states (undoes)
  • Hierarchical transformations

Bottom 2 projection 32 modelview
23
Look At That!
gluLookAt(x, y, z, 0, 0, 0, 0, 1, 0)
24
Rendering Pipeline(2nd pass)
3D Vertex Data
Vertex Evaluation
Frame Buffer
2D Pixel Data
Pixel Operation
25
Translate Rotate Scale
3D Vertex Data
Vertex Evaluation
Modelview Matrix
(x, y, z)
Projection Matrix
Viewport Transf.
Frame Buffer
Perspective Orthographic
26
Rendering Pipeline
MV
Pro
View port
3D Vertex Data
Vertex Evaluation
Frame Buffer
2D Pixel Data
Pixel Operation
27
Template Code 1
28
Basic Structure
Add libraries
Model Reader
Own/other libraries
Global variables Function prototypes
Initialization functions
Lighting
OpenGL States
Your functions here!
Model Renderer
Main function Infinite loop
29
Header Files
  • Interface between your program and libraries
  • Data structures
  • Functions
  • Copies code in header file at include point
  • Be careful not to duplicate variables or function
    names
  • Standard directory paths for standard header
    files
  • Accessed with ltgt (triangle brackets)
  • Local directory for header files
  • Accessed with (double-quotes)

30
More on OpenGL States
  • OpenGL states can be changed any where in your
    program
  • Remember that states have default values!
  • Sometimes comes in pairs
  • glBegin() glEnd()
  • glEnable() glDisable()
  • glPushMatrix() glPopMatrix()
  • Rule of thumb
  • If you explicitly change a state, change it back
  • If a state only needs to be changed once (e.g.,
    lighting), then set the state once in OpenGL
    initialization

31
www.opengl.org/resources/code/basics/redbook/index
.html
  • Add hand with additional fingers
  • Animate robotic arm

32
This slide left intentionally blank
Write a Comment
User Comments (0)
About PowerShow.com