Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from...

60
Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2017 Lecture 22: Cameras & Lenses III

Transcript of Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from...

Page 1: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2017

Lecture 22:

Cameras & Lenses III

Page 2: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Depth of Field

Page 3: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Depth of Field

• Depth of field is the range of object depths that are rendered with acceptable sharpness in an image

From London and Upton

Page 4: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Circle of Confusion for Depth of Field

197

from subjects closer than “infinity”converge at a point in the focal plane.

Circle of confusionSince all lenses contain a certain amountof spherical aberration and astigmatism,they cannot perfectly converge rays from asubject point to form a true image point(i.e., an infinitely small dot with zero area).In other words, images are formed from acomposite of dots (not points) having acertain area, or size. Since the imagebecomes less sharp as the size of thesedots increases, the dots are called “circlesof confusion.” Thus, one way of indicatingthe quality of a lens is by the smallest dotit can form, or its “minimum circle ofconfusion.” The maximum allowable dotsize in an image is called the “permissiblecircle of confusion.”

Permissible circle of confusionThe largest circle of confusion which stillappears as a “point” in the image. Imagesharpness as sensed by the human eye isclosely related to the sharpness of theactual image and the “resolution” ofhuman eyesight. In photography, imagesharpness is also dependent on the degreeof image enlargement or projectiondistance and the distance from which theimage is viewed. In other words, inpractical work it is possible to determinecertain “allowances” for producing imageswhich, although actually blurred to acertain degree, still appear sharp to theobserver. For 35mm single lens reflexcameras, the permissible circle of confusionis about 1/1000~1/1500 the length of thefilm diagonal, assuming the image isenlarged to a 5”×7” (12 cm × 16.5 cm)print and viewed from a distance of 25~30cm/0.8~1 ft. EF lenses are designed toproduce a minimum circle of confusion of0.035 mm, a value on which calculationsfor items such as depth of field are based.

Depth of fieldThe area in front of and behind a focusedsubject in which the photographed imageappears sharp. In other words, the depth ofsharpness to the front and rear of thesubject where image blur in the focalplane falls within the limits of thepermissible circle of confusion. Depth offield varies according to the lens’ focallength, aperture value and shootingdistance, so if these values are known, arough estimate of the depth of field can becalculated using the following formulas:

Front depth of field = d·F·a2/(f2 + d·F·a)Rear depth of field = d·F·a2/(f2 — d·F·a)f: focal length F: F number d: minimumcircle of confusion diametera: subject distance (distance from thefirst principal point to subject)

If the hyperfocal distance is known, thefollowing formulas can also be used:In general photography, depth of field ischaracterised by the following attributes:! Depth of field is deep at short focallengths, shallow at long focal lengths." Depth of field is deep at smallapertures, shallow at large apertures.# Depth of field is deep at far shootingdistances, shallow at close shootingdistances.$ Front depth of field is shallowerthan rear depth of field.

Depth of focusThe area in front of and behind the focalplane in which the image can bephotographed as a sharp image. Depth offocus is the same on both sides of theimage plane (focal plane) and can bedetermined by multiplying the minimum

circle of confusion by the F number,regardless of the lens focal length. Withmodern autofocus SLR cameras, focusingis performed by detecting the state offocus in the image plane (focal plane)using a sensor which is both opticallyequivalent (1:1 magnification) andpositioned out of the focal plane, andautomatically controlling the lens to bringthe subject image within the depth offocus area.

Hyperfocal distanceUsing the depth of field principle, as alens is gradually focused to farthersubject distances, a point will eventuallybe reached where the far limit of therear depth of field will be equivalent to“infinity.” The shooting distance at thispoint, i,e., the closest shooting distanceat which “infinity” falls within the depthof field, is called the hyperfocal distance.The hyperfocal distance can bedetermined as follows:

Thus, by presetting the lens to thehyperfocal distance, the depth of field willextend from a distance equal to half thehyperfocal distance to infinity. Thismethod is useful for presetting a largedepth of field and taking snapshotswithout having to worry about adjustingthe lens focus, especially when using aw i d e - a n g l elens. (Forexample, whenthe EF 20mmf/2.8 USM is setto f/16 and thes h o o t i n gdistance is setto the hyperfocal distance of ap-proximately 0.7m/2.3ft, all subjects withina range of approximately 0.4m/1.3ft fromthe camera to infinity will be in focus.)

