1 NUS Computing Camp for NUS Computing Camp for Junior Colleges & Junior Colleges & High School Students High School Students Stereogram Stereogram Generation Workshop Generation Workshop Dr Ben Leong Dr Ben Leong NUS School of Computing NUS School of Computing 28 Nov 2012 28 Nov 2012 What are stereograms? What are stereograms? How do stereograms work? How do stereograms work? Because there is a small separation Because there is a small separation between our eyes, they perceive slightly between our eyes, they perceive slightly different images different images These differences allow us to perceive These differences allow us to perceive These differences allow us to perceive These differences allow us to perceive depth. depth. Autostereograms work by repeating Autostereograms work by repeating patterns in such a way as to give us an patterns in such a way as to give us an illusion illusion of depth of depth How do stereograms work? How do stereograms work? Image plane A B C D Generation of stereograms Generation of stereograms Key idea: compute the sets of points Key idea: compute the sets of points that are constrained to be of the that are constrained to be of the same colour same colour Note that we can compute the Note that we can compute the required image one line at a time required image one line at a time How do we compute these sets? How do we compute these sets? Use simple geometry Use simple geometry Generation of stereograms Generation of stereograms 1. 1. Create a 3 Create a 3-d model of the object d model of the object Use a function Use a function f(x,y) f(x,y) to define the depth of to define the depth of an object an object 2 Decide on some parameters Decide on some parameters 2. 2. Decide on some parameters Decide on some parameters Distance between eyes and image Distance between eyes and image Position of object relative to image plane Position of object relative to image plane Distance between the two eyes Distance between the two eyes 3. 3. Compute one line at a time Compute one line at a time
11
Embed
Stereogram Generation Workshop - comp.nus.edu.sgbleong/stereo/StereogramWorkshop.pdf · 1 NUS Computing Camp for Junior Colleges & Junior Colleges & High School StudentsHigh School
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
NUS Computing Camp for NUS Computing Camp for Junior Colleges & Junior Colleges & High School StudentsHigh School Students
Dr Ben LeongDr Ben LeongNUS School of ComputingNUS School of Computing
28 Nov 201228 Nov 2012
What are stereograms?What are stereograms?
How do stereograms work?How do stereograms work?
Because there is a small separation Because there is a small separation between our eyes, they perceive slightly between our eyes, they perceive slightly different imagesdifferent images
These differences allow us to perceiveThese differences allow us to perceive These differences allow us to perceive These differences allow us to perceive depth. depth.
Autostereograms work by repeating Autostereograms work by repeating patterns in such a way as to give us an patterns in such a way as to give us an illusionillusion of depthof depth
How do stereograms work?How do stereograms work?
Image plane
A BC D
Generation of stereogramsGeneration of stereograms
Key idea: compute the sets of points Key idea: compute the sets of points that are constrained to be of the that are constrained to be of the same coloursame colour
Note that we can compute the Note that we can compute the required image one line at a timerequired image one line at a time
How do we compute these sets? How do we compute these sets?
Use simple geometryUse simple geometry
Generation of stereogramsGeneration of stereograms
1.1. Create a 3Create a 3--d model of the objectd model of the object Use a function Use a function f(x,y)f(x,y) to define the depth of to define the depth of
an objectan object
22 Decide on some parametersDecide on some parameters2.2. Decide on some parametersDecide on some parameters Distance between eyes and imageDistance between eyes and image
Position of object relative to image planePosition of object relative to image plane
Distance between the two eyesDistance between the two eyes
3.3. Compute one line at a timeCompute one line at a time
2
Generation of stereogramsGeneration of stereograms
Image plane
Generation of stereogramsGeneration of stereograms
Image plane
Generation of stereogramsGeneration of stereograms
Image plane
How far?
Generation of stereogramsGeneration of stereograms
Image plane
AD
-z
E
s
zD
E
z
s
How would YOU create a How would YOU create a stereogram? stereogram?
We have already written the program that We have already written the program that will automatically generate a stereogram will automatically generate a stereogram based on the method described.based on the method described.
What you need to do is to create a depthWhat you need to do is to create a depth What you need to do is to create a depth What you need to do is to create a depth map and feed it to the stereogram map and feed it to the stereogram generator:generator:
STEREOGRAM
GENERATOR
depth map
stereogram
How would YOU create a How would YOU create a stereogram?stereogram?
Our stereogram generator is written in Our stereogram generator is written in SchemeScheme
You will learn how to manipulate You will learn how to manipulate some simple objects to build your some simple objects to build your own depth maps and create your own own depth maps and create your own stereogramsstereograms
Simple programming Simple programming
3
Plan for TodayPlan for Today
You will get a worksheet that will You will get a worksheet that will guide you through what we have guide you through what we have discusseddiscussed
My lab assistants will help youMy lab assistants will help you
Create Create cool stereogramscool stereograms and and share with your friends and familyshare with your friends and family
Primitive building blocksPrimitive building blocks
(show rcross(show rcross--bb)bb)
Primitive building blocksPrimitive building blocks
(show corner(show corner--bb)bb)
Primitive building blocksPrimitive building blocks
(show sail(show sail--bb)bb)
Primitive building blocksPrimitive building blocks
(show nova(show nova--bb)bb)
Primitive building blocksPrimitive building blocks
(show heart(show heart--bb)bb)
4
Primitive building blocksPrimitive building blocks
(show circle(show circle--bb)bb)
Primitive building blocksPrimitive building blocks
(show spiral(show spiral--bb)bb)
Primitive Operation:Primitive Operation:Rotating to the RightRotating to the Right
Loading from/Saving to FileLoading from/Saving to File
You can also create a depth map using You can also create a depth map using some paint program and load using:some paint program and load using:
(load(load--map <filename>)map <filename>)
You can save your work with:You can save your work with:(save <filename>)(save <filename>)
What if you What if you cannot seecannot seecannot see cannot see
stereograms? stereograms?
Think DifferentThink Different
Image plane
Think DifferentThink Different
Image plane
Think DifferentThink Different
Image plane
3D Anaglyphs3D Anaglyphs
Image plane
Use filters to show one image to each eye!Use filters to show one image to each eye!
9
What else can we What else can we do to create ando to create ando to create an do to create an illusion of 3D? illusion of 3D?
Simulating 3D Effect with AnimationSimulating 3D Effect with Animation
Image plane
Simulating 3D Effect with AnimationSimulating 3D Effect with Animation
Image plane
Simulating 3D Effect with AnimationSimulating 3D Effect with Animation
Image plane
Simulating 3D Effect with AnimationSimulating 3D Effect with Animation
Image plane
10
Simulating 3D Effect with AnimationSimulating 3D Effect with Animation
Image plane
Simulating 3D Effect with AnimationSimulating 3D Effect with Animation
Image plane
Simulating 3D Effect with AnimationSimulating 3D Effect with Animation
Image plane
QUESTIONSQUESTIONS What you have What you have seen are the seen are the
basics of basics of programming! programming!
11
The World of Computer ScienceThe World of Computer Science
Artificial IntelligenceLogic
G hi
Vision
Human-Computer InteractionProgramming Languages
Programming
Database
Data Structures & AlgorithmsCompilers
Graphics
Software EngineeringTheory
Architecture
Operating SystemsNetworks
Security
Words of AdviceWords of Advice
Consider Computer Science if:Consider Computer Science if:Like Maths (esp. ‘elegant’ Maths)Like Maths (esp. ‘elegant’ Maths)Like to ‘create’ or build thingsLike to ‘create’ or build thingsWant to make a difference to society in Want to make a difference to society in
the work you dothe work you doYou are impatient and you want to see You are impatient and you want to see
your work out there in the real world in a your work out there in the real world in a hurryhurry
Words of AdviceWords of Advice
Follow your heart, Follow your heart, NOTNOT the marketthe marketFigure out what you like and what Figure out what you like and what
you’re good atyou’re good at –– and keep doing itand keep doing ityou re good at you re good at and keep doing itand keep doing itTry and explore different thingsTry and explore different thingsAsk yourself: What do you want to Ask yourself: What do you want to