CS 89.15/189.5, Fall 2015 ASPECTS OF DIGITAL PHOTOGRAPHY COMPUTATIONAL. Image Processing Basics. Wojciech Jarosz

Similar documents
Lecture: Color. Juan Carlos Niebles and Ranjay Krishna Stanford AI Lab. Lecture 1 - Stanford University

CMPSCI 670: Computer Vision! Color. University of Massachusetts, Amherst September 15, 2014 Instructor: Subhransu Maji

Computer Vision. Intensity transformations

CS6640 Computational Photography. 6. Color science for digital photography Steve Marschner

Comp Computational Photography Spatially Varying White Balance. Megha Pandey. Sept. 16, 2008

Capturing Light in man and machine

Digital photography , , Computational Photography Fall 2017, Lecture 2

HIGH DYNAMIC RANGE IMAGING Nancy Clements Beasley, March 22, 2011

Digital Image Processing. Lecture # 3 Image Enhancement

Dynamic Range. H. David Stein

Capturing Light in man and machine

BBM 413 Fundamentals of Image Processing. Erkut Erdem Dept. of Computer Engineering Hacettepe University. Point Operations Histogram Processing

These aren t just cameras

BBM 413 Fundamentals of Image Processing. Erkut Erdem Dept. of Computer Engineering Hacettepe University. Point Operations Histogram Processing

BBM 413! Fundamentals of! Image Processing!

IMAGE ENHANCEMENT - POINT PROCESSING

Focusing and Metering

Digital photography , , Computational Photography Fall 2018, Lecture 2

Capturing Light in man and machine

Digital Imaging and Multimedia Point Operations in Digital Images. Ahmed Elgammal Dept. of Computer Science Rutgers University

Capturing Light in man and machine. Some figures from Steve Seitz, Steve Palmer, Paul Debevec, and Gonzalez et al.

Introduction to 2-D Copy Work

How to correct a contrast rejection. how to understand a histogram. Ver. 1.0 jetphoto.net

Image processing. Image formation. Brightness images. Pre-digitization image. Subhransu Maji. CMPSCI 670: Computer Vision. September 22, 2016

9/19/16. A Closer Look. Danae Wolfe. What We ll Cover. Basics of photography & your camera. Technical. Macro & close-up techniques.

Camera Image Processing Pipeline: Part II

TDI2131 Digital Image Processing

Camera Image Processing Pipeline: Part II

Aperture. The lens opening that allows more, or less light onto the sensor formed by a diaphragm inside the actual lens.

ECC419 IMAGE PROCESSING

Lenses, exposure, and (de)focus

High Dynamic Range Imaging

HDR ~ The Possibilities

Overview. Pinhole camera model Projective geometry Vanishing points and lines Projection matrix Cameras with Lenses Color Digital image

CAMERA BASICS. Stops of light

Capturing Light in man and machine

CSE 332/564: Visualization. Fundamentals of Color. Perception of Light Intensity. Computer Science Department Stony Brook University

High Dynamic Range (HDR) Photography in Photoshop CS2

Digital Imaging Alliance

Eileen Donelan. What s in my Camera Bag? Minimum Camera Macro Lens Cable Release Tripod

BSB663 Image Processing Pinar Duygulu. Slides are adapted from Gonzales & Woods, Emmanuel Agu Suleyman Tosun

General Camera Settings

Sony PXW-FS7 Guide. October 2016 v4

Photography Basics. Exposure

VU Rendering SS Unit 8: Tone Reproduction

KODAK VISION Expression 500T Color Negative Film / 5284, 7284

Images and Displays. Lecture Steve Marschner 1

Hello, welcome to the video lecture series on Digital Image Processing.

This histogram represents the +½ stop exposure from the bracket illustrated on the first page.

Color. Phillip Otto Runge ( )

Digital Imaging Rochester Institute of Technology

6.A44 Computational Photography

Realistic Image Synthesis

Levels. What is a levels histogram? "Good" and "bad" histograms. Levels

Your objective: maximum control, maximum manageability

Noise and ISO. CS 178, Spring Marc Levoy Computer Science Department Stanford University

6.098/6.882 Computational Photography 1. Problem Set 1. Assigned: Feb 9, 2006 Due: Feb 23, 2006

Digital Image Processing. Lecture # 4 Image Enhancement (Histogram)

High dynamic range imaging and tonemapping

Frequencies and Color

One Week to Better Photography

