COMP 4421 - Image Processing
COMP 4421 - Image Processing
10:17 AM
Image Model
Digital Image
- Discretized element:
Spatial resolution (x, y-coordinate)
Intensity (quantization)
- Storage requirement: M * N * k
M = Image width
N = Image height
0 i(x, y) < +
1 = Total reflectance
- i, r are continuous function f(x, y) can be
continuous
10:58 AM
Gray-Level Transformation
Sunday, March 20, 2016
11:22 AM
Typical transform
General Properties
Type
Def.
Illustration
Inverse
s = (L - 1) - r
Log
s = c log(1 + r)
Window/Gray-level Slicing
Power
(Gamma
correction) c = Scale-factor
Contrast
For (rmin, rmax):
Stretching
- r < rmin s = 0
- r > rmax s = L - 1
- rmin r rmax: Linearly map to
full range [0, L - 1]
Image Histogram
Sunday, March 20, 2016
11:38 AM
Usage
Construction
- Brightness
- Constrast
Histogram Equalization
- Purpose:
Approx flat histogram (uniform distribution)
Equally many pixel at every gray lvl
Pros
Global
Local
Run fast
- Methods:
Cons
300
700
800
900
500
400
196
300
p(r)
- Might greatly
enhance noise
- Slow
Local Enhancement
Sunday, March 20, 2016
12:16 PM
Properties:
close to f, small
- Common filter:
Filter
Smoothing/Low-pass
Sharpening/High-pass
Usage
Design
principle
- Operation: On pixel z
Put window such that its center is at z
Set z = Median of windowed neighoring
- All wi > 0
-1
Example
6:49 PM
- Function of x, y
- Represent intensity change over x, y-axis
z1
z2
z3
z4
z5
z6
z7
z8
z9
Precise:
Fast approx:
- Magnitude:
z1
z2
z3
z4
z5
z6
z7
z8
z9
- Linear mask:
Prewitt operator:
6:50 PM
Fourier Transform
- DFT:
u = 0, 1, 2, , (N - 1)
- Inverse:
- Let f = 0 +
x = 0, 1, 2, , (N - 1)
arg(bk) = k
- DFT:
u = 0, 1, , M - 1
v = 0, 1, , N - 1
- Inverse:
f(x, y) F(u, v)
3. Apply filter function:
G(x, y) g(x, y)
5. Post-processing Output image g(x, y)
Filter
11:39 PM
(ILPF)
(BLPF)
(GLPF)
Main
formula
: Distance from (u, v)
to origin of freq plane
D0 0
Illustration
Relating
concept
- Image power:
- Slight variation:
- Calculation of :
Cutoff freq = fc (at D = D0)
Illustration of ILPF
Outside Inside: Circle of radius 5, 15, 30, 80, 230 enclosing 94.6, 96.4, 98, 99.5% image power respectively
11:39 PM
Filter
(IHPF)
(BHPF)
(GHPF)
Main
formula
- Main version:
: Distance from
(u, v) to origin of freq plane
D0 0
- Slight variation:
0 a 1, b > a
Illustration
Pros &
Cons
Ringing artifact
- GHPF:
No ringing artifact
6:50 PM
Noise
- Source:
PDF Graph
Gaussian
= Mean
= sd
Rayleigh
Gamma
Image Illustration
Exponential
Uniform
Impulse
(Salt &
Pepper)
For b > a:
- Gray lvl b: Light dot (Salt noise)
- Gray lvl a: Dark dot (Pepper noise)
If Pa = 0 OR Pb = 0: Unipolar noise
If Pa 0 AND Pb 0, especially Pa Pb:
S = ROI
Mean Filters
Monday, March 21, 2016
10:38 AM
Filter
Arithmetic Mean
Main
formula
Geometric Mean
Harmonic Mean
Contraharmonic Mean
Q = Order of filter
(n row, m col)
Properties Work well for rand noise
Notation:
SXY = Mask area (centered at the operating pixel)
g(x, y) = Corrupted image
= Restored image
Illustration
Order-Statistics Filters
Monday, March 21, 2016
Filter
10:39 AM
Median
Max
Min
Midpoint
Main
formula
Alpha-trimmed Mean
Delete d/2 lowest & d/2 highest grey lvl values
in SXY
- Considerably less
blurring than linear
filters of same size
- Preserve edge
Find darkest point in SXY Work best for randomly distributed noise
- Convergence
Illustration
Adaptive Filters
Monday, March 21, 2016
Filter
10:40 AM
Adaptive Median
- Within neighboring area SXY:
Zxy = Grey lvl at (x, y)
Zmin = Min grey lvl, Zmax = Max grey lvl
Zmed = Median grey lvl
Smax = Max. allowed size of SXY
- Filter:
Properties
No filter
-
6:50 PM
Noise-Reduction Filter
Main type
Band-Reject
Notch Reject
Operation
Filter
visualization
Ideal
formula
W = Width of band
D0 = Radical center
Butterworth
formula
Gausian
formula
Illustration
10:41 AM
Spatial Domain
Frequency Domain
Input image
f(x, y)
F(u, v)
Degradation
function
h(x, y)
H(u, v)
N(x, y):
Additive
Noise
(x, y)
N(u, v)
Degraded
image
g(x, y)
G(u, v)
Restored
image
- Assumption:
Zero mean
Power spectrum known:
H: linear & known
Power spectrum of F(u, v) known:
- Estimation
N & F known ( S & Sf know):
* NOTE:
h(x, y) * f(x, y): Matrix convolution (using mask)
H(u, v)F(u, v): Element-by-element multiplication
Modelling steps:
N & F unknown:
1. Input image
4. Output image
Inverse Filter
- Assumption: H known
Geometric Mean Filter
- Estimation:
- Properties:
bad estimation
Solution:
Limit freq near origin Try avoiding
very small H(u, v)
Use const in denominator:
= 1 Inverse filter
= 0, = 1 Standard Wiener filter
Geometric Transformations
Monday, March 21, 2016
10:41 AM
Gray-Level Assignment
Spatial Transformation
1. Distortion Correction:
f(x, y) unknown g(x', y') known
Integral f(x, y) Non-integral g(x', y')
Grey lvl of f(x, y) = ?
- Solution 1: Nearest neighbor approach:
Map non-integral g(x', y') Nearest integral g(x'', y'')
Set f(x, y) = g(x'', y'')
- Solution 2: Bilinear Interpolation
In g: Get 4 integral points nearest to g(x', y')
Calculation:
x' = r(x, y) = c1x + c2y + c3xy + c4
2. Distortion:
f(x, y) known g(x', y') unknown
Integral f(x, y) Non-integral g(x', y')
Grey lvl of g(x', y') = ?
Solution: Nearest neighbor approach
Map non-integral g(x', y') Nearest integral g(x'', y'')
Set g(x'', y'') = f(x, y)
Non-Linear Filtering
Tuesday, March 22, 2016
1:12 AM
- Assumption:
Intensity diffuses isotropicaly (Diffusion Intensity grad)
D=I
- 1st Law:
Max flux Concentration gradient
(Diffusion) (Change in concentration)
- Equations:
Initially:
- 2nd Law:
Rate of concentration accumulation within volume
- Limitation:
D = Diffusivity (const/function)
2D:
- Concept:
Smoothing/Reduce noise ALONG edges, not only within
each region
Diffusion Intensity grad
- 2D Implementation:
- How: Diffuse along grad & tangent vector of Gaussian
intensity smoothed image u
COMP 4421 Page 22
u = G * u
Grad vector
Tangent vec
& eigenvector 1, 2
At boundary, 1 0
6:50 PM
A, B Z2
- Empty set:
A=
Dilation
Erosion
Def
- Union:
A B = {w | w A or w B}
How to use
- Intersection:
A B = {w | w A and w B}
- Put on top of A
- If they overlap Mark CENTER of
- Put B on top of A
- If B totally inside A Mark CENTER of B
Illustration
- Subset:
A B w A: w B
A B = {z | ( )z A }
A B = {z | (B)z A}
- Complement:
AC = {w | w A}
- Difference:
A B = {w | w A, w B} = A BC
- Reflection:
= {w | w = -b, for b B}
- Translation by z:
(A)z = {c | c = a + z, for a A}
Application
10:18 PM
Operation
Def
Effect
Properties
Opening
- A B = (A B) B
(Erosion Dilation)
- Convergence:
(A B) B = A B
- Alternative:
A B = {(B)z | (B)z A}
(Union of all translate of B
fitting into A)
Closing
A B = (A B) B
- Subimage:
ABA
(Dilation Erosion)
- Convergence:
(A B) B = A B
- Subimage:
AAB
- Dual:
(A B)C = AC
Boundary
Extraction
(A) = A - (A B)
Region
Filling
- Procedure:
X0 = p
Xk = (Xk-1 B) AC
Connected
Connected
components
Skeleton
b. Then:
i. D': D' A, D' disk (not necessarily
centered at z) larger than (D)z
ii. (D)z = Max. disk
(k successive erosion of A by B)
K = max{k | A kB = }
11:54 PM
Operations
Effect
- 2-D:
If b(x, y) > 0 x, y:
(f b)(s, t) = max{f(s - x, t - y) + b(x, y) | (s - x, t - y)
Df ; (x, y)
Db}
- 1-D:
Erosion
Df ; x
D b}
- 2-D:
If b(x, y) > 0 x, y:
Df ; (x, y)
D b}
Df ; x
D b}
- Dilation-Erosion relation:
(f b)c(s, t) = (fc )(s, t)
fc(x, y) = -f(x, y)
(x, y) = b(-x, -y)
Opening - f b = (f b) b
Closing
- f b = (f b) b
Applications
Def
Morphological smoothing
Morphological gradient
Granulometry
g = (f b) b
g = (f b) - (f b)
(Opening Closing)
Effect
Image Segmentation
Sunday, March 20, 2016
6:50 PM
f = Input image
w2
w3
w4
w5
w6
w7
w8
w9
Line Detection
3x3 Mask:
|R| = |2f(x, y)| T Point detected
Edge Detection
Thursday, March 24, 2016
5:54 PM
Edge models
Type
Step
Roof
Ramp
Illustration
Gradient operator
- Strategies:
f(x, y): Detect presence of edge
Sign of 2f(x, y): Detect whether edge pixel
on dark/brige side
Zero-crossing property of 2f(x, y): Locate
center of thick edge
-
- Limitation: Noise
Solution: Smooth image first
Horiz
Gx
Vert
Gy
Prewitt
Sobel
-1
-1
-1
-1
-1
-1
-1
Gy
+45
(f * h) = f *
(h)
-1
-1
-2
-1
-1
-2
16
-2
-1
-1
-2
-1
-1
-45
-1
-1
-1
-2
-1
-1
-1
-1
-1
-1
-2
-1
-1
-1
-2
-1
-1
-1
5:52 PM
= x0cos + y0sin
E, A, D = Threshold
- Param range:
(D = Max. image dimension)
-90 90
[-90, 90]
5:53 PM
- Assumption:
Image f(x, y): Light object + Dark background
Histogram: 2 groups of intensity
- Objective: Select threshold T Clearly separate
these groups
- Assumption:
Histogram is mixture of 2 distribution
1. Problem:
Given a histogram, how to model it using multiple Gaussian
distributions
E(T) min w1p(T | 1) = w2p(T | 2)
If p(z | k) k are Gaussian distributed with same sd:
Then:
2. Relations:
- n different gray lvl: z1, z2, , zn
p(zk) = Prob of occur of gray lvl zk
= No of pixel of gray lvl zk
N = f1 + f2 + + fn: Total no of pixels
- Compute
Watershed Segmentation
Wednesday, March 30, 2016
10:14 AM
1. Definition:
- g(x, y): Grad. Image
- min = min{g(x, y)}, max = max{g(x,y)}
- M1, M2, , MR: Regional minima of g(x, y)
- Cn(Mi) = Set of POINTS in catchment basin of Mi that will be
flooded at step n
-
- Tn = {(s, t) | g(s, t) < n}: Set of POINTS with grad mag < n
- Qn = Set of CONNECTED COMPONENTS in Tn
- B: 3x3 structuring element
2. Algorithm:
- Initialization: Cmin(M1), Cmin(M2), , Cmin(MR)
- Run n = (min + 1) (max + 1). At step n:
For each q Qn:
Case 1: q Cn-1 = :
New regional minimum detected
q MR+1, R R + 1
Cn(MR+1) = q
10:14 AM
- Idea:
Compare 2 images acquired at different time pixel by
pixel.
Subsequent image subtracted from reference image:
- Implementation:
f(x, y, t1): Reference frame
f(x, y, t2), , f(x, y, t n): Subsequent frames
Absolute ADI:
dij: Difference image
f(x, y, ti): Reference frame, taken at time ti
Positive ADI:
Assumption:
f(x, y, ti), f(x, y, tj) same scene
Solution - Island Removal: Remove all 4-/8connected region of 1's having < Predefined
no of 1's
Give limited info about motion: Motion direction +
speed not easily estimated
- Observations:
Positive ADI: Non-zero area
Size = Size of moving object
Location = Location of moving object in reference frame
10:15 AM
:
Contour can be open/close
c > 0: const
G * I: Image convolved with Gaussian
smoothing filter of sd
Contour
- Theorem:
Lagrange equation:
- Matrix form:
A: Matrix in terms of ,
- Matrix form:
A: Matrix in terms of ,
seek the boundary the the shape correctly despite the noisy
background
Image Registration
Tuesday, May 3, 2016
11:20 AM
Image Registration
a. Translation:
Medical imaging
Accommodate tissue deformation in image-guided
surgery
Satellite image repairing
- General method:
- x-axis:
- y-axis:
c. Translation + Rotation:
-
b. Shearing:
Objective Functions
1. External markers
Optimization method
1. Problem:
2. Internal markers
a. Surface-based
Segmentation
Find
b. Edge-based
- Edges extracted based on gradient function Guide
transformation
2. Powell's method:
- Initialization:
n basis vector
Starting point
: Gaussian-smoothed image
: Input image
significantly small:
min
T
Set
Set
Multi-start approach:
outliner effect
- Correlation coefficient (CC):
: Mean
-1 CC 1
Image Compression
Tuesday, May 3, 2016
Data redundancy
11:20 AM
1. Coding redundancy:
- Different symbols can be encoded using different no. of bits
Basic Concepts
- Related measurements:
Avg no of bits:
r = Discrete rand var in [0, 1]
kth gray lvl (k = 0, 1, 2, , (L - 1)):
pr(rk)
Compression ratio:
Code scheme 2
(Fix-length)
(Variable length)
l2(rk)
r0 = 0/7 0.19
000
11
r1 = 1/7 0.25
001
01
r2 = 2/7 0.21
010
10
r3 = 3/7 0.16
011
001
r4 = 4/7 0.08
100
0001
r5 = 5/7 0.06
101
00001
r6 = 6/7 0.03
110
000001
r7 = 7/7 0.02
111
000000
Lavg
2. Interpixel redundancy:
- Adjacent pixel values can be reasonably predicted from current pixels
Fidelity Criteria
Rating
Description
Fine
Passable
6
2.7
Passable
Interior
n2 = 1216611 = 133826
Image Compression Model
3. Psychovisual redundancy
- Certain info relatively less important than other to human visual Can be
removed, but irreversible
Human eye sensitive to distinguishing features (edges, patterns, ) but
not detailed quantitative info of image
- Quantization:
Map intensity values broad narrow range
CR, but Image quality (false contour, )
- Improved grayscale (IGS) quantization:
Compensate for degraded visual impact due to quantization
- Source encoder: Remove redundancies
Mapper: Transform input data into interpixelredundancy-reduced format
Quantizer:
Mechanism:
Add some amount of locally-dependent random to pixel's gray lvl
before quantization
How to create locally-dependent random:
Procedures:
Initialization: Sum = 0
For each pixel:
- Implementation:
Input: b3b2b1b0
Output: h1h2h3h4h5h6h7
h1 = b3 b2 b0
Pixel
Gray lvl
Sum
IGS Code
h2 = b3 b1 b0
i-1
n/a
0000 0000
n/a
h3 = b3
Output: h1h2h3h4h5h6h7
h1 = b3 b2 b0
Pixel
Gray lvl
Sum
IGS Code
h2 = b3 b1 b0
i-1
n/a
0000 0000
n/a
i+1
i+2
i+3
h3 = b3
h4 = b2 b1 b0
h5 = b2
h6 = b1
h7 = b0
Error detection & correction:
c4 = h1 h3 h5 h7
c2 = h2 h3 h6 h7
c1 = h4 h5 h6 h7
x = c4c2c1(2)
h1 = b3 b2 b0 = 1 0 0 = 1
h2 = b3 b1 b0 = 1 1 0 = 0
h4 = b2 b1 b0 = 0 1 0 = 1
Receiver input h1h2h3h4h5h6h7 = 1011110
c4 = h1 h3 h5 h7 = 1 1 1 0 = 1
c2 = h2 h3 h6 h7 = 0 1 1 0 = 0
c1 = h4 h5 h6 h7 = 1 1 1 0 = 1
x = c4c2c1(2) = 101(2) = 5
h5 = 1 corrupted, SHOULD BE h5 = 0
* NOTE: X = t1 t2 tn: XOR operation
X = 1 if ODD no of 1's in t1, t2, , tn
X = 0 if EVEN no of 1's in t1, t2, , tn
X called even-parity-bit: Set {t1, t2, , tn} {X} has
EVEN no of 1's
Lossless Compression
Tuesday, May 17, 2016
4:42 PM
- Features:
Interpixel redundancies of closely spaced pixels by coding only
new info of each pixel
Huffman Encoding
Predictor:
- Implementation:
Order probs of symbols in descending order
- Encoder:
Input: Image f1, f2, , fN
Output: f1, f2, , fm, em+1, em+2, , em
en = fn - f'n (Prediction error)
No quantization of en Lossless
Decoding: 010100111100
01010
0111
00
a3
a1
a2
a2
a6
- Decoder:
Input: f1, f2, , fm, em+1, em+2, , em
Output: f1, f2, , fm, fm+1, fm+2, , fm
(f1, , fm known)
Lossy Compression
Tuesday, May 17, 2016
11:02 PM
Transform Coding
- Features:
- Encoder:
Input: Image f1, f2, , fN
Forward DCT:
e'n = Quantize(en)
Inverse DCT:
- Decoder:
Input: f1, f2, , fm, e'm+1, e'm+2, , e'm
Output: f1, f2, , fm, f''m+1, f''m+2, , f''m
X1 = f1, , Xm = fm
- Encoding procedures:
Sub-image size n:
Should be n = 2k Apply fast transform algorithm O(nlogn)
n Compression, + Computational complexity
Ideal (empirical testing): n = 8, 16
* NOTE: f''n fn
- Delta Modulation (simple lossy coding)
Encoder:
f''1 = f1
f'n = f''n-1, en = fn - f'n, f''n = f'n + e'n
Quantization:
- Encoding:
- Decoding:
- Decoding:
11:20 AM
- Concepts:
Integral image ii:
Sum of pixel intensity values above & left of (x, y), inclusive
- Neural network
Input:
D = (A + B + C + D) - (A + C) - (A + B) + A
Output: Face/Non-face
3 types:
2-rectangle
3-rectangle 4-rectangle
: Training image
: Classification function utilizing rectangular feature
Strong classifier:
: Training data (i = 1, 2, , N)
: Training image
Face Recognition
For t = 1, 2, , T:
Normalize all weights:
- Eigenfaces:
Give set of N mn-size images, each represented by 1D
vector of dimen mn
Select weak classifier with minimum error:
Mean image:
Scatter matrix:
Reweight each examples:
Final strong classifier:
: Eigenfaces
Face detection:
Face
If is face, find closest labeled face based on nearest
neighbor in t-dimen space
Iris Recognition
Thursday, May 19, 2016
Step
no
Step
Iris Image
Acquisition
5:30 PM
Objectives
Method
Daugman system
Iris
Localization
Pattern
matching :
Alignment
[0, 2)
(xp(0, ), yp(0, )): Coordinates of pupillary boundary in
direction
Pattern
Choose a representation of aligned iris patterns that makes Laplacian pyramind + Laplacian of Gaussian filter:
matching:
their distinctive patterns apparent
Laplacian of Gaussian (LoG) filter:
Representation
: Radial dist of a point from filter's center
: sd
Laplacian pyramid:
Pattern
matching:
Goodness of
Match
- Normalized correlation
p1(i, j), p2(i, j): 2 image of size nm
For each image pk:
Pattern
matching Decision
- Strategy formulation:
Training data: Extracted from database
Authentic class (A): Database entry derived from same iris as
the newly acquired
Imposter class (I): Database entry derived from different iris with
newly acquired
Imagine you can make binary decision along a line:
are 44 matrix
Optimization: