03 cv imageacquisition 0702 -...

41
Lecture 03: Light, color, digitization CS472, Computer Vision 1 Capturing light and color Friday, 07/02/2020 Antonis Argyros e-mail: [email protected] 1 Recap from last lecture Pinhole camera model Perspective projection Focal length and depth/field of view Lenses

Upload: others

Post on 03-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 1

Capturing light and color

Friday, 07/02/2020Antonis Argyros

e-mail: [email protected]

1

Recap from last lecture

• Pinhole camera model

• Perspective projection

• Focal length and depth/field of view

• Lenses

Page 2: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 2

From 3D to 2D…

p PK R t

0 11 12 13

0 21 22 23

31 32 33

0

1 0 0 11

x

y

z

Xu s u r r r t

Yp w v v r r r t

Zr r r t

Adding a lens

A lens focuses light onto the film• There is a specific distance at which objects are “in focus”

– other points project to a “circle of confusion” in the image

“circle of confusion”

Slide by Steve Seitz

4

Page 3: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 3

Beyond Pinholes: Radial Distortion

Image from Martin Habbecke

Corrected Barrel Distortion

Lens Flaws: Chromatic Aberration

Lens has different refractive indices for different wavelengths: causes color fringing

Near Lens Center Near Lens Outer Edge

6

Page 4: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 4

Lens flaws: Spherical aberration

Spherical lenses don’t focus light perfectly

Rays farther from the optical axis focus closer

7

Lens flaws: Vignetting

8

Page 5: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 5

Real lenses

9

The long trip of light…

Light sourceproperties

Surface shape

Surface reflectancepropertiesOptics

Sensor characteristics

Slide by L. Fei-Fei

Exposure

Page 6: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 6

What is involved…

Geometry• Relations between 3D world points and their 2D projections on the

image

Radiometry• The relation of emitted light to the light that reaches the

camera

Photometry• How to measure the light that reaches the camera

Digitization• The transformation of the spatio-temporally continuous signal

to digital representations11

A photon’s life choicesAbsorptionDiffusionReflectionTransparencyRefractionFluorescenceSubsurface scattering

λ

light source

?

Page 7: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 7

A photon’s life choicesAbsorptionDiffusionReflectionTransparencyRefractionFluorescenceSubsurface scattering

λ

light source

A photon’s life choicesAbsorptionDiffuse ReflectionReflectionTransparencyRefractionFluorescenceSubsurface scattering

λ

light source

Page 8: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 8

A photon’s life choicesAbsorptionDiffusionSpecular ReflectionTransparencyRefractionFluorescenceSubsurface scattering

λ

light source

A photon’s life choicesAbsorptionDiffusionReflectionTransparencyRefractionFluorescenceSubsurface scattering

λ

light source

Page 9: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 9

A photon’s life choicesAbsorptionDiffusionReflectionTransparencyRefractionFluorescenceSubsurface scattering

λ

light source

A photon’s life choicesAbsorptionDiffusionReflectionTransparencyRefractionFluorescenceSubsurface scattering

λ1

light source

λ2

Page 10: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 10

A photon’s life choicesAbsorptionDiffusionReflectionTransparencyRefractionFluorescenceSubsurface scattering

λ

light source

Lambertian Reflectance

In computer vision, surfaces are often assumed to be ideal diffuse reflectors with known dependence on viewing direction.

• Lambert’s law: Viewed brightness does not depend on viewing direction (but it does depend on direction of illumination)

Page 11: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 11

What is color?

• Color is the result of interaction between physical light in the environment and our visual system

• Color is a psychological property of our visual experiences when we look at objects and lights, not a physical property of those objects or lights (S. Palmer, Vision Science: Photons to Phenomenology)

Wassily Kandinsky (1866-1944), Murnau Street with Women, 1908

21

Electromagnetic spectrum

Human Luminance Sensitivity Function

22

Page 12: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 12

The Eye

The human eye is a camera (the best)!• Iris - colored annulus with radial muscles

• Pupil - the hole (aperture) whose size is controlled by the iris

• Lens - changes shape by using ciliary muscles (to focus on objects at different distances)

• What’s the “film”?– photoreceptor cells (rods and cones) in the retina

Slide by Steve Seitz

23

© Stephen E. Palmer, 2002

Cones•cone-shaped •operate in high light•color vision

Two types of light-sensitive receptors

cone

rod

Rods•rod-shaped•operate at night•gray-scale vision

Page 13: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 13

Rod / Cone sensitivity

