Fun - Research MIT CSAIL

Transcription

Fun6.098 Digital and Computational Photography6.882 Advanced Computational Photography http://www.ritsumei.ac.jp/ akitaoka/motion-e.htmFocus and Depth of FieldFrédo DurandBill FreemanMIT - EECSFocusingIn practice, it’s a little more complex Move film/sensor Thin-lens formulaD’1 1 1D’ D fD Various lens elementscan moveinside the lens– Here in bluefSource: Canon red book.Defocus &Depth of field1

Circle of confusionDepth of focuscircle of confusionFrom Basic Photographic Materials and Processes, Stroebel et al.From Basic Photographic Materials and Processes, Stroebel et al.Size of permissible circle?Depth of field: Object space Assumption on print size, viewing distance, humanvision– Typically for 35mm film: diameter 0.02mm Simplistic view: double cone– Only tells you about the value of one pixel– Things are in fact a little more complicated to assescircles of confusion across the image– We're missing the magnification factor(proportional to 1/distance and focal length) Film/sensor resolution(8μ photosites for high-end SLR ) Best lenses are around 60 lp/mm Diffraction limitsensorPoint in focuslensObject with textureDepth of field: more accurate viewDepth of field: more accurate view Backproject the image onto the plane in focus– Backproject circle of confusion– Depends on magnification factor Depth of field is slightly asymmetrical Backproject the image onto the plane in focus– Backproject circle of confusion– Depends on magnification factor ¼ f/D¼fConjugate ofcircle of confusionDCD/fCPoint in focuslensDepth of fieldlens2

Deriving depth of field Deriving depth of fieldCircle of confusion C, magnification mSimplification: m f/DFocusing distance D, focal length f, aperture NAs usual, similar trianglesDD-d1f/Nf/NCD/fCD/fd2d1Deriving depth of fieldd1Deriving depth of fieldN2C2D2 term can often be neglected when DoF is small(conjugate of circle of confusion is smaller than lens aperture)DDf/Nf/NCD/fd2d1CD/fd1d2Depth of field and apertureDoF & aperture Linear: proportional to f number Recall: big f number Nmeans small physical aperture http://www.juzaphoto.com/eng/articles/depth of field.htmf/NCD/fd1d2f/2.8f/323

SLR viewfinder & apertureDepth of field and focusing distance By default, an SLR always shows you the biggestaperture Brighter image Shallow depth of field help judge focus Depth of field preview button:– Stops down to the aperture you have chosen– Darker image– Larger depth of field Quadratic (bad news for macro)(but careful, our simplificationsare not accurate for macro)Df/NCD/fd2d1Double cone perspectiveDepth of field & focusing distance Seems to say that relationship is linear But if you add the magnification factor, it's actuallyquadraticPoint in focussensorlensFrom Photography, London et al.Hyperfocal distanceHyperfocal distance When CD/f becomes bigger than f/N focus at D f2/NC and sharp from D/2 till infinity Our other simplifications do not work anymorethere: the denominator term has to be taken intoaccount inf/NFrom Basic Photographic Materials and Processes, Stroebel et al.CD/fd1CD/fd24

Depth of field and focal lengthDepth of field & focal length Inverse quadratic:the lens gets bigger,the magnification is higher Recall that to get the same image size,we can double the focal length and the distance Recall what happens to physical aperture size whenwe double the focal length for the same f number?– It is doubledDf/NCD/fd1d224mm50mmDepth of field & focal lengthDoF & Focal length Same image size (same magnification),same f numberDoF Same depth of field! http://www.juzaphoto.com/eng/articles/depth of field.htmWide-anglelensDoF50mm f/4.8Telephotolens (2x f), same aperture200mm f/4.8(from 4 times farther)See also Important conclusionImportant conclusion For a given image size and a given f number, thedepth of field (in object space) is the same. Might be counter intuitive. For a given image size and a given f number, thedepth of field (in object space) is the same.– The depth of acceptable sharpness is the same But background far far away looks more blurryBecause it gets magnified more Plus, usually, you don't keep magnification constant Very useful for macro where DoF is critical. Youcan change your working distance without affectingdepth of field Now what happens to the background blur far faraway?5

Effect of parametersRecapaperturefocusing distancefocal lengthFrom applied photographic opticsDoF guidesIs depth of field good or evil? It depends, little grasshopper Want huge DoF: landscape,photojournalists, portrait withenvironment Shallow DoF: portrait, wildlifeFrom "The Manual of Photography" Jacobson et alMichael ReichmanSteve McCurryCrazy DoF imagesIs depth of field a blur? By Matthias Zwicker The focus is between the two sticks Depth of field is NOT aconvolution of the image The circle of confusionvaries with depth There are interestingocclusion effects (If you really want aconvolution, there is one,but in 4D space moreabout this in ten days)Sharp versionReally wide aperture versionFrom Macro Photography6

