Professional Documents
Culture Documents
Matlab Imageprocessing
Matlab Imageprocessing
Haris Papasaika-Hanusch
Institute of Geodesy and Photogrammetry, ETH Zurich
haris@geod.baug.ethz.ch
Digital Image Processing Using Matlab 2
Images and Digital Images
A digital image differs from a photo in that the values are all
discrete.
inary: -ach pi#el is .ust blac! or "hite. /ince there are only
t!o possible values for each pi#el *01, !e only need one bit
per pi#el.
Tr'e (olor or R#% -ach pi#el has a particular color3 that color
is described by the amount of red green and bl'e in it. If each
of these components has a range 042'' this gives a total of
%&)
*
different possible colors. /uch an image is a 5stack6 of
three matrices3 representing the red green and bl'e values
for each pi#el. "his means that for every pi#el there correspond
& values.
Digital Image Processing Using Matlab 7
inary Image
Digital Image Processing Using Matlab (
#rayscale Image
Digital Image Processing Using Matlab 8
(olor Image
Digital Image Processing Using Matlab 9
#eneral (ommands
"he $th bit plane consists of the last bit of each grey value.
/ince this bit has the least effect *least significant bit plane,.
"he 2th bit plane consists of the first bit in each value *most
significant bit plane.
Digital Image Processing Using Matlab 1)
Initial Image
Digital Image Processing Using Matlab 1'
it Plane $
Digital Image Processing Using Matlab 17
it Plane 3
Digital Image Processing Using Matlab 1(
it Plane 2
Digital Image Processing Using Matlab 18
Spatial Resol'tion
4al-e the si$e of the image% It does this by taking out every
other ro! and every other column thus leaving only those
matri# elements !hose ro! and column indices are even.
Do'ble the si$e of the image% all the pi#els are repeated to
produce an image !ith the same si$e as the original but !ith
half the resolution in each direction.
Digital Image Processing Using Matlab 19
Interpolation
Digital Image Processing Using Matlab 20
Extrapolation
Digital Image Processing Using Matlab 21
Arithmetic 5perations
=e can stretch the gray levels in the center of the range out by
applying a piece!ise linear function
"his function has the effect of stretching the gray levels CabD to
gray levels CcdD !here aEc and dFb according to the e<uation%
imad.ust*ICabDCcdD,
Pi#el values less than c are all converted to c and pi#el values
greater than d are all converted to d.
j=
cd
ba
iac
Digital Image Processing Using Matlab &2
4istogram Stretching
Digital Image Processing Using Matlab &&
efore 4istogram Stretching
Digital Image Processing Using Matlab &)
After 4istogram Stretching
Digital Image Processing Using Matlab &'
4istogram E6'ali7ation
Double thresholding% Gere !e choose t!o values "1 and "2 and
apply a thresholding operation as%
A ne! image !hose pi#els have gray values calculated from the
gray values under the mask.
Hinear function of all the gray values in the mask then the filter
is called a linear filter.
filter2*filterimageshape,
Digital Image Processing Using Matlab )1
Mas!s
Digital Image Processing Using Matlab )2
8iltering
0or!ing
8lo"
Digital Image Processing Using Matlab )&
8re6'encies9 :o" and 4igh Pass 8ilters
Ilurring -ffect
Digital Image Processing Using Matlab )'
#a'ssian 8ilters
Digital Image Processing Using Matlab )7
#a'ssian 8ilters
Digital Image Processing Using Matlab )(
;oise
'
>
otherwise
th n m g
n m I
!
+ , , - + .
, , -
We can implement those two steps by basic MATLAB functions.
Edge Detection
Digital Image Processing Using Matlab '2
./ Pre0itt operator / 1o2e* operator
1
1
1
]
1
. ! .
. ! .
. ! .
1
1
1
]
1
. . .
! ! !
. . .
1
1
1
]
1
. ! .
!
. ! .
1
1
1
]
1
. .
! ! !
. .
(ertica*
hori3onta*
(ommon Edge 5perators
Digital Image Processing Using Matlab '&
(anny Edge Detector
Single response
4S=%
Gue% "he 5true color6 attribute *red green blue orange yello!
and so on,.
Kalue% "he degree of brightness% a !ell lit color has high intensity3 a
dark color has lo! intensity.
Digital Image Processing Using Matlab '(
(olor Image
Digital Image Processing Using Matlab '8
(olor (on-ersion
Digital Image Processing Using Matlab '9
Initial (olor Image
Digital Image Processing Using Matlab 70
R# (olor Space
RED GREEN
BLE
Digital Image Processing Using Matlab 71
4S= (olor Space
!E
S"#R"#I$N %"LE
Digital Image Processing Using Matlab 72
(5:5R (5MP5SITE
"ster & "ster '
"ster (
Digital Image Processing Using Matlab 7&
(5:5R (5MP5SITE
"ster &)()'
"ster ()&)' "ster ')()&