computational photography and image manipulation cmpt 469 ...yagiz/cpim/2019-cpim-04-hdr.pdf ·...

88
Computational Photography and Image Manipulation CMPT 469 / 985, Fall 2019 Week 4 High Dynamic Range Imaging 1

Upload: others

Post on 16-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Computational Photography and Image ManipulationCMPT 469 / 985, Fall 2019

Week 4

High Dynamic Range Imaging

1

Page 2: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Slide credits

• Slides thanks to Ioannis Gkioulekas along with his acknowledgements.

2

Page 3: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

• Programming assignment 1 is released on the course website and CourSys• Deadline: October 8

• Our TA, Sicong Tang, has office hours on Mondays between 3-4pm at TASC8004

• October 1: Field trip to CS Research Day, link sent as news item on CourSys

• P2 papers – presentations on October 3, Thursday• Isola et al., Crisp Boundary Detection Using Pointwise Mutual Information, ECCV 2014

• Presentation:• Discussion:

• Raskar et al., Coded Exposure Photography: Motion Deblurring using Fluttered Shutter, SIGGRAPH 2006• Presentation:• Discussion:

3

Page 4: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

• P3 papers – presentations on October 8, Tuesday• Heide et al., FlexISP: A Flexible Camera Image Processing Framework,

SIGGRAPH Asia 2014• Presentation:

• Discussion:

• Hasinoff et al., Burst photography for high dynamic range and low-light imaging on mobile cameras, SIGGRAPH Asia 2016• Presentation:

• Discussion:

• Sen et al., Robust Patch-Based HDR Reconstruction of Dynamic Scenes, SIGGRAPH Asia 2012• Presentation:

• Discussion:

4

Page 5: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

1500

1

25,000

400,000

2,000,000,000

The world has a high dynamic range

5

Page 6: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

The world has a high dynamic range

10-6 106

adaptation range of our eyes

common real-world scenes

6

Page 7: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

(Digital) sensors also have a low dynamic range

10-6 106

adaptation range of our eyes

common real-world scenes

10-6 106

sensor

7

Page 8: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

(Digital) images have an even lower dynamic range

10-6 106

adaptation range of our eyes

common real-world scenes

10-6 106image

low exposure

8

Page 9: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

(Digital) images have an even lower dynamic range

10-6 106

adaptation range of our eyes

common real-world scenes

10-6 106image

high exposure

9

Page 10: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Our devices do not match the real world• 10:1 photographic print (higher for glossy paper)

• 20:1 artist's paints

• 200:1 slide film

• 500:1 negative film

• 1000:1 LCD display

• 2000:1 digital SLR (at 12 bits)

• 100000:1 real world

Two challenges:

1. HDR imaging – which parts of the world do we include in the 8-14 bits available to our device?

2. Tonemapping – which parts of the world do we display in the 4-10 bits available to our device?10

Page 11: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

High dynamic range imaging

11

Page 12: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

12

Page 13: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

13

Page 14: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

14

Page 15: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

15

Page 16: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Slide credits

16

Page 17: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

17

Page 18: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Key idea

1. Exposure bracketing: Capture multiple LDR images at different exposures

2. Merging: Combine them into a single HDR image

18

Page 19: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Key idea

1. Exposure bracketing: Capture multiple LDR images at different exposures

2. Merging: Combine them into a single HDR image

19

Page 20: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Ways to vary exposure1. Shutter speed

2. F-stop (aperture, iris)

3. ISO

4. Neutral density (ND) filters

20

Page 21: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Ways to vary exposure1. Shutter speed

– Range: about 30 sec to 1/4000 sec (6 orders of magnitude)– Pros: repeatable, linear– Cons: noise and motion blur for long exposure

2. F-stop (aperture, iris)– Range: about f/0.98 to f/22 (3 orders of magnitude)– Pros: fully optical, no noise– Cons: changes depth of field

3. ISO– Range: about 100 to 1600 (1.5 orders of magnitude)– Pros: no movement at all– Cons: noise

4. Neutral density (ND) filters– Range: up to 6 densities (6 orders of magnitude)– Pros: works with strobe/flash– Cons: not perfectly neutral (color shift), extra glass (interreflections, aberrations),

need to touch camera (shake)21

Page 22: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Exposure bracketing with shutter speed

Note: shutter times usually obey a power series – each “stop” is a factor of 2

1/4, 1/8, 1/15, 1/30, 1/60, 1/125, 1/250, 1/500, 1/1000 sec

usually really is

1/4, 1/8, 1/16, 1/32, 1/64, 1/128, 1/256, 1/512, 1/1024 sec