Depth of field It’s all about the size of the lens apertureSensor sizePoint in focussensorlensObject with texturelenssensorPoint in focusObject with textureEquationSensor size Smaller sensor– smaller C– smaller f But the effect of f is quadratic http://www.mediachance.com/dvdlab/dof/index.htmThe coolest depth of field solutionThe coolest depth of field solution http://www.mediachance.com/dvdlab/dof/index.htm Use two optical systems ssensorPoint in focusdiffuser lenslenssensorObjectwithtexturePoint in focusdiffuserlensObjectwithtexture7

Seeing beyond occlusionSeeing throughocclusion Photo taken through zoo bars Telephoto at full aperture The bars are so blurrythat they are invisibleSynthetic apertureConfocal imaging Stanford Camera array (Willburn et /) Confocal microscopy (invented by Minsky)From Levoy's paper http://graphics.stanford.edu/papers/confocal/Why a bigger apertureAperture To make things blurrier– Depth of field To make things sharper– Diffraction limitSharpness & aperture (e.g. for the Canon 50mm hp/product/140/sort/2/cat/10/page/3 f/1.4: soft (geometrical aberrations), super shallow Dof. Lots oflight! f/2.8 getting really sharp, shallow depth of field f/5.6: best sharpness f/16: diffraction kicks in, loses sharpness. But dpoth of field isbig8

Soft focus Everything is blurry Rays do not converge Some people like it for portraitSoft focussource: Hecht OpticsWith soft focus lensWithout soft focus lensSoft focusSoft images Remember spherical aberration? Diffuser, grease Photoshop– Dynamic range issueCanon red book (Canon 135 f/2.8 soft focus)With soft focus lenssource: Hecht OpticsFrom Brinkmann's Art & Science of Digital CompositingHow would you build an Auto Focus?Autofocus9

Polaroid Ultrasound (Active AF)Infrared (Active AF) Time of flight (sonar principle) Limited range, stopped by glass Paved the way for use in robotics Intensity of reflected IR is assumed to beproportional to distance There are a number of obvious limitations Advantage: works in the dark This is different from Flash assistant for AF wherethe IR only provides enough contrast so thatstandard passive AF can operate tmhttp://www.uoxray.uoregon.edu/polamod/From Ray’s Applied Photographic OpticsDifferent types of autofocusTriangulation Rotating mirror sweeps thescene until the image is alignedwith fixed image from mirror M– pretty much stereovision andwindow correlation)From The Manual of PhotographyFrom Ray’s Applied Photographic OpticsFrom The Manual of PhotographyFrom Ray’s Applied Photographic Optics10

ContrastPhase detection focusing Focus highest contrast Used e.g. in 3.htmFrom The Manual of PhotographyPhase detection focusing Stereo vision from two portions of the lens on theDetectorperipheryIn focus Not at the equivalentphasefilm plane but fartherÎ can distinguishtoo far and too close Too close Look at the phasedifference betweenthe two imagesToo farFrom the Canon red bookAutofocus http://www.fredmiranda.com/forum/topic/241524When you half-press the shutter release, the activated AF sensor "looks" at theimage projected by the lens from two different directions (each line of pixels inthe array looks from the opposite direction of the other) and identifies the phasedifference of the light from each direction. In one "look," it calculates thedistance and direction the lens must be moved to cancel the phase differences. Itthen commands the lens to move the appropriate distance and direction andstops. It does not "hunt" for a best focus, nor does it take a second look after thelens has moved (it is an "open loop" system).If the starting point is so far out of focus that the sensor can't identify a phasedifference, the camera racks the lens once forward and once backward to find adetectable difference. If it can't find a detectable difference during that motion, itstops.Although the camera does not take a "second look" to see if the intended focushas been achieved, the lens does take a "second look" to ensure it has moved thedirection and distance commanded by the camera (it is a "closed loop" system).This second look corrects for any slippage or backlash in the lens mechanism,and can often be detected as a small "correction" movement at the end of thelonger initial movements.From The Manual of PhotographyMultiple focus sensorscompute phase difference,deduce distancesource arthur morris11

Lens actuatorssource: canon red bookUSMsource: canon red bookBokehThe Bokehreligion 04.shtmlBokeh Shape of out of focus kernel http://www.kenrockwell.com/tech/bokeh.htm12

landscape.com/essays/bokeh.shtmlcatadioptric (mirror)landscape.com/essays/bokeh.shtml500mm vivitar ( 100) http://www.digit-life.com/articles2/rubinar/13

500mm Canon (5k)Mirror lens14

http://www.digit-life.com/articles2/rubinar/ Can be interestingMacroMacro depth of field is shallowPhotoMontage Remember: shallowerwith smaller focusingdistance Combine multiple photosMacrophotography: Learning from a MasterMacro montageScanning: combination in 1 exposure ndex.html http://www.outbackphoto.com/workflow/wf 72/essay.html 55 images hereFrom Macro photography: Learning from a Master15

