Dip S8ece Module4
Dip S8ece Module4
• Image Restoration –
• Degradation model –
• Inverse filtering –
• Wiener Filter –
• Interactive restoration –
• Image analysis & vision -basic
principles only.
Outline
Image Restoration
• Image enhancement vs. restoration
• Degradation model
– Noise only
– Linear, space-invariant
• General approaches
– Inverse filters
– Wiener filters
3
IMAGE RESTORATION
• The main objective of restoration
is to improve the quality of a
digital image which has been
degraded due to Various phenomena
like:
•
Image degradation can
occur…..
• Motion
• Improper focusing of Camera during
image acquisition.
• Atmospheric turbulence
• Noise
Blurring due to uniform motion
Degradation due to Atmospheric turbulence
Degradation due to noise
Noise models – periodic noise
10
Image enhancement vs. restoration
11
Enhancement vs. Restoration
• Remove
“Better”effects
visual representation
of sensing environment
• Objective
Subjective
• No
Mathematical,
quantitativemodel
measures
dependent quantitative
measures
General approaches
13
Degradation Model
• Given g(x,y), some knowledge about the
f ( x, y ) ( x, y )
degradation function h(x,y), and some ( x , y )
knowledge about the additive noise term
• -- objective
f ( x , y: )to obtain an estimate of the original
Frequency domain
imageSpatial domain
14
Degradation models : noise only
g ( x , y ) f ( x , y ) ( x, y )
G (u, v) F (u, v) N (u, v)
• Images are often degraded by random noise
• Noise models
– Spatial characteristics (independent or
dependent)
– Intensity ( distribution, spectrum)
• Uniform, Gaussian, Rayleigh, Gamma (Erlang),
Exponential, impulse
– Correlation with the image (additive,
multiplicative)
15
Noise Models
• Noise can occur during
– image capture,
– transmission or processing,
16
Noise Models
• Most types of noise are
modeled as known probability
density functions
• Noise model is decided based
on understanding of the
physics of the sources of
noise.
– Gaussian: poor illumination
– Rayleigh: range image
– Gamma, exp: laser imaging
– Impulse: faulty switch during
imaging,
– Uniform is least used.
• Parameters can be estimated
Noise Removal Restoration
Method
• Mean filters • Adaptive filters
– Arithmetic mean filter – Adaptive local noise
– Geometric mean filter reduction filter
– Harmonic mean filter – Adaptive median filter
– Contra-harmonic mean
filter
• Order statistics filters
– Median filter
– Max and min filters
– Mid-point filter
– alpha-trimmed filters
Gaussian (Normal) noise
• A very good
approximation of
noise that occurs
in many practical
cases
• Probability density
of the random
variable is given by
the Gaussian
function 19
Rayleigh noise
• Note
– The
displacement
from the origin
(Gaussian)
– The shape is
skewed to the
right
20
Gamma noise
• a > 0, b :
positive integer
• Laser imaging
21
Images & histograms
resulting from adding noises
22
Exponential noise &
Uniform noise
• Exponential
noise
• Uniform noise
23
Impulse noise (Salt and
Pepper Noise)
• Appearance is
randomly
scattered white
(salt) or black
(pepper) pixels
over the image
24
Images & histograms
resulting from adding noises
25
Periodic Noise
• It irises typically from electrical or
electromechanical interference during
image acquisition
• Periodic noise can be reduced significantly
– via frequency domain filtering
• The Fourier transform of a pure sinusoid :
– a pair of conjugate impulses located at the
conjugate frequencies of the sine wave
• Only periodic noise is global effect.
• Others can be models as local degradation
26
Image corrupted by
sinusoidal noise
Image corrupted
by sinusoidal
noise
28
Estimation of Noise
Parameters
• The shape of the histogram identifies
the closest PDF match
– get mean & variance of the gray levels
– use mean & variance to solve for the
parameters a & b
• Gaussian noise : mean & variance only
• Impulse noise : the actual probability of
occurrence of white & black pixels are needed
29
Restoration in the Presence of
Noise Only – Spatial Filtering
• The only degradation present in an image is noise
– Noise : unknown cannot be subtracted from
image or Fourier spectrum
31
Mean filters (Ⅱ)
• Geometric :
– Smoothing is comparable to arithmetic mean
– Tend to lose less image detail
33
Order-Statistics Filter (Ⅱ)
– Midpoint filter : works best for Gaussian or
uniform noise
• Order statistics + averaging
1
f x , y max g x a , y b min g x a , y b
2 a ,b S a , b S
Corrupted by pepper-
and-salt noise 1st time
35
Demo2
original Corrupted by
pepper noise
36
Order-Statistics Filter: Drawback
• Relatively expensive and complex to
compute. To find the median it is
necessary to sort all the values in the
neighborhood into numerical order and
this is relatively slow, even with fast
sorting algorithms such as quicksort
37
Adaptive Filtering (Ⅰ)
• Changing the behavior according to the
values of the grayscales under the mask
2
mf 2 2
g m f
f
f g
Current
Mean under Variance of grayscale
the mask the image
Variance under
the mask
38
Adaptive Filtering (Ⅱ)
• If 2f is high, then the fraction is close
to 1; the output is close to the original
value g
– High 2f implies significant detail, such as
edges
mf
• If the local variance is low, such as the
background, the fraction is close to 0; the
output is close to 2
f
mf 2 2
g m f
f g 39
Adaptive Filtering:
•
2
g
Variation
is often unknown, so is taken as the
mean of all values of 2f over the
entire image
• In practice, we adopt the slight variant :
max 0 , 2
g2
mf
f
g m
max ,
2 2 f
f g
• 3 purposes :
– Remove salt-and-pepper noise
– Smooth other noise that are not be impulsive
– Reduce distortion( e.g., excessive
thinning/thickening of object boundaries) 40
Demo (7x7 mask)
Corrupted by
original Gaussian noise
with
variance=1000
Adaptive filtering
Mean filter
41
Noise models – examples
42
Noise models – examples
43
Noise models – periodic noise
44
Estimation of Degradation Model
Degradation model:
g ( x, y ) f ( x, y ) h( x, y ) ( x, y )
or
G(u, v ) F (u, v ) H (u, v ) N (u, v )
Purpose: to estimate h(x,y) or H(u,v)
Methods:
1. Estimation by Image Observation
2. Estimation by Experiment
3. Estimation by Modeling
Estimation by Image Observation
Original image (unknown) Degraded image
Observation
DFT Subimage
Estimated Transfer
function Gs (u, v ) g s ( x, y )
Restoration
G ( u, v ) process by
H ( u, v ) H s ( u, v ) s estimation
Fˆs (u, v )
DFT Reconstructed
This case is used when we ˆ
F ( u, v )
know only g(x,y) and cannots
Subimage
repeat the experiment!
fˆs ( x, y )
Estimation by Experiment
Used when we have the same equipment set up and can repeat the
experiment.
Response image from
Input impulse image the system
System
H( )
A ( x, y ) g ( x, y )
DFT DFT
Atmospheric
Turbulence model
k ( u 2 v 2 )5 / 6
H ( u, v ) e
k = 0.0025
k = 0.001 k = 0.00025
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Estimation by Modeling: Motion Blurring
Assume that camera velocity is ( x0 (t ), y0 (t ))
The blurred image is obtained by
T
g ( x, y ) f ( x x0 (t ), y y0 (t ))dt
0
where T = exposure time.
j 2 ( ux vy )
G ( u, v ) g ( x , y ) e dxdy
T j 2 ( uxvy )
f ( x x0 (t ), y y0 (t ))dt e dxdy
0
T
f ( x x0 (t ), y y0 (t ))e j 2 ( ux vy )
dxdy dt
0
Estimation by Modeling: Motion Blurring (cont.)
T
G (u, v ) f ( x x0 (t ), y y0 (t ))e j 2 ( ux vy )
dxdy dt
0
T
F (u, v )e j 2 ( ux0 ( t )vy0 ( t )) dt
0
T
F (u, v ) e j 2 ( ux0 ( t ) vy0 ( t )) dt
0
Then we get, the motion blurring transfer function:
T
H (u, v ) e j 2 ( ux0 ( t )vy0 ( t )) dt
0
T
H ( u, v ) sin( (ua vb))e j ( uavb )
(ua vb)
ˆ G ( u, v ) N (u, v )
F ( u, v ) F ( u, v )
H ( u, v ) H ( u, v )
Noise is enhanced
when H(u,v) is small.
To avoid the side effect of enhancing
noise, we can apply this formulation
to freq. component (u,v) with in a
radius D0 from the center of H(u,v).
0.0025( u 2 v 2 )5 / 6
H ( u, v ) e
Wiener Filter: Minimum Mean Square Error Filter
Objective: optimize mean square error:
e2 E ( f fˆ )2
Wiener Filter Formula:
H *
( u , v ) S ( u , v )
Fˆ (u, v ) f
2 G ( u , v )
S f (u, v ) H (u, v ) S (u, v )
H * ( u, v )
2 G ( u , v )
H (u, v ) S (u, v ) / S f (u, v )
1 H ( u, v )
2
2 G ( u , v )
H (u, v ) H (u, v ) S (u, v ) / S f (u, v )
where
1 H ( u , v )
2
Fˆ (u, v ) 2 G ( u , v )
H (u, v ) H (u, v ) S (u, v ) / S f (u, v )
Difficult to estimate
Approximated Formula:
2
1 H ( u , v )
Fˆ (u, v ) 2 G ( u , v )
H (u, v ) H (u, v ) K
Practically, K is chosen manually to obtained the best visual result!
Wiener Filter: Example
sh2=650
sh2=325
Note: K is
chosen
manually
sh2=130
Wiener Filtering (Least Mean Square Filtering)
– Goal: to minimize
20 20
– Solution: Frequency selective
40 40
scaling of inverse filter solution!
60 60
2
20 40 60 20 40 60
E f fˆ inverse filter Wiener filter, K=0.2
20 20
40 40
2
ˆ
– White noise, H (uunknown
, v) Sf(u,vG):(u, v) 60 60
F (u, v) 2
20 40 60 20 40 60
H (u, v) S (u, v) / S f (u, v) H (u, v)
2
H (u , v) G (u, v)
Fˆ (u , v) 2
H (u, v ) K H (u , v)
Derivation of Wiener Filters
• Given the degraded image
g, the Wiener filter is an
optimal filter hwin such that
CE f hwin
**g
2
E F (u, v) H win (u, v)G (u, v)
2
E{|| f – hwin**g||2} is
E F (u , v)
2
H win (u, v) E F * (u, v)G (u, v)
minimized.
• Assume that f and are
*
H win
(u , v) E F (u , v)G* (u , v) H win (u, v) E G (u , v)
2 2
uncorrelated zero mean
stationary 2D random
2
2
S f (u, v) H win (u, v) H (u, v) S f (u, v) Sn (u, v)
sequences with known *
H win (u , v) H (u , v) S f (u , v) H win (u , v) H * (u, v) S f (u, v)
power spectrum Sf and Sn.
Thus, Set C/H win (u, v) 0
H * (u , v ) S f (u , v)
H win (u , v) 2
H (u , v) S f (u , v) S n (u, v)
E F (u , v) S (u, v)
2
f
E N (u , v) S (u , v)
2
n
E F (u , v ) N * (u , v )
E F * (u , v) N (u , v) 0
Interactive Restoration
Example 1 (periodic noise):
Manually detect peaks
In the spectrum and
Construct a band-reject
filter.
Modified from
restoration.ppt by
Interactive Restoration
Example 2:
Modified from
restoration.ppt by(a)Original (b) Spectrum (c) IDFT of the peaks (d) Result
IMAGE ANALYSIS
AND COMPUTER
VISION
Why is Computer Vision Difficult?
Dog or Cat?
Any four year old can tell the difference but even
the most sophisticated computers would have
difficulty making the distinction.
Why is Computer Vision Difficult?
• It is a many-to-one mapping
– A variety of surfaces with different material
and geometrical properties, possibly under
different lighting conditions, could lead to
identical images
– Inverse mapping has non unique solution (a lot of
information is lost in the transformation from
the 3D world to the 2D image)
• It is computationally intensive
• We do not understand the recognition
problem
An Industrial Computer Vision System
The Three Processing Levels
• Low-level processing
– Standard procedures are applied to improve image quality
– Procedures are required to have no intelligent
capabilities.
The Three Processing Levels
(cont’d)
• Intermediate-level processing
– Extract and characterize components in the image
– Some intelligent capabilities are required.
The Three Processing Levels
(cont’d)
• High-level processing
– Recognition and interpretation.
– Procedures require high intelligent capabilities.
Computer vision system
(another view)
The role of color
What is this object?
Does color play a role in recognition?
Might this be easier to recognize from a different view?
The role of texture
• Characteristic image texture can help us readily
recognize objects.
The role of shape
The role of grouping
Computer vision
application
Visual Inspection
Character Recognition
Document Handling
Signature Verification
Biometrics
Fingerprint Verification /
Identification
Fingerprint Identification
Research at UNR
Minutiae Matching
Delaunay Triangulation
Object Recognition
Indexing into Databases
• Shape content
Indexing into Databases
(cont’d)
• Color, texture
Target Recognition
• Department of Defense (Army,
Airforce, Navy)
Interpretation of Aerial
Photography
Interpretation of aerial photography is a problem domain in
both computer vision and photogrammetry.
Autonomous Vehicles
• Land, Underwater, Space
Traffic Monitoring
Face Detection
Face Recognition
Face Detection/Recognition
Facial Expression
Recognition
Face Tracking
Hand Gesture Recognition
4-directional 8-directional
chain code chain code
Examples of Chain Codes
Object Boundary
boundary vertices
(resampling)
4-directional 8-directional
chain code chain code
Polygon Approximation
Minimum perimeter
Object boundary
polygon
3. Draw a polygon
Distance-Versus-Angle Signatures
Represent an 2-D object boundary in term of
a 1-D function of radial distance with respect to q.
Boundary Segments
Concept: Partitioning an object boundary by
using vertices of a convex hull.
Partitioned boundary
Object boundary
Skeletons
Obtained from thinning or skeletonizing processes
Skeleton
Boundary Descriptors
1. Simple boundary descriptors:
we can use
- Length of the boundary
- The size of smallest circle or box that can
totally enclosing the object
2. Shape number
3. Fourier descriptor
4. Statistical moments
Shape Number
Shape number of the boundary definition:
the first difference of smallest magnitude 1
The order n of the shape number:
the number of digits in the sequence
2 0
1. Original boundary
Chain code:
000030032232221211
First difference:
300031033013003130
4. Find the nearest
3. Create grid
Shape No.
Grid.
000310330130031303
Fourier Descriptor
Fourier descriptor: view a coordinate (x,y) as a complex number
(x = real part and y = imaginary part) then apply the Fourier
transform to a sequence of boundary points.
1 K 1
Fourier descriptor : a (u ) s(k )e 2uk / K
K k 0
Reconstruction formula
1 K 1
s(k ) a (u )e2uk / K
K k 0
Boundary
points
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: Fourier Descriptor
Examples of reconstruction from Fourier descriptors
P 1
1
sˆ(k )
K
a
k 0
( u ) e 2uk / K
P is the number of
Fourier coefficients
used to reconstruct
the boundary
where K 1
m ri g ( ri )
i 0
Boundary
segment
1D graph
A( R )
C 2
P ( R)
where A(R) and P(R) = area and perimeter of region R
Example: a circle is the most compact shape with C = 1/4p
2. Topological Descriptors
3. Texture
4. Moments of 2D Functions
Example: Regional Descriptors
% of white pixels
Region no. compared to the
total white pixels
1 20.4%
2 64.0%
3 4.9%
4 10.7%
E CH
E = -1
V Q F C H E
E = -2
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: Topological Descriptors
ginal image:
ared image After intensity
Washington Thresholding
area (1591 connected
components
with 39 holes)
Euler no. = 1552
The largest
After thinning
connected
area
(8479 Pixels)
(Hudson river)
B C
A
B
C
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Fourier Approach for Texture Descriptor
Concept: convert 2D spectrum into 1D graphs
Fourier
Original FFT2D Divide into areas
coefficient
image +FFTSHIFT by angles
image
R0
S ( ) Sr ( )
r 1
Original 2D Spectrum
image (Fourier Tr.)
S (r ) S(q)
m pq x p y q f ( x, y ) m10 m01
x y
x y m00 m00
The central moments of order p + q
pq ( x x ) p ( y y ) q f ( x, y )
x y
pq pq
pq where 1
00 2
Invariant moments: independent of rotation, translation, scaling,
and reflection