You are on page 1of 49

Digital Image Processing, 3rd ed.

Gonzalez & Woods


www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Last time:
Sxy consists of a subset of m rows
ns, considering the
Affine transforms (linear spatial transforms)
nsformation
1 �
g(x, y) = f (r, c)
mn (r,c)∈Sxy
 
t11 t12 0
[ x y 1 ] = [ v w 1 ] 
 t21 t22 0 
t31 t32 1

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

tsconsists
of a subset
of a of m rows
subset of m rows
y
ering the
IMTRANSFORM
considering
Apply 2-D spatial transformation to image.
the
B = IMTRANSFORM(A,TFORM) transforms the image A according to the 2-D
n
ormationspatial transformation defined by TFORM, which is a tform structure
as returned by MAKETFORM or CP2TFORM. If ndims(A) > 2, such as for
�then the same 2-D transformation is automatically
an RGB 1image,
g(x, y)applied
= 1 f �c)
(r,
to all 2-D planes along the higher dimensions.
g(x,
mn y) = f (r, c)
mn
(r,c)∈S xy
(r,c)∈Sxy
 
t11 t 0 t12  T =
 11 t12 0
y 1x] =y [ 1v w 1v ] wt211 t22 t 0 
t22 0 
2 0 0
[ ]=[ ]  21  1 1 0
t31 t32 1 50 -1 1
t31 t32 1
>> tform = maketform('affine',T);

x = vt11 + wt21 + t31 tform =

y = vt12 + wt22 + t32 ndims_in: 2


ndims_out: 2
forward_fcn: @fwd_affine
inverse_fcn: @inv_affine
tdata: [1x1 struct]

>> IMG2= imtransform(IMG, tform)


© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


1 �
Digital Image
g(x, y) = Processing,f 3rd ed.
(r, c)
mn & Woodsxy
Gonzalez(r,c)∈S

www.ImageProcessingPlace.com T = 
t11 t12 0
Chapter 3  2 0 0
[ x y 1 ] = [ v w 1 ]  t21 t22 0 1 1 0
Intensity Transformations & Spatial Filtering
t31 t32 1 50 -1 1

>> tform = maketform('affine',T);

tform =
x = vt11 + wt21 + t31
ndims_in: 2
y = vt12 + wt22 + t32 ndims_out: 2
forward_fcn: @fwd_affine
inverse_fcn: @inv_affine
tdata: [1x1 struct]

>> IMG2= imtransform(IMG, tform)

NB! IMTRANSFORM assumes


spatial-coordinate conventions for
the transformation TFORM.
Specifically, the first dimension of
the transformation is the horizontal
or x-coordinate, and the second
dimension is the vertical or y-
coordinate. Note that this is the
reverse of MATLAB's array
subscripting convention.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

The process of applying a geometric transformation to an image (often


called study) to match it to another image (called template/reference) is
called image registration.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

The process of applying a geometric transformation to an image (often


called study) to match it to another image (called template/reference) is
called image registration.

Affine/rigid transformations can be used to perform image registration.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

The process of applying a geometric transformation to an image (often


called study) to match it to another image (called template/reference) is
called image registration.

Affine/rigid transformations can be used to perform image registration.

There exist also other types of registration (nonlinear)


-bilinear, bicubic, polynomials
-spline representations
-fully nonlinear (by PDEs)

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

The process of applying a geometric transformation to an image (often


called study) to match it to another image (called template/reference) is
called image registration.

Affine/rigid transformations can be used to perform image registration.

There exist also other types of registration (nonlinear)


-bilinear, bicubic, polynomials
-spline representations
-fully nonlinear (by PDEs)
For the time being, we will focus only on linear and bilinear
transformations, other registration methods will be considered at the
end of the course (MAT262 only).
© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Image registration

