1 of 98

Nima Kalantari

CSCE 448/748 - Computational Photography

Coded Exposure and Aperture

Many Slides from Rob Fergus, Raskar et al., and Levin et al.

2 of 98

Different types of blur

  • Camera shake
    • User moving hands
  • Scene motion
    • Objects in the scene moving
  • Defocus blur
    • Depth of field effects

3 of 98

Different types of blur

  • Camera shake
    • User moving hands
  • Scene motion
    • Objects in the scene moving
  • Defocus blur
    • Depth of field effects

4 of 98

Let’s take a photo

Blurry result

5 of 98

Slow-motion replay

6 of 98

Slow-motion replay

Motion of camera

7 of 98

Image formation process

=

Blurry image

Sharp image

Blur �kernel

Convolution�operator

8 of 98

Different types of blur

  • Camera shake
    • User moving hands
  • Scene motion
    • Objects in the scene moving
  • Defocus blur
    • Depth of field effects

9 of 98

Different types of blur

  • Camera shake
    • User moving hands
  • Scene motion
    • Objects in the scene moving
  • Defocus blur
    • Depth of field effects

10 of 98

Blurring

==

Convolution

Sync Function

11 of 98

Different types of blur

  • Camera shake
    • User moving hands
  • Scene motion
    • Objects in the scene moving
  • Defocus blur
    • Depth of field effects

12 of 98

Different types of blur

  • Camera shake
    • User moving hands
  • Scene motion
    • Objects in the scene moving
  • Defocus blur
    • Depth of field effects

13 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Focal plane

14 of 98

Lens and defocus

Lens

Object

Camera sensor

Point spread function

Focal plane

15 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Object

Focal plane

16 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Object

Focal plane

17 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Object

Focal plane

18 of 98

DoF & aperture

  • http://www.juzaphoto.com/eng/articles/depth_of_field.htm

f/2.8

f/32

19 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Image of a point light source

Focal plane

�Lens’ aperture �

20 of 98

Lens and defocus

Lens

Object

Camera sensor

Point spread function

Image of a defocused point light source

�Lens’ aperture �

Focal plane

21 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Image of a defocused point light source

Object

�Lens’ aperture �

Focal plane

22 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Image of a defocused point light source

�Lens’ aperture �

Object

Focal plane

23 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Image of a defocused point light source

�Lens’ aperture �

Object

Focal plane

24 of 98

Blurring

==

Convolution

Sync Function

25 of 98

Blurring

==

Convolution

Traditional Camera: Box Filter

Sync Function

26 of 98

Coded exposure (flutter shutter)

27 of 98

Traditional Camera

Shutter is OPEN

28 of 98

Our Camera

Flutter Shutter

29 of 98

Shutter is OPEN and CLOSED

30 of 98

Comparison of Blurred Images

31 of 98

Implementation

Completely Portable

32 of 98

Lab Setup

33 of 98

Blurring

==

Convolution

Traditional Camera: Box Filter

Sync Function

34 of 98

Flutter Shutter: Coded Filter

Preserves High Frequencies!!!

35 of 98

Comparison

36 of 98

Inverse Filter Unstable

Inverse Filter stable

37 of 98

Short Exposure

Long Exposure

Coded Exposure

Ground Truth

Matlab Lucy

Our result

38 of 98

Are all codes “good”?

Alternate

All ones

Random

Our Code

39 of 98

License Plate Retrieval

40 of 98

License Plate Retrieval

41 of 98

Removing Camera Shake

42 of 98

Removing Camera Shake

43 of 98

Image and Depth from a Conventional Camera with a Coded Aperture

Anat Levin, Rob Fergus, Frédo Durand, William Freeman

MIT CSAIL

44 of 98

Single input image:

Output #1: Depth map

45 of 98

Single input image:

Output #1: Depth map

Output #2: All-focused image

46 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Image of a point light source

Focal plane

�Lens’ aperture �

47 of 98

Lens and defocus

Lens

Object

Camera sensor

Point spread function

Image of a defocused point light source

�Lens’ aperture �

Focal plane

48 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Image of a defocused point light source

Object

�Lens’ aperture �

Focal plane

49 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Image of a defocused point light source

�Lens’ aperture �

Object

Focal plane

50 of 98

Lens and defocus

Lens

Camera sensor

Point spread function

Image of a defocused point light source

�Lens’ aperture �

Object

Focal plane

51 of 98

Depth and defocus

Depth from defocus:

Infer depth by analyzing local scale of defocus blur

Out of focus

In focus

ill posed

52 of 98

Challenges

  • Hard to discriminate a smooth scene from defocus blur

  • Hard to undo defocus blur

Input

Ringing with conventional deblurring algorithm

Out of focus

?

53 of 98

Outline

  • Deblurring with prior
    • For generating all in focus
  • Coded aperture
    • For estimating depth

54 of 98

