imgp roc 04 local op
Post on 11-Jan-2016
228 Views
Preview:
DESCRIPTION
TRANSCRIPT
Image Processing:Local Operators
Local operatorsConvolutionsSmooting and BluringEdge detectionSharpeningNon Linear filters
© 2004 Rolf Ingold, University of Fribourg
Image processing operations
Classification of image processing operations Point operation Local operationGlobal operation
A operator is local if each pixel in the result image depends only on this pixel and its neighborhood in the source image
(x,y)V(x,y)
© 2004 Rolf Ingold, University of Fribourg
Shift-invariant operator
An local operator φ is said shift-invariant if it has the following property
A shift invariant local operator can be characterized by a function fsuch as
)]},[({],[ ],[],[ yxVvuvuIfyxJ ∈=
]),[(],[]),[(],[ 0000 yyxxIyyxxJyxIyxJ −−φ=−−⇒φ=
© 2004 Rolf Ingold, University of Fribourg
Linear operators
An operator φ is said linear if it has the following property
As special cases
( ) )(.)(... JbIaJbIa φ+φ=+φ
( ))()(
)()(IaaI
JIJIφ=φ
φ+φ=+φ
© 2004 Rolf Ingold, University of Fribourg
Convolution in continuous space
The convolution of two bidimensional signals is defined as followsin a 1D continuous space
example
in a 2D continuous space
∫ ∫∞+
∞−
∞+
∞−−−=⊗ dudvvyuxgvufyxgyxf ),(),(),(),(
x
f(x)
0
1
x
g(x)
0
1
x
f(x) *g(x)
0
1
∫∞+
∞−−=⊗ duuxgufxgxf )()()()(
© 2004 Rolf Ingold, University of Fribourg
Convolution in discrete space
The convolution of two discrete signals is defined as followsin the 1D case
in the 2D case
The convolution can be understood as a sum of shift and multiplyoperations
( ) ∑ ∑∞+
−∞=
∞+
−∞=−−=⊗
u vvyuxgvufyxgf ],[],[],[
( ) ∑ ∞+
−∞=−=⊗
uuxgufxgf ][][][
© 2004 Rolf Ingold, University of Fribourg
Convolution kernel
In digital image processing, convolution based operators are usually defined on windows
centered at origin [0,0]bounded to [-m,+m]×[-n,+n]
The convolution of an image I by a kernel h is expressed as
the output pixel value is the weighted sum of the pixels in the neighborhood of correponding input pixelthe matrix containing these weights is called convolution kernel or convolution mask
( ) ∑ ∑+
−=
+
−=−−=⊗
m
mu
n
nvvyuxIvukyxIk ],[],[],[
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
++++−
+−
−+−−−
=
],[],0[],[
]0,[]0,0[]0,[
],[],0[],[
nmknknmk
mkkmk
nmknknmk
k
KK
MOMNM
KK
MNMOM
KK
© 2004 Rolf Ingold, University of Fribourg
Convolution at the border
The convolution of an image I with dimension w×h is well defined in a domain (w-m)×(h-n)What values should be assigned to I[x,y] for x<0, x≥w, y<0, or y≥h ? There are several solutions
extend the images with a constant extend the image periodicallyextend the image by mirroring it at its boundaries extend the values at the boundaries indefinitely
© 2004 Rolf Ingold, University of Fribourg
Convolution normalization
Result values should stay in the same intensity range as the input image
they can be truncated to upper and lower boundsthey can be normalized by a factor and an offset
In the case of only positive coefficients the factor should be
∑vu
vuk,
],[1
© 2004 Rolf Ingold, University of Fribourg
Convolution properties
The convolution is linear
The convolution is commutative and associative (provided that, at the border kernel and image are extended with a 0 constant)
The convolution is shift independent
( ) )*()*(..* JkbIkaJbIak +=+
)*(*)*(**)*(** 12212121 IkkIkkIkkIkk ===
],)[*(],)[*(],[],[ 0000 yyxxIkyxJkyyxxIyxJ −−=⇒−−=
© 2004 Rolf Ingold, University of Fribourg
Complexity of the convolution
Using the definition, computing the convolution ofan image I with dimension w×h with a convolution kernel of size (2m+1)×(2n+1)
has a complexity of O(m×n×w×h)
© 2004 Rolf Ingold, University of Fribourg
Separable kernel
A convolution kernel is said separable if it can be written as
where hx is a matrix of size 1×(2n+1) and hy a matrix of size (2m+1)×1Thus the convolution can be computed using
In this case the complexity of the convolution is reduced to O((m+n)×w×h)
yx kkk ⋅=
( ) ( )∑ ∑+
−=
+
−=−−=⊗⊗=⊗
m
mu
n
nv yxyx vyuxIvkukIkkyxIk ],[][][)(],[
© 2004 Rolf Ingold, University of Fribourg
Applications of local operators
Local operators are used to perform image filtering such as smooting and bluringnoise removal or noise reducing edge detectionsharpening
© 2004 Rolf Ingold, University of Fribourg
Mean Filter
The mean filter (or uniform filter) is a based on a simple convolution that computes for each pixel the mean value of its neighbors
kernels vary in shape and sizeMean filters are used for smoothing and noise reducing
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
111111111
91
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
1111111111111111111111111
251
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
0111011111111111111101110
211
© 2004 Rolf Ingold, University of Fribourg
Pyramidal and Cone filters
Pyramidal and cone filters generalize mean filters by using weightswheights decrease with the distance to the center
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
111141111
121
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
0121012321234321232101210
401
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
1232124642369632464212321
811
© 2004 Rolf Ingold, University of Fribourg
Gaussian smoothing
The 2D Gaussian has the following equation
For smoothing, Gaussian filters have become very popularseveral kernel may be used, for different values of σ
Gaussian kernels are separable
22
22
221),( σ
+−
πσ=
yx
eyxG
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
01210158512813821585101210
811
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
121242121
121
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
131383131
241
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
1353131423143523382353142314313531
2341
( )⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛=
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛⊗
121242121
121
121 ( )
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
≅
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
⊗
1353131423143523382353142314313531
834.0739.3164.6739.3834.0
834.0739.3164.6739.3834.0
© 2004 Rolf Ingold, University of Fribourg
Gradient kernels
Gradient kernels (first order derivative) are directional andused to detect horizontal or vertical edges
The gradient can be computed as
its magnitude is
The simplest gradient kernels would bethey lead to phase shifts cannot computed horizontaly and verticaly at the same point !
As alternative the Roberts kernel may be used
( )101−=xh⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−=
101
yh
⎟⎟⎠
⎞⎜⎜⎝
⎛⊗⊗
=∇],)[(],)[(
],[yxIhyxIh
yxIy
x
22 ]),)[((]),)[((],[ yxIhyxIhyxI yx ⊗+⊗=∇
( )11−=xh ⎟⎠
⎞⎜⎝
⎛−=
11
yh
⎟⎠
⎞⎜⎝
⎛−
=0110
2h⎟⎠
⎞⎜⎝
⎛−=
1001
1h
© 2004 Rolf Ingold, University of Fribourg
Prewitt and Sobel filters
Prewitt and Sobel have proposed two filters which combine derivation and smoothing in orthogonal directions
Prewitt kernels
Sobel kernels
An offset of 0.5 is often added to display the results
( )⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−−
=−⊗⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛=
101101101
31101
111
31
xh ( )⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛ −−−=
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−⊗=
111000111
31
101
11131
yh
( )⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−−
=−⊗⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛=
101202101
41101
121
41
xh ( )⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛ −−−=
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−⊗=
121000121
41
101
12131
yh
© 2004 Rolf Ingold, University of Fribourg
Illustration of gradient filters
Originale image, filtered horizontaly and verticaly by simple gradient and Sobel kernels, then combined together to get the magnitude
© 2004 Rolf Ingold, University of Fribourg
Laplacian kernel
Laplacian kernels (second order derivative) consist of
The most popular Laplacian filter is
The following alternative kernels are also used for Laplacian filters
Laplacian filters are very sensitive to noiseTherefore they are often combined with a Gaussian smoothing filter
fhfhyf
xff yx ⊗+⊗=
∂∂
+∂∂
=∇ 22222 ( )1212 −=xh
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−=12
1
2yh
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−=+
010141010
)( 22 yx hh
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−
111181111
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−−
−−
121242121
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−
101040101
© 2004 Rolf Ingold, University of Fribourg
Laplacian kernel
The effect of a Laplacian filter is explained by the 2nd derivative
Illustration of the Laplacian filter with different additive offsets: 0, 1, 0.5
© 2004 Rolf Ingold, University of Fribourg
Laplacian of Gaussian
The Laplacian of the 2D Gaussian has the following equation
A possible kernels is
22
22
2
22
4 211),( σ
+−
⎟⎟⎠
⎞⎜⎜⎝
⎛σ+
−πσ
−=∇yx
eyxyxG
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
−
01110130311024011303101110
© 2004 Rolf Ingold, University of Fribourg
Illustration of edge detection by Laplacian
Original images, the result of a Lapacian kernel, then thresholded
© 2004 Rolf Ingold, University of Fribourg
Sharpening
Sharpening the edges of an image consists inisolating the edges and amplifying them then adding them back to the original image
Result is obtained by adding the identity to the inverse of the Laplacian
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−−
−
010151
010
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−−−−−−−
111191111
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−−
−
121252
121
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−−
−
0202112
020
31
Original images, inverse of Lapacian, addition, and result of right kernel above
© 2004 Rolf Ingold, University of Fribourg
Statistical filters
Consider the ordered set of pixel values in the neighborhood of [x,y]
where z(1) § z(2) § ... § z(N×N). Given a weight vector W, the result value can be computed as a weighted sum
As special cases, we considerminimum filter : w1 = 1, wi = 0 "i ∫ 1maximum filter : wN×N = 1, wi = 0 "i ∫ N × Nmédian filter : w(N×N+1)/2 = 1, wi = 0 "i ∫ (N × N + 1) / 2
Z[x, y] = {I[u,v]}[u,v]∈V[x ,y] = {z(1) [x,y], z(2)[x, y],..., z(N× N )[x, y]}
StatW (I)[x, y] = wi ⋅z(i )[x,y]
i =1
N×N
∑
© 2004 Rolf Ingold, University of Fribourg
Median Filter
The median filter consists in replacing each pixel by then the median value of its neighbors
the neighborhood is determined by a binary mask
Original noisy image, filtered by a mean filter and a median filter
© 2004 Rolf Ingold, University of Fribourg
Conservative Smoothing
Conservative smoothing simply ensures that each pixel value is bounded within the range of intensities defined by its neighbors
the neighborhood is determined by a binary mask
© 2004 Rolf Ingold, University of Fribourg
Morphological operators
Given an image I and a mask Merosion is defined as
dilation is defined as ]}0,0[,|],[],[{],)[( VvuvuMvyuxIMaxyxIDilM ∈−−−=
]}0,0[,|],[],[{],)[( VvuvuMvyuxIMinyxIEroM ∈−−−=
Original noisy, the results of erosion and dilation
top related