Questions:

1. How many exposures?

2. What exposures?

Answer: Depends on the scene, but a good default is 5 exposures, the metered exposure and +/- 2 stops around that.

22

Page 23: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Key idea

1. Exposure bracketing: Capture multiple LDR images at different exposures

2. Merging: Combine them into a single HDR image

23

Page 24: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

The image processing pipeline

The sequence of image processing operations applied by the camera’s image signal processor (ISP) to convert a RAW image into a “conventional” image.

analog front-end

RAW image (mosaiced,

linear, 12-bit)white

balanceCFA

demosaicingdenoising

color transforms

tone reproduction

compressionfinal RGB

image (non-linear, 8-bit)

24

Page 25: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

The image processing pipeline

The sequence of image processing operations applied by the camera’s image signal processor (ISP) to convert a RAW image into a “conventional” image.

analog front-end

RAW image (mosaiced,

linear, 12-bit)white

balanceCFA

demosaicingdenoising

color transforms

tone reproduction

compressionfinal RGB

image (non-linear, 8-bit)

25

Page 26: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

RAW images have a linear response curve

when not over/under exposed

Colorchecker: Great tool for radiometric and color calibration.

Patches at bottom row have reflectance that increases linearly.

26

Page 27: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Over/under exposure

in shadows we are limited by noise

in highlights we are limited by clipping

27

Page 28: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

RAW (linear) image formation model

Exposure time:t5 t4 t3 t2 t1

Real scene radiance for image pixel (x,y): L(x, y)

What is an expression for the image Ilinear(x,y) as a function of L(x,y)?

Ilinear(x,y) = clip[ ti ⋅ L(x,y) + noise ]

How would you merge these images into an HDR one? 28

Page 29: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Merging RAW (linear) exposure stacks

t5 t4 t3 t2 t1

For each pixel:

1. Find “valid” images

2. Weight valid pixel values appropriately

3. Form a new pixel value as the weighted average of valid pixel values

29

Page 30: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Merging RAW (linear) exposure stacks

t5 t4 t3 t2 t1

For each pixel:

1. Find “valid” images

2. Weight valid pixel values appropriately

3. Form a new pixel value as the weighted average of valid pixel values

(noise) 0.05 < pixel < 0.95 (clipping)

valid

noise

clipped

30

Page 31: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Merging RAW (linear) exposure stacks

t5 t4 t3 t2 t1

For each pixel:

1. Find “valid” images

2. Weight valid pixel values appropriately

3. Form a new pixel value as the weighted average of valid pixel values

(noise) 0.05 < pixel < 0.95 (clipping)

(pixel value) / ti

31

Page 32: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Merging result (after tonemapping)

32

Page 33: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

What if I cannot use raw?

33

Page 34: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

The image processing pipeline

• Can you foresee any problem when we switch from RAW to rendered images?• How do we deal with the nonlinearities?

analog front-end

RAW image (mosaiced,

linear, 12-bit)white

balanceCFA

demosaicingdenoising

color transforms

tone reproduction

compressionfinal RGB

image (non-linear, 8-bit)

34

Page 35: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Radiometric calibration

The process of measuring the camera’s response curve. Can be two in three ways:

• Take images of scenes with different irradiance while keeping exposure the same.

• Takes images under different exposures while keeping irradiance the same.

• Takes images of scenes with different irradiance and under different exposures.

35

Page 36: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Same camera exposure, varying scene irradiance

Patches at bottom row have reflectance that increases linearly.

Colorchecker: Great tool for radiometric and color calibration.

Different values correspond to patches of increasing reflected irradiance.

36

Page 37: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Same scene irradiance, varying camera exposureColorchecker: Great tool for white balancing and radiometric calibration.

All points on (the white part of) the target have the same reflectance.

Different values correspond to images taken under increasing camera exposure.

kno

wn

exp

osu

re37

Page 38: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Varying both scene irradiance and camera exposureYou can do this using the LDR exposure stack itself

Same scene irradiance, different camera exposure

Same camera exposure, different scene irradiance

38

Page 39: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Non-linear image formation modelReal scene radiance for image pixel (x,y): L(x, y)

How would you merge the non-linear images into an HDR one?

Exposure time: ti

Ilinear(x,y) = clip[ ti ⋅ L(x,y) + noise ]

Inon-linear(x,y) = f[ Ilinear(x,y) ]

39

Page 40: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Non-linear image formation modelReal scene radiance for image pixel (x,y): L(x, y)

Use inverse transform to estimate linear image, then proceed as before

