Image Processing
Georg Fries
1. Introduction
Content
Images in MATLAB
RGB, Grey-Scale, Binary
Images and Matrices
Handling Images
Intensity Transformation
Adjusting Contrast and Brightness
Histogram
Spatial Filtering
Neighbourhood
Sharpening and Softening
Denoising
Speckle and Salt & Pepper Noise
Georg Fries
Modelling and Simulation using MATLAB
1. Images in MATLAB
Images: London Eye
Georg Fries
Modelling and Simulation using MATLAB
1. Images in MATLAB
It is a Matrix!
Georg Fries
Modelling and Simulation using MATLAB
1. Images in MATLAB
It is a Matrix!
Georg Fries
Modelling and Simulation using MATLAB
1. Images in MATLAB
Image Types
True Colour (RGB)
Georg Fries
Grey-Scale
Modelling and Simulation using MATLAB
Binary
1. Images in MATLAB
Image types
True Colour (RGB)
Georg Fries
Grey-Scale
Modelling and Simulation using MATLAB
Binary
1. Images in MATLAB
Image types
Grey-Scale
moose_gray.png!
Grey-Scale
M-by-N matrix
Pixel values I(r,c)
specify intensity values
of monochrome image
8 bit:
uint8
0
=> Black
255 => White
Georg Fries
Modelling and Simulation using MATLAB
1. Images in MATLAB
Image types
Binary
moose_bin.png
Binary
M-by-N matrix
Containing only 0s and
1s, interpreted as
Black and White
1 bit: logical
0
1
Georg Fries
=> Black
=> White
Modelling and Simulation using MATLAB
1. Images in MATLAB
Image types
True Colour
moose.png
RGB
M-by-N-by-3 array
Pixel values specify
intensity values of 3
monochrome images
24 bit:
uint8 x 3
0
=> Black
255 => Max(R,G,B)
Georg Fries
Modelling and Simulation using MATLAB
10
1. Images in MATLAB
True Colour
RGB
Georg Fries
Red
Green
Modelling and Simulation using MATLAB
Blue
11
1. Images in MATLAB
Handling Images
MATLAB
func+on
Descrip+on
Displays
the
image
I
in
a
Handle
Graphics
gure,
where
I
is
imshow(I)!
a
grey
scale,
RGB
(truecolour),
or
binary
image
I = imread(filename,fmt) ! Reads
a
grey
scale
or
colour
image
from
the
le
"lename"
imwrite(I,filename) !
info = imfinfo(I)!
image!
Georg Fries
Writes
image
data
I
to
the
le
"lename"
Inferring
the
le
format
from
the
extension
Creates
the
new
le
in
your
current
folder
Returns
informaDon
about
an
image
in
a
graphics
le
Creates
an
image
graphics
object
by
interpreDng
each
element
in
a
matrix
as
an
index
into
the
gure's
colormap
or
directly
as
RGB
values,
depending
on
the
data
specied
Modelling and Simulation using MATLAB
Reference:
hIp://www.mathworks.com/help/matlab
12
1. Images in MATLAB
Create Binary Image using im2bw
Grey-Scale
I=imread('moose_gray.png');
Binary
threshold = 0.55;!
BW = im2bw(I, threshold);!
imwrite(BW,'moose_bin.png');!
!
!
Change the threshold value!
Georg Fries
Modelling and Simulation using MATLAB
13
1. Images in MATLAB
True Colour
RGB=imread('piccadilly.jpg');!
RGB(:,:,2)=0;!
RGB(:,:,3)=0;!
imshow(RGB)!
RGB=imread('piccadilly.jpg');!
RGB(:,:,1)=0;!
RGB(:,:,3)=0;!
imshow(RGB)!
RGB=imread('piccadilly.jpg');!
RGB(:,:,1)=0;!
RGB(:,:,2)=0;!
imshow(RGB)!
RGB
Georg Fries
Red
Green
Modelling and Simulation using MATLAB
Blue
14