Figure-15 Relationship Between the Ideal FocalPoint and the Permissible Circle ofConfusion and Depth of Field

Figure-16 Depth of Field and Depth of Focus

Photo-1 Hyperfocal Length SetCondtion

Hyperfocaldistance =

f2 f: focal length F: F number

d•F number d: minimum circle of confusion diameter

Figure-17 Relationship Between Depth ofFocus and Aperture

Lens Ideal focal point

Depth of focus

Front depthof field Rear depth

of field

Permissible circle of confusion

Near point limiting�distance =

hyperfocal distance ×shooting distance�

hyperfocal distance +�shooting distancehyperfocal distance ×shooting distance�

hyperfocal distance -�shooting distance

(Shooting distance: Distance from focal plane to subject)

Far point limiting�distance =

Depth of field Depth of focus

Minimum circle of confusion

Far point Near point

Reardepthof field

Front depth of field

Near point distance

Far point distance

Subject distance

Shooting distance

Focal plane

Reardepthof focus

Frontdepth offocus

Imagedistance

50mm f/1.8

f/1.8

Aperture

Depth of focus at�maximum aperture

Permissible�circle of confusion

f/5.6

Aperture

Depth of�focus at f/5.6

Permissible�circle of confusion

[Canon, EF Lens Work III]

Set circle of confusion as the maximum permissible blur spot on the image plane that will appear sharp under final viewing conditions

• For printed photographs from 35mm film, 0.025mm (on negative) is typical

• For digital image sensors, 1 pixel is typical (e.g. 1.4 micron for phones)

• Larger if intended for viewing at web resolution, or if lens is poor

Page 5: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Depth of Field

f f

DF

DN dN

dF

Depth of field Depth of focus

Circle of confusion, C

DS dS

A

DF =DSf2

f2 �NC(DS � f)DN =

DSf2

f2 +NC(DS � f)

DOF = DF �DN

dN � dSdN

=C

AdS � dF

dF=

C

A

N =f

D1

DF+

1

dF=

1

f1

DS+

1

dS=

1

f1

DN+

1

dN=

1

f

N =f

A

dN � dSdN

=C

AdS � dF

dF=

C

A

N =f

D1

DF+

1

dF=

1

f1

DS+

1

dS=

1

f1

DN+

1

dN=

1

f

Page 6: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

DOF Demonstration

http://graphics.stanford.edu/courses/cs178/applets/dof.html

Page 7: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Hyperfocal Distance

The focus distance that maximizes the depth of field (such that infinity is at limit of acceptable sharpness)

H H/2

DF =DSf2

f2 �NC(DS � f)DN =

DSf2

f2 +NC(DS � f)

Hyperfocal DOF

Hyperfocal distance

As DF ! 1, DS = H =f2

NC+ f, DN =

H

2(Calculation omitted)

Page 8: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ansel Adams, M

ount William

son Clearing Storm

Page 9: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Other Focus / DOF Situations to Consider

• How does sensor size affect defocus blur and DOF?

• E.g. consider cell phone vs 35mm format sensors

• For a given lens & f-stop, how does moving closer/further from the subject (and adjusting focus onto subject) affect defocus / DOF of other objects?

• In 1:1 macro, does focal length affect DOF?

• What is the lens-sensor separation for hyperfocal condition, for full-resolution viewing vs web-resolution viewing?

If you understand these, you understand lenses!

Page 10: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Bokeh

Page 11: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Bokeh

Bokeh is the shape and quality of out-of-focus blur

• For small, out-of-focus lights, bokeh takes on the shape of the lens aperture

M Yashna, flickr, 40m

m f/3.0

Page 12: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Bokeh

Heart-shaped bokeh?

diyphotography.net

Page 13: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

BokehDino Q

uinzani, Leica Noctilux 50mm

, f/0.95

Why does the bokeh vary across the image?

Page 14: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

The Psychological Effect of Shallow Depth of Field

Page 15: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Dr. Joanne Liu, the president of Doctors without Borders, spoke on 10/7/15 in Geneva. Denis Balibouse/Reuters

Page 16: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Hillary Clinton spoke during a campaign event at Cornell College in Mount Vernon, Iowa, on 10/7/15. Scott Morgan/Reuters

Page 17: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle
Page 18: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