Exposure time: ti

Ilinear(x,y) = clip[ ti ⋅ L(x,y) + noise ]

Inon-linear(x,y) = f[ Ilinear(x,y) ] Iest(x,y) = f-1[ Inon-linear(x,y) ]

40

Page 41: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Linearization

Inon-linear(x,y) = f[ Ilinear(x,y) ]

Iest(x,y) = f-1[ Inon-linear(x,y) ]

41

Page 42: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Merging non-linear exposure stacks

1. Calibrate response curve

2. Linearize images

For each pixel:

3. Find “valid” images

4. Weight valid pixel values appropriately

5. Form a new pixel value as the weighted average of valid pixel values

(noise) 0.05 < pixel < 0.95 (clipping)

(pixel value) / ti

Same steps as in the RAW case.

42

Page 43: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Merging non-linear exposure stacks

1. Calibrate response curve

2. Linearize images

For each pixel:

3. Find “valid” images

4. Weight valid pixel values appropriately

5. Form a new pixel value as the weighted average of valid pixel values

(noise) 0.05 < pixel < 0.95 (clipping)

(pixel value) / ti

Same steps as in the RAW case.

Note: many possible weighting schemes43

Page 44: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Many possible weighting schemes“Confidence” that pixel is noisy/clipped

• We can derive optimal weights by modeling the sensor noise.

44

Page 45: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

What if I cannot measure response curve?

45

Page 46: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

You may find information in the image itself

If you cannot do calibration, take a look at the image’s EXIF data (if available).

Often contains information about tone reproduction curve and color space.

46

Page 47: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Tone reproduction curves

The exact tone reproduction curve depends on the camera.• Often well approximated as Lγ, for different values of the power γ (“gamma”).• A good default is γ = 1 / 2.2.

before gamma after gamma

If nothing else, take the square of your image to approximately remove effect of tone reproduction curve. 47

Page 48: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Relative vs absolute radianceFinal fused HDR image gives radiance only up to a global scale• If we know exact radiance at one point, we can convert relative HDR

image to absolute radiance map

HDR image (relative radiance)

spotmeter (absolute radiance at one point)

absolute radiance map 48

Page 49: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Basic HDR approach

1. Capture multiple LDR images at different exposures

2. Merge them into a single HDR image

Problem: Very sensitive to movement

• Scene must be completely static

• Camera must not move

Most modern automatic HDR solutions include an alignment step before merging exposures

49

Page 50: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

How do we store HDR images?

• Most standard image formats store integer 8-bit images• Some image formats store integer 12-bit or 16-bit images• HDR images are floating point 32-bit or 64-bit images

50

Page 51: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

How do we store HDR images?Use specialized image formats for HDR images

sign exponent mantissa

portable float map (.pfm)• very simple to implement

red green blue exponent

32 bits

Radiance format (.hdr)• supported by Matlab

sign exponent mantissa

OpenEXR format (.exr)• multiple extra features

51

Page 52: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Another type of HDR imagesLight probes: place a chrome sphere in the scene and capture an HDR image• Used to measure real-world illumination environments (“environment maps”)

Application: image-based relighting

52

Page 53: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Another way to create HDR images

Physics-based renderers simulate radiance maps (relative or absolute)

• Their outputs are very often HDR images

53

Page 54: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Tonemapping

54

Page 55: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

How do we display our HDR images?

10-6 106

adaptation range of our eyes

common real-world scenes

10-6 106image

10-6 106

HDR image

10-6 106display

55

Page 56: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Linear scalingScale image so that maximum value equals 1

Can you think of something better?

56

Page 57: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Photographic tonemapping

Apply the same non-linear scaling to all pixels in the image so that:• Bring everything within range → asymptote to 1• Leave dark areas alone → slope = 1 near 0

(exact formula more complicated)

HDR

HDRdisplay

I

II

1

• Photographic because designed to approximate film zone system.• Perceptually motivated, as it approximates our eye’s response curve.

57

Page 58: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

What is the zone system?• Technique formulated by Ansel Adams for film development.• Still used with digital photography.

58

Page 59: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Examples

59

Page 60: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Examples

photographic tonemapping

linear scaling (map 10% to 1)

60

Page 61: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Compare with LDR images

61

Page 62: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Dealing with color

If we tonemap all channels the same, colors are washed out

Can you think of a way to deal with this?62

Page 63: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Intensity-only tonemapping

tonemapintensity

How would you implement this?

leave color the same

63

Page 64: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Comparison

Color now OK, but some details are washed out due to loss of contrast

Can you think of a way to deal with this?64

