Title: CG for Vision Research
1CG for Vision Research
- Lecture 8
- Winter Term 05-06
- Quoc Vuong, Franck Caniard, MPI
2OpenGL 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)
3Binocular Vision(Stereopsis)
4For fixated object, there is no retinal disparity
( F F ), i.e., light rays fall on fovea.
?
FD
FD focal distance IOD interocular distance ?
vergence angle FD IOD / ( 2tan(?) )
F
F
IOD
5?
F
F
IOD
6Objects on horopter also has no retinal disparity
( ?L ?R ). Radius of horopter depends on FD
FD
Horopter
?L
?R
P
P
F
F
IOD
7Crossed (negative) disparity for objects in
front of horopter.
FD
P
P
F
F
IOD
8Uncrossed (positive) disparity for objects
behind horopter.
FD
P
P
F
F
IOD
9Positive parallax (Uncrossed)
Zero parallax
Negative parallax (Crossed)
10Retinal Disparity
- Horizontal retinal disparity depends on
- Fusion distance
- Interocular distance
- Vergence and accommodation
- Vertical disparity scales distance
- Problems to consider
- Correspondence Problem The extent to which the
visual system can find corresponding points in
the 2 retinal images - Fusion Limit limit to which observer can fuse 2
images - Perceived depth correlated with (horizontal)
retinal disparity - Can be scaled by vergence angle, vertical
disparity, size perception, etc.
11Disparity Motion
- Disparity spatial displacement of corresponding
points - Motion temporal displacement of corresponding
points - Neurons tuned to both disparity and motion
signals (Qian)
12Simulating Disparity Field
13? ?L ?R ?L, ?R in radians
To simplify, assume FD large!
?L
?R
IOD
14? ?L ?R ?L, ?R in radians uL, uR in screen
units that project to P and P
uL
uR
Projection Plane (monitor screen)
P
?L
?R
P
IOD
15z
P(x,z)
z depth
uL
uR
Projection Plane
x
D Viewing distance
?L
?R
E IOD/2
16? ?L ?R
z
P(x,z)
z
uL
uR
x
D
?L
?R
If ( D z ) gtgt ( E x ) then ?L ? ( E x )
/ ( D z ) So can drop tan() to simplify
calculations
E
17Need to solve for uL and uR using Equivalent
Triangles Left eye ( E x ) / ( D z ) ( E
uL ) / D uL ( Dx Ez ) / ( D z )
? ? uR - uL ( 2Ez ) / ( D z )
z
P(x,z)
z
uL
uR
x
D
?L
?R
E
18Simulating Disparity Field
19Toe-In Method
- Geometrically incorrect as it produces some
vertical disparities - Can still be used (simpler less computational)
http//astronomy.swin.edu.au/pbourke/stereographi
cs/stereorender/
20Off-Axis Method
- Geometrically correct No vertical disparity
- Also called parallel axis asymmetric frustum
perspective projection
21Stereo Technology
22Implementation Issues
- Ghosting/ Crosstalk
- When information for one eye seen by other
- Accommodation and Vergence angle
- Can lead to conflicts (especially if using a
screen) - Spatial Resolution
- Stereo acuity 3 arc sec or 1/25000th of an inch
http//white.stanford.edu/brian/numbers/node1.htm
l) - Pixels are discrete so there will be rounding
errors larger than stereo-acuity - Fusion
- Fusion limit
- Negative (in front of screen), positive (behind
screen) and zero parallax (disparity)
23Mirror Systems
24Stereoscope Wheatstone (1838)
25Active/Passive Viewing Systems
26True 3D Systems
http//bankslab.berkeley.edu/Projects/StereoDispla
yIntro.html
27Framebuffer
28Simulated 3D Scene
Point
3D Transformations
Rasterization ? Fragment (color depth)
Texture mapping
Fragment tests
Pixel
(0,0)
Image on screen
29Framebuffer
- Buffer Memory storage for a single component
(e.g., red, green, blue, alpha, depth, etc.) - Framebuffer All available buffers on graphics
card
30Color buffer
- Refers to the collection of RED, GREEN, BLUE and
ALPHA buffers - The buffer you actually see!
- Several type of color buffers (depends on
graphics card) - Front (screen) and back (GL_FRONT, GL_BACK)
- For front and back, there is also a left and
right buffer for stereo-capable graphics cards
(GL_FRONT_LEFT, GL_FRONT_RIGHT) - Also auxiliary buffers (GL_AUX0, GL_AUX1, )
- Need to initialize the type of buffer you want
- glutInitDisplayMode( GLUT_DOUBLE GLUT_RGBA
GLUT_STEREO ) - If double buffering is enabled,
glutSwapBuffers() swaps front and back buffers
31Buffer Operations
- Clear buffers can be a very expensive
operation! - glClear(GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT)
- Selecting buffers
- glDrawBuffer(GL_BACK) // Put color in back
buffer - glReadBuffer(GL_AUX1) // Get color data from
auxiliary 1 buffer - Masking buffers
- glColorMask(GL_TRUE, GL_FALSE, GL_FALSE,
GL_FALSE) - // Only write color to RED channel
32Buffer Masking
Fragment1 R 200 G 50 B 50 A 255 Depth
3 Coord 210, 250
color
depth
33Buffer Masking
Fragment1 R 200 G 50 B 50 A 255 Depth
3 Coord 210, 250
color
depth
34Fragment Tests
- 7 tests performed sequentially to see if
fragments makes it into framebuffer (to become a
pixel!) by comparing value of incoming fragment
with value in appropriate buffer - Scissor Test
- Alpha Test
- Stencil Test
- Depth Test
- Blending
- Dithering
- Logical Operations
- These tests can be enabled/disabled e.g.
glEnable(GL_DEPTH_TEST)
35Depth Test
Fragment1 R 255 G 0 B 0 A 255 Depth 3 Coord
200, 500
color
depth
36Depth Test
Fragment2 R 200 G 50 B 0 A 255 Depth 8 (gt
3) Coord 200, 500
37Template Code 5
38A few clarifications
- Screen refreshes
- Use glutPostRedisplay() to force the screen to
refresh - Put the drawing function into the idle callback
- glutIdleFunc(DrawGLScene)
- Put glutPostRedisplay() in the idle callback
- Local variable with same name as global variable
- Commands within function is affected by value of
local variable - The global variable (with the same name) DOES NOT
get updated
39This slide left intentionally blank