Density of rods and cones

Rods and cones are non-uniformly distributed on the retina• Fovea - Small region (1 or 2°) at the center of the visual field

containing the highest density of cones (and no rods).• Less visual acuity in the periphery

Slide by Steve Seitz

cone

rod

26

Page 14: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 14

Standardizing color experience

• We would like to understand which spectra produce the same color sensation from people under similar viewing conditions

• Color matching experiments

Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

27

Color matching experiment

Source: W. Freeman

28

Page 15: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 15

Color matching experiment

p1 p2 p3

Source: W. Freeman

29

Color matching experiment

p1 p2 p3

Source: W. Freeman

30

Page 16: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 16

Color matching experiment

p1 p2 p3

The primary color amounts needed for a match

Source: W. Freeman

31

Trichromacy

• Three numbers seem to be sufficient for encoding color

• In color matching experiments, most people can match any given light with three primaries • Exception: color blindness

• For the same light and same primaries, most people select the same weights

32

Page 17: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 17

Grassman’s Laws

• If two test lights can be matched with the same set of weights, then they are the same

• If we mix two test lights, then mixing the matches will match the result:• Suppose A = u1 P1 + u2 P2 + u3 P3 and B = v1 P1 + v2 P2 + v3 P3.

Then A+B = (u1+v1) P1 + (u2+v2) P2 + (u3+v3) P3.

• If we scale the test light, then the matches get scaled by the same amount:• Suppose A = u1 P1 + u2 P2 + u3 P3.

Then kA = (ku1) P1 + (ku2) P2 + (ku3) P3.

33

Color Sensing in Camera (RGB)

3-chip vs. 1-chip: quality vs. cost

http://www.cooldictionary.com/words/Bayer-filter.wikipediaSlide by Steve Seitz

Page 18: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 18

Practical Color Sensing: Bayer Grid

Estimate RGBat ‘G’ cells from neighboring values

Slide by Steve Seitz

Color ImageR

G

B

Page 19: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 19

Images in Matlab• Images represented as a matrix• Suppose we have a NxM RGB image called “im”

– im(1,1,1) = top-left pixel value in R-channel– im(y, x, b) = y pixels down, x pixels to right in the bth channel– im(N, M, 3) = bottom-right pixel in B-channel

• imread(filename) returns a uint8 image (values 0 to 255)– Convert to double format (values 0 to 1) with im2double

0.92 0.93 0.94 0.97 0.62 0.37 0.85 0.97 0.93 0.92 0.990.95 0.89 0.82 0.89 0.56 0.31 0.75 0.92 0.81 0.95 0.910.89 0.72 0.51 0.55 0.51 0.42 0.57 0.41 0.49 0.91 0.920.96 0.95 0.88 0.94 0.56 0.46 0.91 0.87 0.90 0.97 0.950.71 0.81 0.81 0.87 0.57 0.37 0.80 0.88 0.89 0.79 0.850.49 0.62 0.60 0.58 0.50 0.60 0.58 0.50 0.61 0.45 0.330.86 0.84 0.74 0.58 0.51 0.39 0.73 0.92 0.91 0.49 0.740.96 0.67 0.54 0.85 0.48 0.37 0.88 0.90 0.94 0.82 0.930.69 0.49 0.56 0.66 0.43 0.42 0.77 0.73 0.71 0.90 0.990.79 0.73 0.90 0.67 0.33 0.61 0.69 0.79 0.73 0.93 0.970.91 0.94 0.89 0.49 0.41 0.78 0.78 0.77 0.89 0.99 0.93

0.92 0.93 0.94 0.97 0.62 0.37 0.85 0.97 0.93 0.92 0.990.95 0.89 0.82 0.89 0.56 0.31 0.75 0.92 0.81 0.95 0.910.89 0.72 0.51 0.55 0.51 0.42 0.57 0.41 0.49 0.91 0.920.96 0.95 0.88 0.94 0.56 0.46 0.91 0.87 0.90 0.97 0.950.71 0.81 0.81 0.87 0.57 0.37 0.80 0.88 0.89 0.79 0.850.49 0.62 0.60 0.58 0.50 0.60 0.58 0.50 0.61 0.45 0.330.86 0.84 0.74 0.58 0.51 0.39 0.73 0.92 0.91 0.49 0.740.96 0.67 0.54 0.85 0.48 0.37 0.88 0.90 0.94 0.82 0.930.69 0.49 0.56 0.66 0.43 0.42 0.77 0.73 0.71 0.90 0.990.79 0.73 0.90 0.67 0.33 0.61 0.69 0.79 0.73 0.93 0.970.91 0.94 0.89 0.49 0.41 0.78 0.78 0.77 0.89 0.99 0.93