Aperture: Circular hole in front of or within a lens that restricts the amount of light passing through the lens to the photographic material.

Camera Mechanics & camera function. Daily independent reading:pgs. 1-5 Silently read for 10 min. Note taking led by Mr. Hiller

Color , , Computational Photography Fall 2018, Lecture 7

KODAK PRIMETIME 640T Teleproduction Film / 5620,7620

OFFSET AND NOISE COMPENSATION

Color Science. What light is. Measuring light. CS 4620 Lecture 15. Salient property is the spectral power distribution (SPD)

Glossary of Terms (Basic Photography)

EASTMAN EXR 200T Film / 5293, 7293

6.098 Digital and Computational Photography Advanced Computational Photography. Bill Freeman Frédo Durand MIT - EECS

Photography PreTest Boyer Valley Mallory

Twelve Steps to Improve Your Digital Photographs Stephen Johnson

HISTOGRAMS. These notes are a basic introduction to using histograms to guide image capture and image processing.

Improving digital images with the GNU Image Manipulation Program PHOTO FIX

Understanding and Using Dynamic Range. Eagle River Camera Club October 2, 2014

By Mark Schutzer Coast Division Meet June 2013 Copies of this presentation can be found at

Unlimited Membership - $ The Unlimited Membership is an affordable way to get access to all of Open Media's community resouces.

Zone. ystem. Handbook. Part 2 The Zone System in Practice. by Jeff Curto

Color and More. Color basics

Filtering. Image Enhancement Spatial and Frequency Based

Introduction... 3 Why use the SpyderCUBE... 4 Photographing the SpyderCUBE... 5 Selecting the White Point in your Software... 6 Setting the contrast

By Mark Schutzer PCR Regional Convention, Fremont, CA April 2009 Copies of this presentation can be found at

Digital cameras for digital cinematography Alfonso Parra AEC

Graphics and Image Processing Basics

Image Processing. 2. Point Processes. Computer Engineering, Sejong University Dongil Han. Spatial domain processing

DIGITAL PHOTOGRAPHY FOR OBJECT DOCUMENTATION GOOD, BETTER, BEST

ImageEd: Technical Overview

Color , , Computational Photography Fall 2017, Lecture 11

Images in Photoshop CS3

USE OF HISTOGRAM EQUALIZATION IN IMAGE PROCESSING FOR IMAGE ENHANCEMENT

ICC Profiling for Digital Cameras

METERING FOR A BETTER PHOTOGRAPH

My Inspiration. Trey Ratcliffe Stuck in Customs Klaus Herrman Farbspiel Photography

High Dynamic Range Images : Rendering and Image Processing Alexei Efros. The Grandma Problem

aperture, shutter speed

PHOTOGRAPHER S GUIDE TO THE PANASONIC LUMIX LX7

Name Digital Imaging I Chapters 9 12 Review Material

Understanding Histograms

The 2 in 1 Grey White Balance Colour Card. user guide.

Aperture & Shutter Speed Review

Transcription:

CS 89.15/189.5, Fall 2015 COMPUTATIONAL ASPECTS OF DIGITAL PHOTOGRAPHY Image Processing Basics Wojciech Jarosz wojciech.k.jarosz@dartmouth.edu

Domain, range

Domain vs. range 2D plane: domain of images color value: range (R 3 for us) - red, green and blue components stored in im(x, y, 0), im(x, y, 1), im(x, y, 2), respectively CS 89/189: Computational Photography, Fall 2015 3

Basic types of operations output(x,y) output(x,y) = f(image(x,y)) Point operations: image(x,y) range only Assignment 2 CS 89/189: Computational Photography, Fall 2015 4

Basic types of operations output(x,y) output(x,y) = f(image(x,y)) Point operations: image(x,y) range only Assignment 2 output(x,y) = image(f(x,y)) Domain operations Assignment 6 CS 89/189: Computational Photography, Fall 2015 5

Basic types of operations output(x,y) output(x,y) = f(image(x,y)) Point operations: image(x,y) range only Assignment 2 output(x,y) = image(f(x,y)) Domain operations Assignment 6 Neighborhood operations: domain and range Assignments 3, 4, 5 CS 89/189: Computational Photography, Fall 2015 6

Light & perception

Light matter, eyes Light from sources is reflected by objects and reaches the eye The amount of light from the source gets multiplied by the object reflectance - on a per-wavelength basis CS 89/189: Computational Photography, Fall 2015 8

