Image Processing and Edge Detection Masks by benbenzhou


Image Processing and Edge Detection Masks

More Info
Image Processing and Edge Detection
Computer Vision ©Department of Computing, Imperial College
GZ Yang and DF Gillies •
Image Pre-processing
Pre-processing is an operation with images at the lowest level of abstraction - both input and
output are intensity images. Image pre-processing methods generally involve the use of the
considerable redundancy in images. Neighbouring pixels corresponding to one object in real
images have essentially the same or similar brightness value, so if a distorted pixel can be
picked out from the imag. It can usually be restored as an average value of neighbouring
pixels. General pre-processing methods can be categorised into three groups depending
upon the use of a priori information:
No knowledge about the nature of the degradation is used, only very general
properties of the degradation are assumed.
Knowledge about the properties of the image acquisition device and the conditions
under which the image was obtained are employed, the nature of noise is sometimes
Knowledge about the objects that are searched for in the image is used to guide and
simplify the pre-processing process.
Elementary noise reduction
Local average:
g(ij)=— Y f(m, n)
W{m, «)(?%
To prevent the change taking place unless the pixel is considerably different to its neighbours,
the following refinement can be made:
gl(Sj)=g(iV), if \f(ij)~g(ij)\>T; otherwise, g/(ij)=f(ij)
where T is a predefined threshold value.
Median filtering:
Instead of calculating the mean inside the window, the median value is used for median
filtering, i.e.,.
g(ij) = med
It requires at least a partial sort of the pixels in the window.
K-closest averaging:
The pixels in the window are ordered and the K pixels closest in intensity to the target pixel
are averaged. (Question: what is the advantage ? )
Convolution and convolution masks
Convolution defines a way of combining two functions. In the most genera! form it is defined
as a continuous integral which in one-dimension is:
g(x) =Jf(u)h(u-x)du
or in two-dimensions:
g(x,y)=j" Jf(u,v)h(u-x,v-y) dudv
The function h{*) in the above equations is usually called a filter.
If both f(») and h{») are discrete, the convolution integral simplifies to:
{m,n) eH
Usually the convolution kernel h(») only has non-zero value in a small neighbourhood Q, and
is also called a convolution mask. Rectangular neighbourhoods Q are often used with an odd
number of pixels in rows and columns, enabling the specification of the central pixel of the
neighbourhood. The local average process mentioned in the previous section can then be
expressed in terms of convolution of the original image with mask
1 1 1
1 1 1
1 1 1
Structure adaptive filtering
Most smoothing methods use a fixed convolution mask for the whole image, with no
consideration of local structure changes. This may result in images with a loss of fine structure
Averaging according to inverse gradient
The convolution mask is calculated at each pixel according to the inverse gradient, the idea
being that the brightness change within a region is usually smaller than between neighbouring
regions. The inverse gradient 5 at the point (m,n) with respect to (i,j) is defined as:
§(ij,m,n) -< |f(m,ri) -f(Q) \
2, otherwise.
the inverse gradient 5 is then in the interval (0,2], and 5 is smaller on the edge than in the
interior of a homogeneous region. Weight coefficients in the convolution mask h are
normalized by the inverse gradient, and the whole term is multiplied by 0.5 to keep brightness
values in the original range:
the convolution mask coefficient corresponding to the central pixel is defined as h(i,j) = 0.5.
This method assumes sharp edges during the noise removal process.
Averaging using a rotating mask
This is another method that avoids edge blurring by searching for the homogeneous part of
the current pixel neighbourhood, and gives a sharpened output image. The process starts
with calculating dispersion in the mask for all possible mask rotations about a given pixel (i,j)
according to the following equation:
s2=- { E E MD
K{k. OeH
The mask with minimum dispersion is then chosen to perform the averaging process.
Edge Detection
Edge detection is to examine whether one e!dge passes through or near a given pixel. This
is done by examining the rate of change of intensity near the pixel - sharp changes (steep
gradients) are good evidence of an edge, slow changes will suggest the contrary.
Roberts operator
The convolution masks used by Roberts operator are:
1 0
0 1
0 -1 '
-1 0
the outputs are then combined to give the edge strength and direction.
Prewitt operator
1 1 1
0 1 1
-1 0 1
ht =
0 0 0
' ^2
-101, h3=
-1 -1 0
-10 1.
-1 -1 -1
-1 0 1
Sobel operator
1 2 1
0 1 2
-1 0 1
0 0 0, h2=
-1 -2 -1
-101, h^=
-2 -1 0
-2 0 2.
-1 0 1
Robinson operator
1 1 1
1 1 1
-1 1 1
k< =
1 -2 1
, /*2= -1-2 1, ft3 =
-1 -1 1
-1-2 1.
-1 -1 -1
-1 1 1
Kirsch operator
3 3 3
3 3 3
-5 0 3 , h^ =
-5 -5 3
-5 3 3
h,= 3 0 3
, h2
-5 0 3.
-5 -5 -5
-5 3 3
Laplace operator
The Laplace operator V2 is usually used for approximating the second derivative of f(i,j). A 3x3
mask h is often used; for 4-neighbourhoods and 8-neighbourhoods it is defined as
0 1 0
1-41 , h=
0 1 0
1 1 1
1 -8 1
1 1 1
3.4 Marr-Hildreth Edge Detector
From neurophysiological experiments,
boundaries are the most important cues that link an intensity image with its interpretation. He
proposed the use of zero crossings of the second derivative for accurate edge detection
(Marr-Hildreth edge detector). The first derivative of the image function should have
extremum at the position corresponding to the edge in the image, so the second derivative
should be zero at the same position, however, it is much easier and more precise to find a
zero crossing position than an extremum. The operator can be represented by the following:
Marr concluded in the seventies that object
LoG =V2{G(x,y,a) */(x,y)}
where LoG stands for Lapiacian of Gaussian, and G is given by
G(x,y,o)=——e "(*2*' W.
The order of performing differentiation and convolution can be interchanged due to the
linearity of the operators involved, so
LoG={v2G(x,y,o)} */(xj)
(what is the advantage of doing this ?).
This operator has the following features:
A larger area surrounding the current pixel is taken into account compared to
classical edge operators of small size, the influence of more distant points decreases
according to the a of the Gaussian.
The ci variation does not affect the location of the zero crossings, but as a increases
less significant edges are suppressed.
^G operator can be decomposed into row and column filters which permits a
significant increase in computation speed (A Huertas and G Medion. Detection of
intensity changes with subpixel accuracy using Laplacian-Gaussian masks. IEEE
Transactions on Patern Analysis and Machine Intelligence, PAMi-8;651-664,1986).
Neurophysiological experiments provide evidence that human eye retina performs
operations very similar to the ^G operations.
The ^G operator can be very effectively approximated by convolution with a mask that is the
difference of two Gaussian masks with substantially different a (why ?).
3.5 Image Restoration
Pre-processing methods that aim to suppress degradation using knowledge about its nature
are called image restoration. Image restoration techniques can be classified into two groups:
deterministic and stochastic. Deterministic methods are applicable to images with little noise
and a known degradation function. The original image is obtained from the degraded one by
a transformation inverse to the degradation. Stochastic techniques try to find the best
restoration according to a particular stochastic criterion, e.g. a least squares method. It is
always advantageous to know the degradation function explicitly. The better this knowledge
is, the better are the results of the restoration

To top