Macro is easy with small sensors 1/ minimum focusing distance is way smaller 2/ depth of field is bigger Summary: you've scaled down the camera, you cantake pictures of a scaled-down worldFake Depth ofFieldPoint in focussensorlensObject with texturelenssensorPoint in focusObject with texturePhotoshopPhotoshop Using layers: One sharp layer, one blurry layer (using Gaussianblur)(sharp masklayer) selects focus InputLayerBlurred layer Problem: halo around edgesMask of blurry layer)ResultPhotoshop lens blur Reverse-engineered algorithm: average over circle Size of circle depends on pseudo depth Discard pixels that are too much closerInputPhotoshop lens blur Filter Blur Lens blurInputDepth map (painted manually)Depth map (painted manually)Result16

Tilt/ShiftcameramovementsFrom Photography, London et al.From Photography, London et al.From Photography, London et al.From Photography, London et al.From Photography, London et al.17

Scheimpflug's ruleFrom Photography, London et al. Useful forlandscapeto getdepth offield fromforegroundto infinityFrom The Manual of Photography Useful forlandscapeto getdepth offield fromforegroundto infinityAnsel AdamsTilt-shift lens 35mm SLR versionFrom Photography, London et al.18

TiltOlivo Barbieri's model world.From Macro photography: Learning from a MasterOlivo Barbieri's model rtid id 1760Olivo Barbieri's model rtid 1760Related links By the way, here are a number of links to people doping similar 1/exhimertom.htmlhttp://www.arte.fi/media/gaal enkampwphr.htmmany of them inspired by BarbieriSee in particularhttp://hame.ca/tiltshift.htmfor many links and infoWavefrontcodingThe lensbaby is a recent popular tool to create related erAnd here is an interesting article that tells you how to achieve similareffects with akemodel/with interesting reflections about when it works(light quality, viewpoint)19

Wavefront codingWavefront coding CDM-Optics, U of Colorado, Boulder The worst title ever: "A New Paradigm for ImagingSystems", Cathey and Dowski, Appl. Optics, 2002 Improve depth of field using weird optics & deconvolution Idea: deconvolution to deblur out of focus regions Convolution filter (e.g. blur, sharpen) Sometimes, we can cancel a convolution by anotherconvolution– Like apply sharpen after blur (kind of)– This is called deconvolution Best studied in the Fourier domain (of course!)– Convolution multiplication of spectra– Deconvolution multiplication by inverse spectrumWavefront codingWavefront coding Idea: deconvolution to deblur out of focus regions Problem 1: depth of field blur is not shift-invariant– Depends on depth– Blur is not a convolution, hard to use deconvolution Problem 2: Depth of field blur "kills information"– Fourier transform of blurring kernel has lots of zeros– Deconvolution is ill-posed Idea: deconvolution to deblur out of focus regionsProblem 1: depth of field blur is not shift-invariantProblem 2: Depth of field blur "kills information"Solution: change optical system so that– Rays don't converge anymore– Image blur is the same for all depth– Blur spectrum does not have too many zerosRay version20

Other applicationImportant take-home idea Single-image depth sensing Optimize optical system so that blur depends A LOTon depthCoded imaging What the sensor records is not the image we want, it'sbeen coded (kind of like in cryptography) Image processing decodes itDepth from defocusDefocus fromfocus/defocus Pentland 8721

Depth from focus http://ieeexplore.ieee.org/xpl/freeabs all.jsp?isNumber 5032&arNumber 196282&isnumber 5032&arnumber 196282 http://www.ri.cmu.edu/pub files/pub1/xiong yalin 1993 1/xiong yalin 1993 1.pdfDefocus MattingDefocus mattingMorgan’s crazy camera With Morgan McGuire, Wojciech Matusik, HanspeterPfister, John “Spike” Hughes Data-rich: use 3 streams with different focusBut recall: field of view & focusing What happens to the field of view when one focuses closer?– It's reduced Must be compensated forfilmfilmfocused focusedatcloseinfinityPlenopticcamerarefocusing22

Plenoptic/light field cameras Lipmann 1908 Adelson and Wang, 1992 Revisited by Ng et al. for refocusingLinksDoF http://www.cs.mtu.edu/ shene/DigiCam/User-Guide/950/depth-of-field.html http://en.wikipedia.org/wiki/Depth of field html f-field.htm http://www.dofmaster.com/dof imagesize.html http://www.vanwalree.com/optics/dofderivation.html wsFinal/EDOF NewsLepSoc 2005summer.htm s/depth.html tanding-series/dof.shtml http://www.normankoren.com/Tutorials/MTF6.html http://www.photo.net/learn/optics/dofdigital/ http://www.juzaphoto.com/eng/articles/depth of field.htm DoF calculators– http://www.dofmaster.com/dofjs.html– http://www.dof.pcraft.com/dof.cgiAF http://www.juzaphoto.com/eng/articles/how autofocus works.htm ronics.howstuffworks.com/autofocus.htm23

3 Deriving depth of field Circle of confusion C, magnification m Simplification: m f/D Focusing distance D, focal length f, aperture N As usual, similar triangles f/N CD/f D d1 2 Deriving depth of field f/N CD/f D-d1 d1 Deriving depth of field f/NCD/f D d1 2 Deriving depth of field CD/f D d1 N2C2D2 term can often be neglecte