0.92 0.93 0.94 0.97 0.62 0.37 0.85 0.97 0.93 0.92 0.990.95 0.89 0.82 0.89 0.56 0.31 0.75 0.92 0.81 0.95 0.910.89 0.72 0.51 0.55 0.51 0.42 0.57 0.41 0.49 0.91 0.920.96 0.95 0.88 0.94 0.56 0.46 0.91 0.87 0.90 0.97 0.950.71 0.81 0.81 0.87 0.57 0.37 0.80 0.88 0.89 0.79 0.850.49 0.62 0.60 0.58 0.50 0.60 0.58 0.50 0.61 0.45 0.330.86 0.84 0.74 0.58 0.51 0.39 0.73 0.92 0.91 0.49 0.740.96 0.67 0.54 0.85 0.48 0.37 0.88 0.90 0.94 0.82 0.930.69 0.49 0.56 0.66 0.43 0.42 0.77 0.73 0.71 0.90 0.990.79 0.73 0.90 0.67 0.33 0.61 0.69 0.79 0.73 0.93 0.970.91 0.94 0.89 0.49 0.41 0.78 0.78 0.77 0.89 0.99 0.93

R

GB

rowcolumn

Color spaces: RGB

0,1,0

0,0,1

1,0,0

Image from: http://en.wikipedia.org/wiki/File:RGB_color_solid_cube.png

Drawback:• Non-perceptual: a change of the same amount in a color value, does not produce a change of about the same visual importance.

Default color space

R(G=0,B=0)

G(R=0,B=0)

B(R=0,G=0)

Page 20: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 20

Color spaces: HSV

Intuitive color space

H(S=1,V=1)

S(H=1,V=1)

V(H=1,S=0)

Color spaces: L*a*b*

L(a=0,b=0)

a(L=65,b=0)

b(L=65,a=0)

Page 21: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 21

If you had to choose, would you rather go without luminance or chrominance?

If you had to choose, would you rather go without luminance or chrominance?

Page 22: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 22

Most information in intensity

Only color shown – constant intensity

Most information in intensity

Only intensity shown – constant color

Page 23: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 23

Most information in intensity

Original image

Lightness constancy

http://web.mit.edu/persci/people/adelson/checkershadow_illusion.html46

Page 24: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 24

Lightness constancy

http://web.mit.edu/persci/people/adelson/checkershadow_illusion.html47

Chromatic adaptation

The visual system changes its sensitivity depending on the luminances prevailing in the visual field• Adapting to different brightness levels

• Changing the size of the iris opening (i.e., the aperture) changes the amount of light that can enter the eye

• Think of walking into a building from full sunshine

• Adapting to different color temperature• The receptive cells on the retina change their sensitivity • For example: if there is an increased amount of red light, the

cells receptive to red decrease their sensitivity until the scene looks white again

http://www.schorsch.com/kbase/glossary/adaptation.html48

Page 25: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 25

Name that color

Πράσινο

Κόκκινο

Μπλέ

Κίτρινο

Πράσινο

Κόκκινο

Πορτοκαλί

Μώβ

Καφέ

Κίτρινο

Μαύρο 49

Digital camera

A digital camera replaces film with a sensor array• Each cell in the array is light-sensitive diode that converts photons to electrons

• Two common types

– Charge Coupled Device (CCD)

– Complementary metal oxide semiconductor (CMOS)

• http://electronics.howstuffworks.com/digital-camera.htm

Slide by Steve Seitz

50

Page 26: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 26

Digitization

Let’s digitize this image• We will assume a square sampling grid

• We will be varying the sampling density51

Digitization

“Coarse” sampling: 14 lines, 20 points / line

“Denser” sampling: 68 lines, 100 points/line

••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Sam

plin

g in

terv

al

A sample per red point

52

Page 27: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 27

Consequences of the sampling interval/rate

Look at the fence

Sampling interval

100 100 100

100 100 100

100 100 100

100 100 100

100 100 100

100 100 100

100 100 100

100 100 100

40 40 40 40 40 40

40 40 40 40 40 40

40 40 40 40 40 40

40 40 40 40 40 40

White image!Grey image!

53

Consequences of the sampling interval/rate

40 100 10040 40

40 100 10040 40