https://www.youtube.com/watch?v=W5cbk0xVnzA

Page 19: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Exposure

Page 20: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Exposure

• H = T x E

• Exposure = time x irradiance

• Exposure time (T)

• Controlled by shutter (discussed last lecture)

• Irradiance (E)

• Power of light falling on a unit area of sensor

• Controlled by f-stop (aperture and focal length)

Page 21: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Exposure Controls in Photography

Aperture size

• Change the f-stop by opening / closing the aperture (if camera has iris control)

Shutter speed

• Change the duration the sensor pixels integrate light

ISO gain

• Change the amplification (analog and/or digital) between sensor values and digital image values

Page 22: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Constant Exposure: F-Stop vs Shutter Speed

1.4 2.0 2.8 4.0 5.6 8.0 11.0 16.0 22.0 32.0

1/500 1/250 1/125 1/60 1/30 1/15 1/8 1/4 1/2 1

F-Stop

Shutter

Example: these pairs of aperture and shutter speed give equivalent exposure

If the exposure is too bright/dark, may need to adjust f-stop and/or shutter up/down.

Page 23: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

f / 41/125 sec

f / 111/15 sec

f / 321/2 sec

Constant Exposure: Depth of Field vs Motion Blur

• Photographers must trade off depth of field and motion blur for moving subjects

Page 24: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Shallow Depth of Field Can Create a Stronger Image

From Peterson, Understanding Exposure 200mm, f/4, 1/1000 (left) and f/11, 1/125 (right)

Page 25: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Motion Blur Can Help Tell The Story

From Peterson, Understanding Exposure 1/60, f/5.6, 180mm

Page 26: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Fastest Photography Lens F-Stop?

Hari Subramanyam, https://www.flickr.com/photos/dementedjesus/

Leica Noctilux-M 50mm f/0.95 ASPH Lens

Page 27: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

ISO (Gain)

Third variable for exposure Film: trade sensitivity for grain Digital: trade sensitivity for noise

• Multiply signal before analog-to-digital conversion

• Linear effect (ISO 200 needs half the light as ISO 100)

More on this in a later lecture.

Page 28: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

ISO Gain vs Noise in Canon T2iCredit: bobatkins.com

Page 29: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Real Compound Lenses

Page 30: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Recall: Snell’s Law of Refraction

⌘i sin ✓i = ⌘t sin ✓t

Page 31: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Recall: Snell’s Law of Refraction

~n!i

!t

⌘i sin ✓i = ⌘t sin ✓t

Vacuum Air (sea level) Water (20°C) Glass Diamond

1.0 1.00029 1.333 1.5-1.6 2.42

⌘Medium *

* index of refraction is wavelength dependent (these are averages)

Page 32: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Real Refraction Through A Lens Is Not Ideal – Aberrations

Real plano-convex lens (spherical surface shape). Lens does not converge rays to a point anywhere.

���

����

����.

������

���

����

����

������

������

����

syste

m.�

emostc

lassical

exam

pleof

thismight

bethehisto

rical

sequ

ence

ofim

prove-

ments

intheoriginal

photograph

icob

jective,

aland

scapelens

desig

nedby

Wollasto

nin

����

[Kingslake

����].Itconsisted

ofasin

gle-elem

entm

enisc

uslens

with

concavesid

eto

anaperture

stop.

In����,C

hevalierimproved

thedesig

nby

splittin

gthemenisc

usinto

acementeddo

ubletc

ompo

sedof

a�int

glasslens

andacrow

nglasslens.Finally,in����,

Dallm

eyer

split

thec

rownlens

again,

placingon

eoneither

sideo

fthe

central�

intlens.

Todaytheprocesso

fcorrectingaberratio

nsby

combining

glasse

lementshasb

eencar-

riedtoremarkablee

xtremes.Z

oom

lensesprovidep

erhaps

them

ostd

ramaticillustrationof

Figure

�.�:Spheric

alaberratio

n.

thisph

enom

enon

.Zoo

mingalens

requ

iresa

non-lin

ears

hi�

ofatleastthree

grou

psof

lens

elem

entsrelativ

etoon

eano

ther,

makingitvery

challeng

ingto

maintainareason

able

levelo

faberratio

ncorrectio

nover

thez

oom

range.How

ever,the

con-

venience

oftheoriginalzoom

syste

msw

asso

desir

ablethatit

