Professional Documents
Culture Documents
Image Processing
Image Processing
Many alternatives
Sensor CFA
CFA RGB
processing processing
Dead pixel removal Lens shading
TMS320DSC21
Auto-exposure
pipeline
Auto-
focus
Edge
detection
JPEG
Color compression
conversion
RGB to YCbCr
False color
suppression
Scaling for
monitor
LCD
Relative illumination
• Relative illumination at
d
the edge is lower
Relative illumination
General approximation
Eθ
= cos (θ )
4
E0
E0
θ Eθ
Paraxial approximation
(small h)
h = image field height
d = distance from lens to image plane h
S= d 2 + h2 d
Relative illumination = (h / S)4
Relative illumination simulation (ISET)
18
7/18 ~ 0.4
11
Lux
Microns Microns
Relative illumination is visible
Rendered image
Exposure algorithms
• Exposure value
• Impact of exposure on color
appearance
Exposure algorithms
Set the f-number (F) and exposure time (T) so that the
image pixels accumulate a charge that reaches, but does
not exceed, the capacity of the pixels (sensor range).
T : exposure time
• EV becomes smaller as
− Exposure duration increases
− Aperture increases
Exposure algorithms use various image statistics
Raw
data
Processed
data
Poor exposure produces incorrect color
Raw
data
Scaled to
Over-
gray
exposed
region
Demosaicking and CFAs
Demosaicking: The problem
Chromatic fringing on
monochrome test patterns is a
good visual test for demosaicking
250
200
150
100
50
0
0 50 100 150 200 250 300
Bilinear interpolation
Within channel
Constant Blur Noise
B6 G7 B8 G9 B10
For example:
R12 G13 R14
G8 = (G3+G7+G9+G13) / 4
Bilinear interpolation
Across channel
CR = R - G
CB = R - B
YCrCb
Nearest neighbor vs. bilinear
Nearest neighbor
Bilinear
Analysis: bilinear interpolation
• Combine information
from color channels to
make a decision
• Go beyond linear
interpolation and try to
preserve edges
Linear filtering – 2D Gaussian kernel
f (x) g (x)
fˆ ( x) = ∑ g ( x)h( x, y ) ( x − y )2
y∈Ω h ( x, y ) = e 2σ 2
Across channel adaptive demosaicking
RGR
GBG
RGR
Goal: Don’t average across edges.
Method: Before averaging, check for outliers.
Average a G value if it is similar to others
Otherwise, exclude it from weighted sum
Adaptive Laplacian algorithm
R1
Control parameters α = R 3 − 2 R5 + R 7 + G 6 − G 4
β = R1 − 2 R5 + R9 + G8 − G 2
G2
1st and 2nd
derivatives
R3 G4 R5 G6 R7
G8 Interpolation rule
R9
G 4 + G 6 R 3 − 2 R5 + R 7
− , if α < β
2 2
G 2 + G8 R1 − 2 R5 + R9
G5 = − , if α > β
2 2
G 2 + G 4 + G 6 + G8 R1 + R3 − 4 R5 + R7 + R9
− , if α = β
4 4
Adaptive filtering: Bilateral
(Carlo Tomasi)
g (x)
f (x)
fˆ ( x) = ∑ g ( x)hb ( x, y ) −
( x− y)
2
( g ( x )− g ( y ))
2
−
2σ d 2 2σ r 2
y∈Ω
hb ( x, y ) = e e
Demosaic comparisons
Bilinear Adaptive
Demosaic comparisons
Adaptive Laplacian
Chromatic
artifacts
Sharper
Chromatic
artifacts
Demosaic comparisons
Bilinear
Chromatic
artifacts
Blurred
Chromatic
artifacts
Slanted bar metric for assessing sharpness
• Fast demosaicking
C+M+Y+G
• High spatial sampling, but
spatially correlated
Chromatic Demosaicing CMYG
CR = (M + Y) - (G+C)
CB = (M + C) - (G+Y)
R = 1 − Cyan
Note: G = 1 − Magenta
B = 1 − Yellow
New algorithms for new CFAs
Most
widely
used
L3
Bayer Yamanaka Lukac
Watch the
video of the
talk
Illuminant transforma2on
• My preference is to use
− Sensor correction Color constancy
− Illuminant correction
ICC profiles
Sensor correction
(to CIE XYZ)
ISET: s_sensorCorrection
xyz = T * sensor
1
0.4
1.6
- XYZ
... Nikon
0.2
1.2
Responsivity
0 450 550 650
Wavelength (nm) 0.8
40
T
0.4
30 0
Count
400 500 600 700
20
Wavelength (nm)
10
0 2 4 6 8
CIELAB dE
Sensor correction
(to CIE XYZ)
ISET: s_sensorCorrection
1 xyz = T * sensor
0.4 - XYZ
0.2 1.5 ... CYM
1
0
450 550 650
Responsivity
Wavelength (nm)
0.5
50
T
0
40
30
Count
20
400
500 600 700
Wavelength (nm)
10
0 2 4 6 8
CIELAB dE
Illuminant correction
Blue
• Illuminant changes cause Sky
the scattered light to
change
• The visual system adjusts to
the illuminant (color
constancy)
• If the pipeline doesn’t Direct
adjust, the rendering has Sun
the wrong color balance
• Illuminant correction is a
very important aspect of
color balancing
Illuminant correction
important
Pixel-similarity (nonlocal means)
http://www.mathworks.com/matlabcentral/fileexchange/13619
(Buades et al., 2005)
less similar
surrounding patch
• Pixel-similarity is determined by
similarity of associated patches
⎛ R ' ⎞ ⎛ sr 0 0 ⎞⎛ R ⎞
Display
⎜G '⎟ = ⎜ 0 ⎟
1 0 ⎟⎜G⎟ ⎜ ⎟ Camera
⎜ ⎟ ⎜
⎜ B'⎟ ⎜ 0 0 sb ⎟⎠ ⎜⎝ B ⎟⎠
⎝ ⎠ ⎝
Choose sr and sb, so that a neutral (gray) surface in the image is
rendered as a neutral display output
You must make an educated guess about the camera RGB to a
neutral surface. Example ideas:
• The average of the image is neutral
• The brightest elements of the image average to neutral
• Your idea goes here ….
Matrix based color adjustment methods
Display Device-independent diagonal
Camera
⎛ R'⎞ ⎛ ⎞ ⎛ sr 0 0 ⎞⎛ ⎞⎛ R ⎞
⎜G '⎟ = ⎜ M ⎟⎜ 0 1 0 ⎟⎜⎟ ⎜ L ⎟⎜G⎟
⎜ ⎟ ⎜ ⎟⎜ ⎟⎜ ⎟
⎜ B'⎟ ⎜ ⎟⎜ 0 0 sb ⎟⎠ ⎜⎝ ⎟⎜ B⎟
⎝ ⎠ ⎝ ⎠⎝ ⎠⎝ ⎠
Transform the device data into a calibrated space (cones, XYZ), (L).
⎜ ⎟ ⎜ ⎟⎜G L ⎟
⎟=⎜
' '
⎜G L 1 G N CE ⎟⎜ 1 GN ⎟
⎜B '
B ' ⎟ ⎜⎝ ⎟⎜ B
⎠⎝ 1 BN ⎟⎠
⎝ 1 N ⎠
⎜ ⎟
C
⎜ ⎟
2
⎟ = ( LUTE ) ⎜ G1 L
' '
⎜G L G GN ⎟
C 3
1 N
C
⎜B '
B ' ⎟
4
⎜B BN ⎟⎠
⎝ 1 N ⎠ …
⎝ 1
C N
Create lookup tables for each light condition, E, that map surfaces into a desired
display for that light.
QE
Transform sensor data to L 0.1
calibrated color (XYZ)
450 550 650
Wavelength (nm)
E 1
XYZ
Estimate Apply transformation for CE
illuminant illuminant E
QE
0.5
0
Convert to display space, 450 550 650
Wavelength (nm)
adjusting for gamma and gamut M
CIE (1931) gamut
0.8
0.6
y
0.4
Display
0.2
Fluorescent Device-diagonal
Illuminant estimation algorithms
Device-dependent diagonal
Color temperature
Tungsten
Color by
correlation
image statistics
Color temperature
Daylight
Flash/No Flash color balancing
(DiCarlo et al., CIC, 2001)
Flash is known
Illuminant bracketing
illuminant
Flash/No Flash color balancing
(DiCarlo et al., CIC, 2001)
Single image
Use the known illuminant
case to estimate the
surface reflectance
Flash is known
illuminant
Flash/No Flash color balancing
(DiCarlo et al., CIC, 2001)
Fluorescent
Tungsten
Unknown
Bilinear color interpolation artifacts
Within-channel interpolation example
Mis-registration of the color
channels, coupled with
within channel interpolation,
Original
introduces unwanted color
artifacts in the rendered
display Missing red locations
Slanted edge
Color interpolation artifacts
(within-channel interpolation example)
Mis-registration of the color
channels, coupled with zipper artifact
within channel interpolation,
Interpolated
introduces unwanted color
artifacts in the rendered
display Interpolated red locations
Zoomed