Linear (affine):
we have 6 free parameter
(v, w) = T (x, y) (x, y) = T −1 (v, w
we need 6 conditions to determine the parameters
(v, w) = T (x, y) (x, y) = T −1 (v, w)
x = c1 v + c2 w + c3 vw + c4
Bilinear: y = c5 v + c6 w + c7 vw + c8
x = c1 v + c2 w + c3 vw + c4
(av + b)(cw + d)
y = c5 v + c6 w + c7 vw + c8

we have 8 free parameter


we need 8 conditions to determine the parameters
© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

A typical method to set up the parameters is through landmarks


also called (tie, control, ... points).
This can be done either manually/automatically.

Some imaging systems include some sensor/markers to help


recognizing the points.

It suffices:
Linear: 6 free parameters 3 couples of points
Bilinear: 8 free parameters 4 couples of points

Each couple of coordinate (x,y) gives 2 conditions.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
x = v + c2 w + c3 vw + c4
c1www.ImageProcessingPlace.com
y = c5 v + c6 w + c7 vw + c8
Chapter 3
Intensity Transformations
(av + b)(cw + d) & Spatial Filtering
(x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 , y4 )
(v1 , w1 ), (v2 , w2 ), (v3 , w3 ), (v4 , w4 )
Solve the two linear systems
         
v1 w1 v1 w1 1 c1 x1 v1 w1 v1 w1 1 c5 y1
 v2 w2 v2 w2 1  c2   x2   v2 w2 v2 w2 1  c6   y2 
         
  = ,   = 
 v3 w3 v3 w3 1  c3   x3   v3 w3 v3 w3 1  c7   y3 
v4 w4 v4 w4 1 c4 x4 v4 w4 v4 w4 1 c8 y4

(note that they have the same matrix of coefficients)

to find the parameters of the transformation.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

We could use more points (overdetermined system)


in which case we have a Least Squares linear problem, that can be
solved by standard methods (normal equations, QR, SVD, etc.).

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

We could use more points (overdetermined system)


in which case we have a Least Squares linear problem, that can be
solved by standard methods (normal equations, QR, SVD, etc.).

These transformations might also be combined to work on


subregions of the images, which then have to be patched together.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


(x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 , y4 )
Digital
(v1 ,Image
w1 ),Processing, 3rd ed.
(v2 , w2 ), (v 3 , w3 ), (v4 , w4 )
Gonzalez & Woods

Solve the two linear systems www.ImageProcessingPlace.com

Chapter 3
      
Intensity Transformations & Spatial Filtering

v1 w1 v1 w1 1 c1 x1 v1 w1 v1 w1 1
 v w v w 1  c   x   v w v w 1 
 2 2 2 2  2   2   2 2 2 2 
Chapter
 3: Intensity   =  and
transformations  , spatial
 filtering 
 v3 w3 v3 w3 1   c3   x3   v3 w3 v3 w3 1 
v4 w4 v4 w4 1 c4 x4 v4 w4 v4 w4 1

Generic form:
g(x, y) = T [f (x, y)]

new intensity value at (x,y) is a function of the


old intensity value at
(x,y), or Sxy

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Example of spatial filtering:


blurring by 3x3 neighborhood

Create a 3x3 mask, and run it over the whole image to generate the new
image (can also use conv2)

Here I have
run the mask
only on the
left half of
© 1992–2008 the picture.
R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Example of spatial filtering:


blurring by 3x3 neighborhood

Create a 3x3 mask, and run it over the whole image to generate the new
image (can also use conv2)

Here I have
Example of a blurred
run the mask image by a 3x3 mask
only on the
left half of
© 1992–2008 the picture.
R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Simplest example:
1-pixel neighborhood (the pixel itself), in which case we operate
directly on the intensity of the pixel.

This is called point processing as opposed to neighborhood


processing.

Typical operations we will perform:


Image enhancement
contrast stretching
Is the task of manipulating an image so
thresholding that the result is more suitable for specific
applications.
Mostly visual (subjective), no general
© 1992–2008 R. C. Gonzalez & R. E. Woods
quantitative assessment.
Tuesday, February 1, 2011
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Contrast stretching (sigmoid):

low intensity areas are mapped


to even lower
high intensity areas are mapped
to even higher
medium intensity areas are
“stretched”.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Contrast stretching (sigmoid):

low intensity areas are mapped


to even lower
high intensity areas are mapped
to even higher
medium intensity areas are
“stretched”.

© 1992–2008 R. C. Gonzalez & R. E. Woods Original contrast stretched


Tuesday, February 1, 2011
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Contrast stretching (sigmoid):

low intensity areas are mapped


to even lower
high intensity areas are mapped
to even higher
medium intensity areas are
“stretched”.

© 1992–2008 R. C. Gonzalez & R. E. Woods Original contrast stretched


Tuesday, February 1, 2011
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Thresholding: we choose a threshold parameter k: intensities below


this parameters are set to 0, those above are set to 1.
This produces a binary image.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Thresholding: we choose a threshold parameter k: intensities below


this parameters are set to 0, those above are set to 1.
This produces a binary image.

Thresholded image (setting to 1 the


values above 150, 0 the others)

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


(v1 , w1 ), (v2 , w2 ), (v3 , w3 ), (v4 , w4 )
Solve the two linear systems
Digital Image Processing, 3rd ed.
Gonzalez & Woods
         
v1 w1 v1 w1 1 c1 x1 v1 w1 v1 w1 1
www.ImageProcessingPlace.com c5 y1
 v2 w2 v2 w2 1  c2     v v2 w2 1     
    x2   2 w
Chapter 32   c6   y2 
  = ,   = 
 v3 w3 v3 w3 1  c3   xTransformations
Intensity 3   v3 w3& v w
Spatial
3 3 1   c7 
Filtering  y3 
v4 w4 v4 w4 1 c4 x4 v4 w4 v4 w4 1 c8 y4

Generic form:
Other maps of the type s=T(r)
g(x, y) = T [f (x, y)]
Negative map: s = (L − 1) − r
s = c log(1 + r)
useful when one is interested in gray/white areas and the black areas
are dominating

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


(v1 , w1 ), (v2 , w2 ), (v3 , w3 ), (v4 , w4 )
Solve the two linear systems
Digital Image Processing, 3rd ed.
Gonzalez & Woods
         
v1 w1 v1 w1 1 c1 x1 v1 w1 v1 w1 1
www.ImageProcessingPlace.com c5 y1
 v2 w2 v2 w2 1  c2     v v2 w2 1     
    x2   2 w
Chapter 32   c6   y2 
  = ,   = 
 v3 w3 v3 w3 1  c3   xTransformations
Intensity 3   v3 w3& v w
Spatial
3 3 1   c7 
Filtering  y3 
v4 w4 v4 w4 1 c4 x4 v4 w4 v4 w4 1 c8 y4

Generic form:
Other maps of the type s=T(r)
g(x, y) = T [f (x, y)]
Negative map: s = (L − 1) − r
s = c log(1 + r)
useful when one is interested in gray/white areas and the black areas
are dominating

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


(v1 , w1 ), (v2 , w2 ), (v3 , w3 ), (v4 , w4 )
Solve the two linear systems
Digital Image Processing, 3rd ed.
Gonzalez & Woods
         
v1 w1 v1 w1 1 c1 x1 v1 w1 v1 w1 1
www.ImageProcessingPlace.com c5 y1
 v2 w2 v2 w2 1  c2     v v2 w2 1     
    x2   2 w
Chapter 32   c6   y2 
  = ,   = 
 v3 w3 v3 w3 1  c3   xTransformations
Intensity 3   v3 w3& v w
Spatial
3 3 1   c7 
Filtering  y3 
v4 w4 v4 w4 1 c4 x4 v4 w4 v4 w4 1 c8 y4

Generic form:
Other maps of the type s=T(r)
g(x, y) = T [f (x, y)]
Negative map: s = (L − 1) − r
s = c log(1 + r)
useful when one is interested in gray/white areas and the black areas
are dominating

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


(v1 , w1 ), (v2 , w2 ), (v3 , w3 ), (v4 , w4 )
Solve the two linear systems
Digital Image Processing, 3rd ed.
Gonzalez & Woods
         
v1 w1 v1 w1 1 c1 x1 v1 w1 v1 w1 1
www.ImageProcessingPlace.com c5 y1
 v2 w2 v2 w2 1  c2     v v2 w2 1     
    x2   2 w
Chapter 32   c6   y2 
  = ,   = 
 v3 w3 v3 w3 1  c3   xTransformations
Intensity 3   v3 w3& v w
Spatial
3 3 1   c7 
Filtering  y3 
v4 w4 v4 w4 1 c4 x4 v4 w4 v4 w4 1 c8 y4

Generic form:
Other maps of the type s=T(r)
g(x, y) = T [f (x, y)]
Negative map: s = (L − 1) − r
s = c log(1 + r)
useful when one is interested in gray/white areas and the black areas
are dominating

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


y = c5 v + c6 w + c7 vw + c8
Digital Image Processing, 3rd ed.
(av + b)(cw + d) Gonzalez & Woods
(x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 ,www.ImageProcessingPlace.com
y4 )
(v1 , w1 ), (v2 , w2 ), (v3 , w3 ), (v4 , w4 ) Chapter 3
e two linear systems Intensity Transformations & Spatial Filtering
        
1 v1 w1 1 c1 x1 v1 w1 v1 w1 1 c5 y1
v2 w2 1  c2   x2   v2 w2 v2 w2 1  c6   y2 
2         
 = ,   = 
3 v3 w3 1  c3   x3   v3 w3 v3 w3 1  c7   y3 
4 v4 w4 1 c4 x4 v4 w4 v4 w4 1 c8 y4

form:
g(x, y) = T [f (x, y)]
s = (L − 1) − r
Log map: s = c log(1 + r)

maps lower intensities to a


wider range, while white
intensities are
mapped to a smaller range

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


y = c5 v + c6 w + c7 vw + c8
Digital Image Processing, 3rd ed.
(av + b)(cw + d) Gonzalez & Woods
(x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 ,www.ImageProcessingPlace.com
y4 )
(v1 , w1 ), (v2 , w2 ), (v3 , w3 ), (v4 , w4 ) Chapter 3
e two linear systems Intensity Transformations & Spatial Filtering
        
1 v1 w1 1 c1 x1 v1 w1 v1 w1 1 c5 y1
v2 w2 1  c2   x2   v2 w2 v2 w2 1  c6   y2 
2         
 = ,   = 
3 v3 w3 1  c3   x3   v3 w3 v3 w3 1  c7   y3 
4 v4 w4 1 c4 x4 v4 w4 v4 w4 1 c8 y4

form:
g(x, y) = T [f (x, y)]
s = (L − 1) − r
Log map: s = c log(1 + r)

maps lower intensities to a


wider range, while white
intensities are
mapped to a smaller range

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


        
1 1 c1 x1 Digital
v1 w1 Image
v1 w1 Processing,
1 c5 3rd yed.
1
1      v  c   y 
2  c2   x2   2 w2 v2 w 2 1 &Woods
Gonzalez 6   2 
 = ,     =  
3 1  c3   x3   v3 3 3 1
w3 vwww.ImageProcessingPlace.com
w   c 7   y 3 
4 1 c4 x4 v4 1
w4 v4 w4 Chapter c38 y4
Intensity Transformations & Spatial Filtering
g(x, y) = T [f (x, y)]
s = (L − 1) − r
Power-law (gamma) map: gamma=0.2
s = c log(1 + r)
s = crγ

These subsume the log and


inverse log, but are more
powerful, as just varying the
gamma one gets a whole family
of transformations.

gamma=3
© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


        
1 1 c1 x1 Digital
v1 w1 Image
v1 w1 Processing,
1 c5 3rd yed.
1
1      v  c   y 
2  c2   x2   2 w2 v2 w 2 1 &Woods
Gonzalez 6   2 
 = ,     =  
3 1  c3   x3   v3 3 3 1
w3 vwww.ImageProcessingPlace.com
w   c 7   y 3 
4 1 c4 x4 v4 1
w4 v4 w4 Chapter c38 y4
Intensity Transformations & Spatial Filtering
g(x, y) = T [f (x, y)]
s = (L − 1) − r
Power-law (gamma) map: gamma=0.2
s = c log(1 + r)
s = crγ

These subsume the log and


inverse log, but are more
powerful, as just varying the
gamma one gets a whole family
of transformations.

gamma=3
© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


        
1 1 c1 x1 Digital
v1 w1 Image
v1 w1 Processing,
1 c5 3rd yed.
1
1      v  c   y 
2  c2   x2   2 w2 v2 w 2 1 &Woods
Gonzalez 6   2 
 = ,     =  
3 1  c3   x3   v3 3 3 1
w3 vwww.ImageProcessingPlace.com
w   c 7   y 3 
4 1 c4 x4 v4 1
w4 v4 w4 Chapter c38 y4
Intensity Transformations & Spatial Filtering
g(x, y) = T [f (x, y)]
s = (L − 1) − r
Power-law (gamma) map: gamma=0.2
s = c log(1 + r)
s = crγ

These subsume the log and


inverse log, but are more
powerful, as just varying the
gamma one gets a whole family
of transformations.

gamma=3
© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Piecewise linear transformations:

Contrast stretching by
piecewise linear transformations.

(r1, s1)
(r2, s2)
Control points

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

r1=0=s1
r2=L-1=s2
Identity

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

r1=r2
s1=0, s2=L-1
Thresholding

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

r1=r2
s1=0, s2=L-1
Thresholding

Other combinations give different effects on the image.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Other combinations give different effects on the image.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Intensity level slicing:


to highlight a specific range of intensities.

Most popularly implemented as:


showing white in one range and black in the rest
showing white in one range and graytone in the rest

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

Bit slicing:

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0

0 1 0 1 0 0 1 0

82=64+16+2
© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

The reconstructed image is obtained as


2^0*bit_plane1 + 2^1*bit_plane2 + …. + 2^7*bit_plane8
bit plane 1

The most
significant planes
are often those with
high bit number
© 1992–2008 R. C. Gonzalez & R. E. Woods
bit plane 8
Tuesday, February 1, 2011
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


4 x4 v4 w4 v4 w4 1 c8 y4
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

g(x, y) = T [f (x, y)] Chapter 3


Intensity Transformations & Spatial Filtering

s = (L − 1) − r
Histogram processing
s = c log(1 + r)
Histogram: is a discrete function that counts how many pixels have a
given intensity
s = cr γvalue.

h(rk ) = nk Number of pixels that have such


intensity value

k-th intensity value

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


4 x4 v4 w4 v4 w4 1 c8 y4
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

g(x, y) = T [f (x, y)] Chapter 3


Intensity Transformations & Spatial Filtering

s = (L − 1) − r
Histogram processing
s = c log(1 + r)
Histogram: is a discrete function that counts how many pixels have a
given intensity
s = cr γvalue.

h(rk ) = nk Number of pixels that have such


intensity value

k-th intensity value

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011


6 7 8
Digital Image Processing, 3rd (av
ed. + b)(cw + d)
+ b)(cw + d) (x
Gonzalez & Woods
1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 , y4 )
www.ImageProcessingPlace.com

y2 ), (x3 , y3 ), (x4 , y4 ) (v1 , w1 ), (v2 , w2 ), (v3 , w3 ), (v4 , w4 )


Chapter 3
w2 ), (v3 , w3 ), (v4 , w4 ) Solve the two linear systems
Intensity Transformations & Spatial Filtering
      
v1 w1 v1 w1 1 c1 x1 v1 w1 v1 w1 1
 v w v w 1  c   x   v w v w 1 
It is
 typical to 
 scale nk by MN, the       2 
 number
  of pixels.
 The  corresponding
 =  number represents
2 2 2 2 2 2 2the 2 2
,  
x1probability of avpixel
1 whaving
1 v1the v13 intensity.
w1given w3 cv53 w3 1   y1c3   x3   v3 w3 v3 w3 1 
x 2 
 v w v w v14 w4 cv4 w4 1 y c4
 2 2 2  
2 6
x4
2
v4 w4 v4 w4 1
,   = 
x3   v3 w3 1  form:
v3 w3Generic c7   y3 
x4 v4 w4 v4 w4 1 c8 y4 g(x, y) = T [f (x, y)]
s = (L − 1) − r

) = T [f (x, y)] s = c log(1 + r)

(L − 1) − r s = crγ

h(rk ) = nk nk = M N
c log(1 + r) k

s = crγ nk �
� p(rk ) = p(rk ) = 1
MN
nk = M N k

k Probability that a random pixels has intensity rk .

k © 1992–2008

) = 1
R. C. Gonzalez & R. E. Woods
p(r k
NTuesday, February 1, 2011
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 3
Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Tuesday, February 1, 2011

You might also like