quicklylaun

ched

anintenseresearch

e�ortthatled

totheex-

trem

elysoph

isticated,b

utcomplex

desig

nform

sthat

wesee

today[M

ann����].Asa

nexam

ple,commod

ity��

mm

zoom

lenses

containno

fewer

than

��di�erent

glasselem

ents,and

somehave

asmanyas

��[D

ickerson

andLepp

����]!

Today,

allm

odernlens

desig

nworkiscompu

ter-aided[Smith

����],

where

desig

nform

sareiterativ

elyop

timized

byacompu

ter.

One

reason

forthe

largen

umbersof

lens

elem

entsisthatthey

provideg

reaterdegreeso

ffreedom

forthe

optim

izertoachieve

thed

esire

dop

ticalqu

ality

[Kingslake

����].

�ischapterintrod

uces

anew

pure-so�

wareapproach

tocompensatingforlens

aberratio

nsa�

ertheph

otograph

istaken.

�isapproach

complem

entstheclassic

alop

tical

tech-

niqu

es.�

ecentralcon

cept

issim

ple:sin

cealight

�eld

camerarecordsthe

light

traveling

alon

gallraysinsidethecamera,wecanusethecompu

tertore-sortaberrated

rays

oflight

towhere

they

shou

ldideally

have

converged.

Digita

lcorrectionof

thiskind

improves

the

quality

of�n

alim

ages

byredu

cing

resid

ualaberrations

presentinanygivenop

ticalrecipe.

Fors

implicity,thisc

hapter

assumes

alight

�eld

cameracon�

guredwith

theplenop

tic

Page 33: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Real Lenses vs Ideal Thin Lenses

• Theoretical abstraction • Assume all rays refract at a

plane & converge to a point • Quick and intuitive

calculation of main imaging effects

• Real optical system • Multiple physical elements

in compound design • Optical aberrations

prevent rays from converging perfectly

ilovephotography.com

Page 34: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Modern Lens Designs Are Highly Complexilovephotography.com

Photographic lens cross section

Page 35: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Modern Lens Designs Are Highly Complex

4 element mobile phone lens (on 24x36mm sensor)

ilovehatephoto.com

Page 36: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Modern Lens Designs Are Highly Complex[Apple]

Page 37: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Modern Lens Designs Are Highly ComplexZeiss flickr.com

account

Microscope objective

Page 38: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Example Lens Formula: Double Gauss

Radius (mm) Thick (mm) nd V-no Aperture (mm)

58.950 7.520 1.670 47.1 50.4

169.660 0.240 50.4

38.550 8.050 1.670 47.1 46.0

81.540 6.550 1.699 30.1 46.0

25.500 11.410 36.0

9.000 34.2

–28.990 2.360 1.603 38.0 34.0

81.540 12.130 1.658 57.3 40.0

–40.770 0.380 40.0

874.130 6.440 1.717 48.0 40.0

–79.460 72.228 40.0

Data from W. Smith, Modern Lens Design, p 312

Page 39: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Ray Tracing Through Real Lens Designs

From Kolb, Mitchell and Hanrahan (1995)

200 mm telephoto

50 mm double-gauss

35 mm wide-angle

16 mm fisheye

Page 40: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Ray Tracing Through Real Lens Designs

200 mm telephoto

Notice shallow depth of field (out of focus background)

Page 41: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Ray Tracing Through Real Lens Designs

16 mm fisheye

Notice distortion in the corners (straight lines become curved)

Page 42: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Ray Tracing Real Lens Designs

Monte Carlo approach

• At every sensor pixel, compute integral of rays incident on pixel area arriving from all paths through the lens

Algorithm (for a pixel)

• Choose N random positions in pixel

• For each position x’, choose a random position on the back element of the lens x’’

• Trace a ray through from x’ to x’’, trace refractions through lens elements until it misses the next element (kill ray) or exits the lens (path trace through the scene)

• Weight each ray according to radiometric calculation on next slide to estimate irradiance E(x’)

x

0

x

00

Page 43: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Radiometry for Tracing Lens Designs

P P’

x’

xs

Figure 5: To trace a ray from through a thick lens, a point onthe exit pupil is chosen. The point of intersection of the ray fromto with is found, and is then translated parallel to the axis to .The ray from this point through , the image of , is then used tosample the scene.