Human perception Our eyes have an uncanny ability to discount the illumination - Only objects really matter for survival - Light is only useful to understand if you re a photographer or to choose your sun lotion CS 89/189: Computational Photography, Fall 2015 9

Illusion by Adelson A & B have exactly the same tone CS 89/189: Computational Photography, Fall 2015 10

Illusion by Adelson A & B have exactly the same tone CS 89/189: Computational Photography, Fall 2015 11

Mechanism to discount light Light adaptation - We re-center our neural response around the current average brightness - neural + chemical + pupil Chromatic adaptation - eliminate color cast due to light sources e.g. Daylight is white but tungsten is yellowish - Related to white balance - more soon - and Spanish Castle illusion CS 89/189: Computational Photography, Fall 2015 12

Contrast is about ratios Contrast between 1 & 2 is the same as between 100 & 200 Useful to discount the multiplicative effect of light 0.1 to 0.2 0.4 to 0.8 CS 89/189: Computational Photography, Fall 2015 13

Exposure On cameras, exposure (shutter speed, aperture, ISO) has a multiplicative effect on the values recorded by the sensor. Changes the brightness, not contrast http://photographystepbystep.com/exposure-2/auto-bracketing/ CS 89/189: Computational Photography, Fall 2015 14

White balance

White balance & Chromatic adaptation Different illuminants have different color temperature Our eyes adapt: chromatic adaptation - We actually adapt better in brighter scenes - This is why candlelit scenes still look yellow www.shortcourses.com/guide/guide2-27.html CS 89/189: Computational Photography, Fall 2015 16

White balance problem When watching a picture on screen or print, we adapt to the illuminant of the room, not that of the scene in the picture The eye cares more about objects intrinsic color, not the color of the light leaving the objects We need to discount the color of the light source Same object, different illuminants CS 89/189: Computational Photography, Fall 2015 17

White balance & Film Different types of film for fluorescent, tungsten, daylight Need to change film! Electronic & Digital imaging are more flexible CS 89/189: Computational Photography, Fall 2015 18

Von Kries adaptation Multiply each channel by a gain factor - R =R*k r - G =G*k g - B =B*k b http://www.cambridgeincolour.com/tutorials/white-balance.htm CS 89/189: Computational Photography, Fall 2015 19

Von Kries adaptation Multiply each channel by a gain factor Note that the light source could have a more complex effect - Arbitrary 3 3 matrix - More complex spectrum transformation http://www.cambridgeincolour.com/tutorials/white-balance.htm CS 89/189: Computational Photography, Fall 2015 20

White balance challenge How do we find the scaling factors for r, g, and b? CS 89/189: Computational Photography, Fall 2015 21

Best way to do white balance Grey card: Take a picture of a neutral object (white or gray) Deduce the weight of each channel If the object is recoded as r, g, b w w w use weights k/r w, k/g w, k/b w where k controls the exposure CS 89/189: Computational Photography, Fall 2015 22

Lightroom demo Most photo editing software lets you click on a neutral object to achieve white balance - In Levels in Photoshop - In Basic in Lightroom - You also often have presets such as daylight, tungsten CS 89/189: Computational Photography, Fall 2015 23

Party name tags Provide excellent white references! write(im/im(300, 214)) CS 89/189: Computational Photography, Fall 2015 24

Without grey cards We need to guess which pixels correspond to white objects CS 89/189: Computational Photography, Fall 2015 25

Grey world assumption Assume average color in the image is grey Use weights proportional to Usually assumes 18% grey to set exposure CS 89/189: Computational Photography, Fall 2015 26

Brightest pixel assumption Highlights usually have the color of the light source - At least for dielectric materials White balance by using the brightest pixels - Plus potentially a bunch of heuristics - In particular use a pixel that is not saturated/clipped CS 89/189: Computational Photography, Fall 2015 27

Refs Recent work on color constancy - http://gvi.seas.harvard.edu/paper/perceptionbased-colorspace-illuminationinvariant-image-processing - http://gvi.seas.harvard.edu/paper/color-subspacesphotometric-invariants - http://people.csail.mit.edu/billf/papers/bayesjosa.pdf Still an open problem! CS 89/189: Computational Photography, Fall 2015 28

Questions? from xkcd CS 89/189: Computational Photography, Fall 2015 29

Take home messages Discounting the illumination is useful Ratios matter Optical illusions are not optical but fun CS 89/189: Computational Photography, Fall 2015 30

