Professional Documents
Culture Documents
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
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 t12 T =
11 t12 0
y 1x] =y [ 1v w 1v ] wt211 t22 t 0
t22 0
2 0 0
[ ]=[ ] 21 1 1 0
t31 t32 1 50 -1 1
t31 t32 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]
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
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
Chapter 3
Intensity Transformations & Spatial Filtering
It suffices:
Linear: 6 free parameters 3 couples of points
Bilinear: 8 free parameters 4 couples of points
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
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)]
Chapter 3
Intensity Transformations & Spatial Filtering
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
Chapter 3
Intensity Transformations & Spatial Filtering
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
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.
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
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
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
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
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
form:
g(x, y) = T [f (x, y)]
s = (L − 1) − r
Log map: s = c log(1 + r)
form:
g(x, y) = T [f (x, y)]
s = (L − 1) − r
Log map: s = c log(1 + r)
gamma=3
© 1992–2008 R. C. Gonzalez & R. E. Woods
gamma=3
© 1992–2008 R. C. Gonzalez & R. E. Woods
gamma=3
© 1992–2008 R. C. Gonzalez & R. E. Woods
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Contrast stretching by
piecewise linear transformations.
(r1, s1)
(r2, s2)
Control points
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
r1=0=s1
r2=L-1=s2
Identity
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
r1=r2
s1=0, s2=L-1
Thresholding
Chapter 3
Intensity Transformations & Spatial Filtering
r1=r2
s1=0, s2=L-1
Thresholding
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Chapter 3
Intensity Transformations & Spatial Filtering
Bit slicing:
0 1 0 1 0 0 1 0
82=64+16+2
© 1992–2008 R. C. Gonzalez & R. E. Woods
Chapter 3
Intensity Transformations & Spatial Filtering
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
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.
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.
(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 © 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