4 Radiometry and SamplingIn this section we describe how we compute exposure on the filmplane.

4.1 Exposure

Sensor response is a function of exposure, the integral of the irra-diance at a point on the film plane over the time that the shutteris open. If we assume that irradiance is constant over the exposureperiod, and that exposure time is fixed,

(4)

where is the irradiance at , is the exposure duration, andis the exposure at . This model is a simplification of the

exposure process in physical systems, where the exposure at a pointis dependent upon the shape and movement of the shutter.

In order to compute , we integrate the radiance at overthe solid angle subtended by the exit pupil, which is represented asa disk, as shown in Figure 6.

(5)

If the film plane is parallel to the disk, this can be rewritten as

(6)

where is the axial distance from the film plane to the disk. Thisformula differs from that described by Cook et al., which assumedeach ray has the same weight. It is also important to perform the in-tegral using a disc-shaped exit pupil, rather than a rectangular one.Using a rectangular pupil causes the depth of field to be computedincorrectly, since points not in focus will then have rectangular “cir-cles” of confusion on the film plane.

The weighting in the irradiance integral leads to variation in irra-diance across the film plane due to the lens system. There are twosimple analytical ways to estimate this effect: the law and thedifferential form factor to a disk.

1. If the exit pupil subtends a small solid angle from , can beassumed to be constant and equal to the angle between andthe center of the disk. This allows us to simplify (5) to:

(7)

r

Z

x’

xdA

a

’’’’

θ’

L(x’’, x’)

θ’’

Figure 6: Geometry for computing the irradiance at a point on thefilm plane and the exact form factor.

where is the axial distance from the film plane to the disk,and is the area of the disk. If is assumed to be the focallength, (7) can be written

(8)

where is the f-number of the lens. Equation (7) is the onemost often found in optics texts, while (8) appears in manyphotographic texts. Note that both assume a small solid angle.

2. For larger solid angles, a more accurate way to estimate thevariation in irradiance is to compute the differential form fac-tor from a point on the film plane to a disk. This correctly ac-counts for the finite size of the disk, and the variation in angleas we integrate over the disk. This integral may be computedanalytically[4] (an elegant derivation may be found in [8]).

(9)

In real lens systems these analytical formulas overestimate theexposure. This is due to vignetting, the blocking of light by lens el-ements other than the aperture stop when a ray passes through thesystem at a large angle to the axis. Vignetting can be a significanteffect in wide-angle lenses and when using a lens at full aperture.Fortunately, the ray tracing algorithm described in the last sectionaccounts for this blockage, and hence computes the exposure cor-rectly.

Figure 7 compares the irradiance computed by tracing raysthrough the lens system pointed at a uniform radiance field with

5 10 15Distance from center (mm)

0.05

0.10

0.15

0.20

Irra

dian

ce (W

/m^2

)

StandardForm factorcos^4Vignetted

Figure 7: Irradiance on the film plane resulting from a uniform unitradiance field imaged through the double-Gauss lens at full aperture,as a function of distance from the center of the film.

E(x

0) =

Z

x

002D

L(x

00 ! x

0)

cos ✓

0cos ✓

00

||x00 � x

0||2 dA00

=

1

Z

2

Z

x

002D

L(x

00 ! x

0) cos

4✓dA

00

Sensor Plane

Back element of lens

E(x

0) =

Z

x

002D

L(x

00 ! x

0)

cos ✓

0cos ✓

00

||x00 � x

0||2 dA00

=

1

Z

2

Z

x

002D

L(x

00 ! x

0) cos

4✓dA

00

Page 44: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Connection to Thin Lens Model

Page 45: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

f =?

R1 R2

nA nL

Assume: • Lens has negligible thickness • Ray is very close to axis (paraxial) • All angles are small, so

What is the focal length?

sin� ⇡ tan� ⇡ �

Spherical Lens & Paraxial Approximation

Page 46: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

✓1

✓2

h

R1

(1) nA sin↵ = nL sin ✓1 (Snell’s Law)

(2) ✓1 = ↵� ✓2

=) (3) nA↵ ⇡ nL(↵� ✓2) (Paraxial approx.)

(4) ↵ ⇡ h/R1 (Paraxial approx.)

Spherical Lens & Paraxial Approximation

Page 47: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

✓2✓3

✓4

� ✓end

✓2

h

