150 likes | 494 Views
Creating Anaglyphs Announcements REMINDER - In class exam on Monday, March 2 nd Closed book/closed notes Will cover the introduction and the unit on pictures (chapters 1-5) Will follow the same general format of the quizzes (may even include some of those questions a second time)
E N D
Announcements • REMINDER - In class exam on Monday, March 2nd • Closed book/closed notes • Will cover the introduction and the unit on pictures (chapters 1-5) • Will follow the same general format of the quizzes (may even include some of those questions a second time) • Will not ask you to write any significant code • I will not be here (Dr. Fienup will proctor)
Announcements • CHANGE - In lab exam is on Tuesday, March 10th • Closed book/closed notes • No access to the internet or your previous assignments • Will ask you to write two or three methods to manipulate picture(s) • I will be here
Announcements • CHANGE - Tuesday, March 3rd is now a lab • Introduction to sound • Read chapter six prior to lab • I will not be here • Dossay will answer your questions in lab
Announcements • PA04 is now posted • Use the graphics commands and pictures to create a comic strip • At least four frames (for which you draw lines to separate) • At least two characters • At least one character must be changed by you via code. • At least one piece of text • Due on Tuesday, March 10th (yes, the day of the in-lab exam)
That is an old fashioned “stereograph” • Two images from slightly different perspectives • If you can get one eye to see one photo and the other eye to see the other photo then you can create a 3D effect
But how could we do this “at home” • Answer: • Anaglyphs • Split one photo (normally the left eye) into its red channel • Split the other photo (normally the right eye) into its cyan channel • Merge • But you need those funny glasses (I have both red/cyan and yellow/blue glasses)
So what would the code look like? def anaglyph(left,right): output = makeEmptyPicture(getWidth(left),getHeight(left)) for x in range(1,getWidth(left)): for y in range(1,getHeight(left)): target = getPixel(output,x,y) s1 = getPixel(left,x,y) s2 = getPixel(right,x,y) setRed(target,getRed(s1)) setGreen(target,getGreen(s2)) setBlue(target,getBlue(s2)) return output
Slightly “better” code def anaglyph(left,right): output = makeEmptyPicture(getWidth(left),getHeight(left)) for x in range(1,getWidth(left)): for y in range(1,getHeight(left)): target = getPixel(output,x,y) s1 = getPixel(left,x,y) s2 = getPixel(right,x,y) setRed(target,(getRed(s1)+getGreen(s1)+getBlue(s1))/3) setGreen(target,getGreen(s2)) setBlue(target,getBlue(s2)) return output
Sources for images • Several Websites • http://www.studio3d.com/pages/anaglyph.html • http://www.studio3d.com/pages/stereophoto.html • http://hazyhills.com/mars3d/ • Take them yourself • Take two photos with one slightly to the right of the other