Lecture 21: Cameras & Lenses II Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2017 Cameras & Lenses Lectures Last time: • • Field of view, composition & perspective Shutter / exposure durations Today • • Thin lens approximation, Gauss ray diagrams Lens focus effects: defocus, depth of field, bokeh Next time: • • Real lens designs and effects Lens exposure considerations CS184/284A Ren Ng Real Lens Designs Are Highly Complex [Apple] CS184/284A Topic of next lecture Ren Ng �i the desi provide One re where all mod some h lenses today [ tremely quickly venienc aberrat making of at lea this ph Real plano-convex lens (spherical surface shape). Lens does not converge rays to a point anywhere. CS184/284A More discussion next lecture Ren Ng aberration. Figure �.�: Spherical ried to remarkable extremes. Zoom l Real Lens Elements Are Not Ideal – Aberrations Today: Thin Lens Approximation Ideal Thin Lens – Focal Point Focal Point Credit: Karen Watson Focal Length Assume all parallel rays entering a lens pass through its focal point. CS184/284A Ren Ng Lens Focusing – Conjugate Points • Rays from a point in object space intersect at a point in image space • Object space CS184/284A Image space These are called conjugate points • We create images focused at different depths by placing a sensor at the conjugate distances • Question: what is the relationship between the position of a lens’ conjugate points? Ren Ng Gauss’ Ray Diagrams Gauss’ Ray Tracing Construction Parallel Ray Chief Ray Focal Ray Object CS184/284A Image Ren Ng Gauss’ Ray Tracing Construction f zo f zi What is the relationship between conjugate depths zo , zi ? CS184/284A Ren Ng Gauss’ Ray Tracing Construction ho ho zo hi = f f ho zo CS184/284A f ho hi hi = f f ho hi = f zi f f hi ho hi = f zi f Ren Ng Gauss’ Ray Tracing Construction ho hi = f zi f ho f = hi zi f ho zo hi = f f ho zo f = hi f zo f f (zo z o zi f )(zi f = zi 2 f) = f 2 (zo + zi )f + f = f f Newtonian Thin Lens Equation 2 zo zi = (zo + zi )f 1 1 1 = + f zi zo CS184/284A Object / image heights factor out - applies to all rays Gaussian Thin Lens Equation Ren Ng The Thin Lens Equation zo f f (zo z o zi f )(zi f = zi 2 ff) = f 2 zo zi )f + f = f (zo + f f 2 zi zo zi = (zo + zi )f 1 1 1 = + f zi zo CS184/284A Ren Ng f )(zi f) = f + zChanging i )f + f = f 2 2 the Focus Distance zo zi = (zo + zi )f 1 1 1 = + f zi zo Sensor • To focus on objects at different distances, move the sensor relative to the lens • For zi < zo the object is larger than the image • At zi = zo we have 1:1 macro imaging • For zi > zo the image is larger than the object • Can’t focus on objects closer than the lens’ focal length CS184/284A Ren Ng Magnification ho hi zo zi hi zi m= = ho zo CS184/284A Ren Ng )(zi f) = f 2 2 2 Magnification Example – Focus at Infinity )f + f = f i zo zi = (zo + zi )f 1 1 1 = + f zi zo zi m= zo If focused on a distant mountain • • • zo ≈ ∞, so zi = f sensor at focal point magnification ≈ 0 CS184/284A Ren Ng (zo f )(zi f) = f 2 Magnification zo zi Example (zo + zi )f +–f Focus = f at 1:1 Macro 2 2 zo zi = (zo + zi )f 1 1 1 = + f zi zo zi m= zo What configuration do we need to achieve a magnification of 1 (i.e. image and object the same size, a.k.a. 1:1 macro)? • • Need zi = zo, so zi = zo = 2f —- sensor at twice focal length In 1:1 imaging, if the sensor is 36 mm wide, an object 36 mm wide will fill the frame CS184/284A Ren Ng Thin Lens Demonstration http://graphics.stanford.edu/courses/cs178-10/applets/gaussian.html CS184/284A Ren Ng Thin Lens Demonstration Observations 3D image of object is: • Compressed in depth for low magnification • 1:1 in 3D for unit magnification • Stretched in depth for high magnification CS184/284A Ren Ng Lens Performs a 3D Perspective Transform • Lenses transform a 3D object to a 3D image; the sensor extracts a 2D slice from that image • As an object moves linearly (in Z), its image moves non-proportionally (in Z). And vice versa. • As you refocus a camera, the image changes size ! CS184/284A Ren Ng Defocus Blur Circle of Confusion CS184/284A Ren Ng Circle of Confusion Further defocused object Closer defocused object CS184/284A Ren Ng Computing Circle of Confusion Diameter (C) 0 zs zs zo zi d! A Object Focal Plane Circle of confusion is proportional to the size of the aperture CS184/284A C Image Sensor Plane 0 C d |zs zi | = = A zi zi Ren Ng Circle of Confusion is Inversely Proportional to F-Stop R. Berdan, canadiannaturephotographer.com C=A CS184/284A |zs zi zi | f |zs zi | = N zi Ren Ng Definition: F-Number (a.k.a. F-Stop) • The F-Number of a lens is defined as the focal length divided by the diameter of the aperture • Common F-stops on real lenses: 1.4, 2, 2.8, 4.0, 5.6, 8, 11, 16, 22, 32 • • 1 stop doubles exposure An f-stop of 2 is sometimes written f/2, reflecting the fact that the absolute aperture diameter (A) can be computed by dividing focal length (f) by the relative aperture (N). CS184/284A Ren Ng Example F-Stop Calculations D = 50 mm f = 100 mm N = f /D = 2 D = 100 mm f = 200 mm N = f /D = 2 D = 100 mm f = 400 mm N = f /D = 4 CS184/284A Ren Ng Circle of Confusion is Inversely Proportional to F-Stop R. Berdan, canadiannaturephotographer.com C=A CS184/284A |zs zi zi | f |zs zi | = N zi Ren Ng Circle of Confusion – Example 50mm f/2 lens Full frame sensor (36x24mm) Focus: 1 meter Background: 10 meter Foreground: 0.3 meter |zs zi | f |zs zi | A = 50mm/2 = 25mm C=A = 1 zi N zi zs = ⇡ 52.63mm 1/50 1/1000 1 Background: zi = ⇡ 50.25mm 1/50 1/10,000 C = A|zs zi |/zi = 1.18mm ~65 pixels on HD TV 1 Foreground: zi = ⇡ 55.56mm 1/50 1/300 C = A|zs CS184/284A zi |/zi = 3.07mm ~167 pixels on HD TV Ren Ng Circle of Confusion in Perspective Composition • • To maintain field of view on subject, increase distance from subject by same factor as focal length (approx). 16 mm (110°) 200 mm (12°) What is the increase in background blur? CS184/284A Ren Ng Circle of Confusion in Perspective Composition • • To maintain field of view on subject, increase distance from subject by same factor as focal length (approx). What is the increase in background blur? CS184/284A For subject at distance Z, 1 1 1 = zs f Z Distant background means zi = f, f |zs zi | f C= = N zi N f f = NZ f • 1 1/f 1/Z f f = ... If we increase Z and f by factor K, circle of confusion C also increases by K. (F-stop held constant) Ren Ng Circle of Confusion in Perspective Composition 100mm, f/4 138px 40px 28mm, f/4 From Paul van Walree, toothwalker.org/dof.html 100mm 138px ⇡ As predicted, , but notice blur is constant relative to background object itself! 28mm 40px CS184/284A Ren Ng Ray Tracing Ideal Thin Lenses Examples of Renderings with Lens Focus Pharr and Humphreys CS184/284A Ren Ng Ray Tracing for Defocus Blur (Thin Lens) x’’ x’ x’’’ Sensor Subject plane zo zi Setup: • Choose sensor size, lens focal length and aperture size • Choose depth of subject of interest zo • Calculate corresponding depth of sensor zi from thin lens equation (focusing) CS184/284A Ren Ng Ray Tracing for Defocus Blur (Thin Lens) x’’ x’ x’’’ Sensor Subject plane zo zi To compute value of pixel at position x’ by Monte Carlo integration: • Select random points x’’ on lens plane • Rays pass from point x’ on image plane zi through points x’’ on lens • Each ray passes through conjugate point x’’’’ on the plane of focus zo • Can determine x’’’ from Gauss’ ray diagram • So just trace ray from x’’ to x’’’ • Estimate radiance on rays using path-tracing, and sum over all points x’’ CS184/284A Ren Ng Examples of Renderings with Lens Focus Pharr and Humphreys CS184/284A Ren Ng Example of Rendering with Lens Focus Credit: Bertrand Benoit. “Sweet Feast,” 2009. [Blender /VRay] Example of Rendering with Lens Focus Credit: Giuseppe Albergo. “Colibri” [Blender] Acknowledgments Many thanks to Marc Levoy, who created many of these slides, and Pat Hanrahan. • London, Stone, and Upton, Photography (9th ed.), Prentice Hall, 2008. • • • • • Peterson, Understanding Exposure, AMPHOTO 1990. The Slow Mo Guys bobatkins.com Hari Subramanyan Canon EF Lens Work III CS184/284A Ren Ng
© Copyright 2026 Paperzz