R2 f =?(5) nL sin ✓3 = nA sin ✓4 (Snell’s Law)

(6) ✓3 = ✓2 + �

(7) ✓4 = � + ✓end

=) (8) nL(✓2 + �) ⇡ nA(� + ✓end) (Paraxial approx.)

(9) � ⇡ �h/R2 (Paraxial approx; note sign �R2)

(10) ✓end ⇡ h/f (Paraxial approx.)

Spherical Lens & Paraxial Approximation

Page 48: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

f =?

R1 R2

nA nL

h

Spherical Lens & Paraxial Approximation

(3, 8) =) (11) ✓end ⇡ (nL/nA � 1)(↵+ �)

(subst. 4,9,10 into 11) =) (12)

h

f=

✓nL

nA� 1

◆✓h

R1� h

R2

(h factors out, applies to all paraxial rays)(13)

1

f=

✓nL

nA� 1

◆✓1

R1� 1

R2

h factors out; applies to all paraxial rays

Page 49: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Lens Maker’s Equation

f =?

R1 R2

nA nL

1

f=

✓nL

nA� 1

◆✓1

R1� 1

R2

f, R1 and R2 are signed quantities, positive pointing to the right; radii point from surface to center.

Page 50: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Lens Maker’s Equation – Convex / Concave

1

f=

✓nL

nA� 1

◆✓1

R1� 1

R2

R1 < 0

R2 > 0

f < 0

R1 > R2 > 0

f < 0

R1 > 0

R2 < 0

f > 0

R1 < 0

R2 < R1 < 0

f < 0

f, R1 and R2 are signed quantities, positive pointing to the right; radii point from surface to center.

Page 51: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Thick Lens Approximation

Approximate a complex optical system by a “thick lens” where idealized refraction occurs at two “principal planes”, one each for forward and backward propagation. Characterize lens by just few parameters.

[Smith]

Page 52: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Things to Remember

Effect Cause Field of view Sensor size, focal length Depth of field Aperture, focal length, object dist. Exposure Aperture, shutter, ISOMotion blur ShutterGrain/noise ISO

Pinholes and lenses form perspective images Perspective composition, dolly zoom

Page 53: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Things to Remember

Ideal thin lenses

• Paraxial approximation, lens maker equation

• Thin lens equation, various applications

• Focusing, defocus blur, depth of field, hyperfocal Ray-tracing optical designs for real compound lenses

• Monte Carlo ray-tracing of train of optical elements

• Defocus blur, optical aberrations, bokeh

Page 54: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Acknowledgments

Many thanks to Marc Levoy, Pat Hanrahan, Matt Pharr and Joyce Farrell for presentation resources.

Page 55: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Extra

Page 56: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Auto Focus

Page 57: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Contrast Detection Autofocus

A target object is imaged through the lens to an image patch on the sensor. The contrast of this image patch is high if the object is in focus, low otherwise. The physical focus of the lens is adjusted until the contrast of this image patch is maximized. Many ways to estimate how in-focus the image patch is: gradient, Sum Modified Laplacian (Nayar), variance…

https://graphics.stanford.edu/courses/cs178-10/applets/autofocusCD.html

Demo (Levoy, Willet, Adams)

Page 58: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Phase Detection Autofocus

Ray bundles from a target object converge to points at different depths in the camera depending on the lens focus. In a phase detection AF system ray bundles passing through different portions of the lens (red and green shown) are brought to focus on separate lenslets with separate AF sensors. Depending on depth of focus point, the ray bundles converge to different positions on their respective AF sensors (see interactive demo). A certain spacing (disparity) between these images is “in focus” https://graphics.stanford.edu/courses/cs178-10/applets/autofocusPD.html

Demo (Levoy, Willet, Adams)

Page 59: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Phase Detection AF Used in DSLRs

• Distance between phase-detect images correlates to distance in focus to target object (allows “jumping” to the right focus)

• Separate AF units cannot be used with “live view” or video recording

[Canon]

Page 60: Lecture 22: Cameras & Lenses III...enlarged to a 5”×7” (12 cm × 16.5 cm) print and viewed from a distance of 25~30 cm/0.8~1 ft. EF lenses are designed to produce a minimum circle

Ren NgCS184/284A

Phase Detection Pixels Embedded in Sensor

• Modern image sensors have small pixels, and may embed phase detection pixels directly into sensor image arrays

Canon