40 100 10040 40

40 100 10040 40Now the fence is visible!

Look at the fence

Sampling interval

54

Page 28: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 28

Consequences of the sampling interval/rate

Look at the repetitive pattern on the fence:

d

s'

s

Sampling intervals

Case 1: s' = dSampling interval equal to the period of the repetitive pattern

Invisible fence

Case 2: s = d/2 Sampling interval equal to half the period of the repetitive pattern

Visible fence

55

Sampling theorem

• If the width of the thinnest structure is d, then the sampling interval should be at smaller than d/2

• The repetitive pattern has a certain frequency.To maintain this frequency, sampling must be done with at least double this frequency (Nyquist rate)

56

Page 29: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 29

Sampling

Basic idea, in theory

Dirac Delta Function 2D "Comb"

Continuous signal

Digitized image

d(x,y) = 0 for x ǂ 0, y ǂ 0

d(x,y) dx dy = 1

f(x,y)d(x-a,y-b) dx dy = f(a,b)

23

s

57

Sampling

Basic idea, in practice...• The ideal situation is not feasible in practice

• A sample corresponds to a region that has a certain area

• The value of a sample depends on the value of the continuous function over this area

23

s58

Page 30: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 30

… as a result…. The “mixed pixel problem”…

59

Remember: Color sensing in camera: Color filter array

Source: Steve Seitz

Estimate missing components from neighboring values(demosaicing)

Bayer grid

60

Page 31: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 31

Problem with demosaicing: color moire

Signal quantization

Goal: Ok, we saw where to sample, what about the actual value measured at each sample?

I(x,y) = .1583 volts

= ???? Digital value?

62

Page 32: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 32

Quantization

• I(x,y) = continuous signal 0 ≤ I(x,y) ≤ M

• We need to quantize it in K levels/values 0,1,....K-1

• K is usually a power of 2:

• We need to define the mapping between the (analog) input signal to the (digital) output signal.

• Several such mappings (linear, logarithmic, etc)

K #Bits2 14 28 316 432 564 6128 7256 8

63

E.g., linear mapping

Qu

an

tiza

tion

Le

vel

3

M

2

1

0

K-1

0Signal Value

¥¥¥

64

Page 33: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 33

Selection of K

“Continuous” signal

K=2 K=4

K=16 K=32

65

Selection of K

K=2 (for each basic color)

K=4 (for each basic color)66

Page 34: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 34

Loss during spatial sampling

Loss during quantization

Page 35: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 35

Image histogram H

The histogram of an image represents the number of pixels having a particular intensity / gray value

0 1 2 3 4 5 6 70

1

2

3

4

5

6

7

8

Pix

el C

ount

Gray Value

Image M x N

max

min

( )I

i I

H i MN

69

Image histogram & image content

1241

0 256

1693

0 256

70

Page 36: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 36

Image histogram vs image properties

Dark image

Bright image

Low contrast

High contrast71

Point processing

• An image processing operator defines an operator that, when applied at an input image f results in a new image g.

• The simplest of such operators are those that processing is independent of position in the image

• Such operators are called point processing operators

72

Page 37: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 37

Point processing

O = T(I)

0 255

255

Input I

Ou

tpu

t OT

73

Point processing

74

0 0.5 10

0.5

1

0 0.5 10

0.5

1

0 0.5 10

0.5

1

0 100 200

0

2000

4000

0 0.5 1

0

2000

4000

0 0.5 1

0

2000

4000

Page 38: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 38

Point processing

0 255

255

Input

Out

put

75

Contrast stretching

76

Page 39: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 39

Point processing

< 1 : increase contrast in dark regions

> 1 : increase contrast in bright regions

O = I

0 0.5 10

0.5

1

1

<1

>1

77

γ=0.5

0 0.5 10

0.5

1

78

Page 40: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 40

γ=3.0

0 50 100 150 200 250

0

500

1000

1500

2000

2500

3000

3500

4000

0 50 100 150 200 250

0

500

1000

1500

2000

2500

3000

3500

4000

0 0.5 10

0.5

1

79

Some basic types

80

Page 41: 03 CV ImageAcquisition 0702 - users.ics.forth.grusers.ics.forth.gr/~argyros/cs472_spring20/03_CV_ImageAcquisition… · /hfwxuh /ljkw froru gljlwl]dwlrq &6 &rpsxwhu 9lvlrq :kdw lv

Lecture 03: Light, color, digitization

CS472, Computer Vision 41

Image negative

81