Outline

  • Deblurring with prior
    • For generating all in focus
  • Coded aperture
    • For estimating depth

55 of 98

?

=

Deconvolution is ill posed

56 of 98

Deconvolution is ill posed

?

=

=

?

Solution 1:

Solution 2:

57 of 98

Idea 1: Natural images prior

Image

gradient

put a penalty on gradients

Natural images have sparse gradients

Natural

Unnatural

What makes images special?

58 of 98

Deconvolution with prior

_

2

+

_

+

2

?

?

Convolution error

Derivatives prior

High

Low

Equal convolution error

59 of 98

Comparing deconvolution algorithms

Input

Richardson-Lucy

(Non blind) deconvolution code available online: http://groups.csail.mit.edu/graphics/CodedAperture/

Gaussian prior

“spread” gradients

Sparse prior

“localizes” gradients

60 of 98

Comparing deconvolution algorithms

Input

Richardson-Lucy

(Non blind) deconvolution code available online: http://groups.csail.mit.edu/graphics/CodedAperture/

Gaussian prior

“spread” gradients

Sparse prior

“localizes” gradients

61 of 98

Outline

  • Deblurring with prior
    • For generating all in focus
  • Coded aperture
    • For estimating depth

62 of 98

Outline

  • Deblurring with prior
    • For generating all in focus
  • Coded aperture
    • For estimating depth

63 of 98

DoF & aperture

  • http://www.juzaphoto.com/eng/articles/depth_of_field.htm

f/2.8

f/32

64 of 98

Defocus as local convolution

Input defocused image

Calibrated blur kernels at different depths

65 of 98

Defocus as local convolution

Depth k=1:

Depth k=2:

Depth k=3:

Input defocused image

Local �sub-window

Calibrated blur kernels at depth

Sharp �sub-window

66 of 98

Overview

Correct scale

Smaller scale

Larger scale

Try deconvolving local input windows with different scaled filters:

Somehow: select best scale.

?

?

?

67 of 98

Challenge

  • Hard to identify correct scale:

?

?

Correct scale

Smaller scale

?

Larger scale

68 of 98

Idea 2: Coded Aperture

  • Mask (code) in aperture plane

- make defocus patterns different from natural images and easier to discriminate

Conventional �aperture

Our coded aperture

69 of 98

Solution: lens with occluder

Lens

Camera sensor

Point spread function

Object

Focal plane

70 of 98

Solution: lens with occluder

Lens with coded aperture

Camera sensor

Point spread function

Image of a defocused point light source

�Aperture pattern�

Object

Focal plane

71 of 98

Solution: lens with occluder

Lens with coded aperture

Camera sensor

Point spread function

Image of a defocused point light source

�Aperture pattern�

Object

Focal plane

72 of 98

Solution: lens with occluder

Lens with coded aperture

Camera sensor

Point spread function

Image of a defocused point light source

�Aperture pattern�

Object

Focal plane

73 of 98

Solution: lens with occluder

Lens with coded aperture

Camera sensor

Point spread function

Image of a defocused point light source

�Aperture pattern�

Object

Focal plane

74 of 98

Solution: lens with occluder

Lens with coded aperture

Camera sensor

Point spread function

Image of a defocused point light source

�Aperture pattern�

Object

Focal plane

75 of 98

Why coded?

Conventional

Coded

Coded aperture- reduce uncertainty in scale identification

Correct scale

Smaller scale

Larger scale

76 of 98

Filter Design

Sampled aperture patterns

Conventional aperture

More discrimination between scales

Score

Less discrimination between scales

See paper for details

Analytically search for a pattern maximizing discrimination between images at different defocus scales (KL-divergence)

Account for image prior and physical constraints

77 of 98

78 of 98

79 of 98

Depth results

80 of 98

Input

Local depth estimation

Regularized depth

Regularizing depth estimation

_

2

+

Convolution error

Derivatives prior

Try deblurring with 10 different aperture scales

Keep minimal error scale in each local window

+ regularization

81 of 98

Input

Local depth estimation

Regularized depth

Regularizing depth estimation

82 of 98

Sometimes, manual intervention

Input

After user corrections

Regularized depth

Local depth estimation

83 of 98

All focused results

84 of 98

Input

85 of 98

All-focused (deconvolved)

86 of 98

Close-up

Original image

All-focus image

87 of 98

Input

88 of 98

All-focused (deconvolved)

89 of 98

Close-up

Original image

All-focus image

Naïve sharpening

90 of 98

Comparison- conventional aperture result

Ringing due to wrong scale estimation

91 of 98

Comparison- coded aperture result

92 of 98

Application: Digital refocusing from a single image

93 of 98

Application: Digital refocusing from a single image

94 of 98

Application: Digital refocusing from a single image

95 of 98

Application: Digital refocusing from a single image

96 of 98

Application: Digital refocusing from a single image

97 of 98

Application: Digital refocusing from a single image

98 of 98

Application: Digital refocusing from a single image