Gamma

Linearity and gamma Images are usually gamma encoded Instead of storing the light intensity x, they store x γ to get more precision in dark areas for 8-bit encoding gamma compression curve stored value real value CS 89/189: Computational Photography, Fall 2015 32

Linearity and gamma Images are usually gamma encoded Instead of storing the light intensity x, they store x γ to get more precision in dark areas for 8-bit encoding 6 bit encoding for emphasis: CS 89/189: Computational Photography, Fall 2015 33

Gamma demo http://web.mit.edu/lilis/www/gammavis.html CS 89/189: Computational Photography, Fall 2015 34

Linearity and gamma Images are usually gamma encoded Instead of storing the light intensity x, they store x γ Half of image processing algorithms work better in linear space - If linearity is important - To deal with ratios and multiplicative factors better Half work better in gamma space - closer to logarithmic scale CS 89/189: Computational Photography, Fall 2015 35

How to capture linear images http://www.mit.edu/~kimo/blog/linear.html CS 89/189: Computational Photography, Fall 2015 36

Take home message Images are usually gamma-encoded gamma ~2.2 provides better quantization sometimes good for algorithms sometimes bad - convert to linear values! CS 89/189: Computational Photography, Fall 2015 37

Histograms

Histogram Histogram: - For each value (e.g. 0-255), how many pixels have this value? Cumulative histogram: (wikipedia) - for each value x, how many pixels have a value smaller than x? Normalized: divide value of each bin by total number of pixels - histogram = discrete PDF #pixels - cumulative histogram = discrete CDF pixel value CS 89/189: Computational Photography, Fall 2015 39

Very useful on camera Allows you to tell if you use the dynamic range entirely CS 89/189: Computational Photography, Fall 2015 40

Bad: bright values under-used Bad: bright values saturate (underexposure) (overexposure) http://www.luminous-landscape.com/tutorials/understanding-series/understanding-histograms.shtml

Histogram equalization

Histogram equalization Given an image with a certain histogram, monotonic remapping to get a flat histogram #pixels new pixel value old pixel value #pixels pixel value http://en.wikipedia.org/wiki/histogram_equalization pixel value CS 89/189: Computational Photography, Fall 2015 43

Histogram equalization Ideal flat histogram: y% of pixels have a value less than y% - assuming everything is normalized to [0,1] Flip it: a pixel with value larger than y% of all pixels should have value y% For an old value x%, we know the number of pixels that have value < x%: cumulative histogram (also called CDF) Therefore, we want x to be mapped to its cumulative histogram value. CS 89/189: Computational Photography, Fall 2015 44

Histogram matching Histogram matching - Given a desired histogram - Map each value of an image channel to a new value, such that the new histogram matches the desired histogram Histogram equalization - The desired histogram is simply constant - What shape is the cumulative histogram? CS 89/189: Computational Photography, Fall 2015 45

Histogram matching Histogram matching is done by adjusting the cumulative distribution function (cdf) 100 input - Cumulative histogram of input % of pixels target G1 0 intensity bin 255 CS 89/189: Computational Photography, Fall 2015 46

Histogram matching Histogram matching is done by adjusting the cumulative distribution function (cdf) - Cumulative histogram of input - Followed by inverse cumulative histogram of target 100 % of pixels G1 input target G2 0 intensity bin 255 CS 89/189: Computational Photography, Fall 2015 47

Histogram equalization Histogram matching is done by adjusting the cumulative distribution function (cdf) - Cumulative histogram of input - Followed by inverse cumulative histogram of target (linear) 100 % of pixels G1 input G2 target 0 intensity bin 255 CS 89/189: Computational Photography, Fall 2015 48

Histogram equalization Cumulative distribution function (CDF) Input Equalized CS 89/189: Computational Photography, Fall 2015 49

Debugging

Debugging Doubt everything Debug pieces in isolation - Binary search/divide and conquer Display/print everything - In particular intermediate results Create simple inputs - where you can easily manually compute the result - use small images (e.g. 3x3) - including (especially) inputs to intermediate stages - use input thats isolate different failure modes Change one thing at a time - e.g. to verify that a given command has the effect you want, modify it to break it - e.g. constant image, edge image, etc. CS 89/189: Computational Photography, Fall 2015 51

Slide credits Frédo Durand CS 89/189: Computational Photography, Fall 2015 52