Page 65: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Low-frequency intensity-only tonemapping

tonemap low-frequency intensity component

How would you implement this?

leave color the same

leave high-frequency intensity component

the same

65

Page 66: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Comparison

We got nice color and contrast, but now we’ve run into the halo plague

Can you think of a way to deal with this?66

Page 67: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

The bilateral filtering solution

input

bilateral filter kernel

*

*

*

output

Do not blur if there is an edge! More next week67

Page 68: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Tonemapping with bilateral filtering

68

Page 69: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Comparison

We fixed the halos without losing contrast

69

Page 70: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

70

Page 71: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Gradient-domain merging and tonemapping

Compute gradients, scale and merge them, then integrate (solve Poisson problem).

71

Page 72: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Gradient-domain merging and tonemapping

72

Page 73: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Comparison (which one do you like better?)

photographic bilateral filtering gradient-domain73

Page 74: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Comparison (which one do you like better?)

There is no ground-truth• which one looks better

is entirely subjective

bilateral filtering gradient-domain74

Page 75: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Tonemapping for a single image

result from image processing pipeline

(basic tone reproduction)

After tonemapping

Modern DSLR sensors capture about 3 stops of dynamic range.• Tonemap single RAW file instead of using camera’s default rendering.

75

Page 76: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Tonemapping for a single image

Careful not to “tonemap” noise.• Why is this not a problem

with multi-exposure HDR?

Modern DSLR sensors capture about 3 stops of dynamic range.• Tonemap single RAW file instead of using camera’s default rendering.

76

Page 77: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

Some notes about HDR and tonemapping

77

Page 78: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

A note of caution

• HDR photography can produce very visually compelling results

78

Page 79: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

79

Page 80: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

80

Page 81: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

81

Page 82: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

A note of caution

• HDR photography can produce very visually compelling results

• It is also a very routinely abused technique, resulting in awful results

82

Page 83: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

83

Page 84: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

84

Page 85: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

85

Page 86: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

86

Page 87: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

A note of caution

• HDR photography can produce very visually compelling results

• It is also a very routinely abused technique, resulting in awful results

• The problem is tonemapping, not HDR itself

87

Page 88: Computational Photography and Image Manipulation CMPT 469 ...yagiz/cpim/2019-CPIM-04-HDR.pdf · SIGGRAPH Asia 2014 •Presentation: •Discussion: •Hasinoff et al., Burst photography

ReferencesBasic reading:• Szeliski textbook, Sections 10.1, 10.2.• Debevec and Malik, “Recovering High Dynamic Range Radiance Maps from Photographs,” SIGGRAPH 1997.

the paper that more or less started HDR imaging research in computer graphics.• Reinhard et al., “Photographic Tone Reproduction for Digital Images,” SIGGRAPH 2002.

the photographic tonemapping paper, including a very nice discussion of the zone system for film.• Durand and Dorsey, “Fast bilateral filtering for the display of high-dynamic-range images,” SIGGRAPH 2002.

the paper on tonemapping using bilateral filtering.• Fattal et al., “Gradient Domain High Dynamic Range Compression,” SIGGRAPH 2002.

the paper on gradient-domain tonemapping.

Additional reading:• Reinhard et al., “High Dynamic Range Imaging, Second Edition: Acquisition, Display, and Image-Based Lighting,” Morgan Kaufmann 2010

a very comprehensive book about everything relating to HDR imaging and tonemapping.• Kuang et al., “Evaluating HDR rendering algorithms,” TAP 2007.

one of many, many papers trying to do a perceptual evaluation of different tonemapping algorithms.• Debevec, “Rendering Synthetic Objects into Real Scenes: Bridging Traditional and Image-Based Graphics with Global Illumination and High

Dynamic Range Photography,” SIGGRAPH 1998.the original HDR light probe paper (we’ll see more about this in a later lecture).

• Hasinoff and Kutulakos, “Multiple-Aperture Photography for High Dynamic Range and Post-Capture Refocusing,” UofT TR 2009a paper on doing HDR by aperture bracketing instead of exposure bracketing.

• Hasinoff et al., “Noise-Optimal Capture for High Dynamic Range Photography,” CVPR 2010a paper on weighting different exposures based on a very detailed sensor noise model.

• Hasinoff et al., “Burst photography for high dynamic range and low-light imaging on mobile cameras,” SIGGRAPH Asia 2016the paper describing Google’s HDR+.

• Ward, “The radiance lighting simulation and rendering system,” SIGGRAPH 1994the paper that introduced (among other things) the .hdr image format for HDR images. 88