Download presentation
Presentation is loading. Please wait.
Published byArnold Freeman Modified over 9 years ago
1
NUS Computing Camp for Junior Colleges & High School Students Stereogram Generation Workshop Dr Ben Leong NUS School of Computing 28 Nov 2012
2
What are stereograms?
3
How do stereograms work? Because there is a small separation between our eyes, they perceive slightly different images Because there is a small separation between our eyes, they perceive slightly different images These differences allow us to perceive depth. These differences allow us to perceive depth. Autostereograms work by repeating patterns in such a way as to give us an illusion of depth Autostereograms work by repeating patterns in such a way as to give us an illusion of depth
4
How do stereograms work? Image plane A B C D
5
Generation of stereograms Key idea: compute the sets of points that are constrained to be of the same colour Key idea: compute the sets of points that are constrained to be of the same colour Note that we can compute the required image one line at a time Note that we can compute the 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
6
Generation of stereograms 1. Create a 3-d model of the object Use a function f(x,y) to define the depth of an object Use a function f(x,y) to define the depth of an object 2. 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. Compute one line at a time
7
Generation of stereograms Image plane
8
Generation of stereograms Image plane
9
Generation of stereograms Image plane How far?
10
Generation of stereograms Image plane A D -z E s
11
How would YOU create a stereogram? We have already written the program that will automatically generate a stereogram based on the method described. We have already written the program that will automatically generate a stereogram based on the method described. What you need to do is to create a depth map and feed it to the stereogram generator: What you need to do is to create a depth map and feed it to the stereogram generator: STEREOGRAM GENERATOR depth map stereogram
12
How would YOU create a stereogram? Our stereogram generator is written in Scheme Our stereogram generator is written in Scheme You will learn how to manipulate some simple objects to build your own depth maps and create your own stereograms You will learn how to manipulate some simple objects to build your own depth maps and create your own stereograms Simple programming Simple programming
13
Plan for Today You will get a worksheet that will guide you through what we have discussed You will get a worksheet that will guide you through what we have discussed My lab assistants will help you My lab assistants will help you Create cool stereograms and share with your friends and family Create cool stereograms and share with your friends and family
14
Primitive building blocks (show rcross-bb)
15
Primitive building blocks (show corner-bb)
16
Primitive building blocks (show sail-bb)
17
Primitive building blocks (show nova-bb)
18
Primitive building blocks (show heart-bb)
19
Primitive building blocks (show circle-bb)
20
Primitive building blocks (show spiral-bb)
21
Primitive Operation: Rotating to the Right (clear) (show (quarter-turn-right sail-bb))
22
Derived Operation: Rotating Upside Down (clear) (show (turn-upside-down sail-bb))
23
How about Rotating to the Left? (clear) (show (quarter-turn-left sail-bb))
24
Flipping Objects (clear) (show (flip-horiz nova-bb)) (clear) (show (flip-vert nova-bb))
25
Means of Combination: Stacking (clear) (show (stack rcross-bb sail-bb))
26
Multiple Stacking (clear) (show (stack rcross-bb (stack rcross-bb sail-bb))) (stack rcross-bb sail-bb)))
27
Placing objects one beside the other (clear) (show (beside sail-bb rcross-bb))
28
A complex object (clear)(show (stack (stack(beside (quarter-turn-right rcross-bb) (quarter-turn-right rcross-bb) (turn-upside-down rcross-bb)) (turn-upside-down rcross-bb))(beside rcross-bb rcross-bb (quarter-turn-left rcross-bb)))) (quarter-turn-left rcross-bb)))) This operation is also known as make-cross
29
Naming your objects with define (clear) (define myPic (make-cross sail-bb)) (show myPic) (define myPic2 (make-cross nova-bb)) (show myPic2)
30
Repeating the pattern (clear) (show (make-cross (make-cross nova-bb)))
31
Repeating multiple times (clear) (show (repeat-pattern 4 make-cross nova-bb))
32
What about 3 rows? (clear) (show (stack-frac 1/3 rcross-bb sail-bb)) (clear) (show (stack-frac 1/3 rcross-bb (stack rcross-bb rcross-bb))) (stack rcross-bb rcross-bb)))
33
Repeating n times (clear) (show (stackn 3 nova-bb)) (clear) (show (stackn 5 nova-bb))
34
A rectangular repeated pattern (clear) (show (stackn 5 (quarter-turn-right (stackn 5 (quarter-turn-left nova-bb)))))
35
Another regular pattern (clear) (show (nxn 3 (make-cross rcross-bb)))
36
Creating 3D objects We use greyscale to represent depth We use greyscale to represent depth Black is nearest to you Black is nearest to you White is furthest away White is furthest away means
37
Creating 3D objects means
38
Overlay Operation (clear) (show (overlay sail-bb rcross-bb))
39
Advanced Overlay Operation (clear) (show (overlay-frac 1/4 corner-bb heart-bb))
40
Scaling (clear) (show (scale 1/2 heart-bb))
41
Wait, did we say we’re creating stereograms? Yeah, that’s the easy part! Yeah, that’s the easy part! Do: Do: (stereogram ) Example: Example: (show (overlay sail-bb rcross-bb)) (stereogram (overlay sail-bb rcross-bb))
42
Your First Stereogram
43
Loading from/Saving to File You can also create a depth map using some paint program and load using: You can also create a depth map using some paint program and load using: (load-map ) You can save your work with: You can save your work with: (save )
44
What if you cannot see stereograms?
45
Think Different Image plane
46
Think Different Image plane
47
Think Different Image plane
48
3D Anaglyphs Image plane Use filters to show one image to each eye!
49
What else can we do to create an illusion of 3D?
51
Simulating 3D Effect with Animation Image plane
52
Simulating 3D Effect with Animation Image plane
53
Simulating 3D Effect with Animation Image plane
54
Simulating 3D Effect with Animation Image plane
55
Simulating 3D Effect with Animation Image plane
56
Simulating 3D Effect with Animation Image plane
57
Simulating 3D Effect with Animation Image plane
59
QUESTIONS
60
What you have seen are the basics of programming! What you have seen are the basics of programming!
61
The World of Computer Science Programming Database Artificial Intelligence Logic Data Structures & Algorithms Compilers Graphics Vision Software Engineering Theory Human-Computer Interaction Programming Languages Architecture Operating SystemsNetworks Security
62
Words 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 things Like to ‘create’ or build things Want to make a difference to society in the work you do Want to make a difference to society in the work you do You are impatient and you want to see your work out there in the real world in a hurry You are impatient and you want to see your work out there in the real world in a hurry
63
Words of Advice Follow your heart, NOT the market Follow your heart, NOT the market Figure out what you like and what you’re good at – and keep doing it Figure out what you like and what you’re good at – and keep doing it Try and explore different things Try and explore different things Ask yourself: What do you want to do with your life? WHY? Ask yourself: What do you want to do with your life? WHY?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.