Digital Image Processing Using Matlab: Haris Papasaika-Hanusch Institute of Geodesy and Photogrammetry, ETH Zurich
Digital Image Processing Using Matlab: Haris Papasaika-Hanusch Institute of Geodesy and Photogrammetry, ETH Zurich
Haris Papasaika-Hanusch
Institute of Geodesy and Photogrammetry, ETH Zurich
[email protected]
Digital Image Processing Using Matlab 2
Images and Digital Images
A digital image differs from a photo in that the values are all
discrete.
Binary: Each pixel is just black or white. Since there are only
two possible values for each pixel (0,1), we only need one bit
per pixel.
True Color, or RGB: Each pixel has a particular color; that color
is described by the amount of red, green and blue in it. If each
of these components has a range 0255, this gives a total of
256
3
different possible colors. Such an image is a stack of
three matrices; representing the red, green and blue values
for each pixel. This means that for every pixel there correspond
3 values.
Digital Image Processing Using Matlab 6
Binary Image
Digital Image Processing Using Matlab 7
Grayscale Image
Digital Image Processing Using Matlab 8
Color Image
Digital Image Processing Using Matlab 9
General Commands
The 0th bit plane consists of the last bit of each grey value.
Since this bit has the least effect (least significant bit plane).
The 7th bit plane consists of the first bit in each value (most
significant bit plane.
Digital Image Processing Using Matlab 14
Initial Image
Digital Image Processing Using Matlab 15
Bit Plane 0
Digital Image Processing Using Matlab 16
Bit Plane 4
Digital Image Processing Using Matlab 17
Bit Plane 7
Digital Image Processing Using Matlab 18
Spatial Resolution
Halve the size of the image: It does this by taking out every
other row and every other column, thus leaving only those
matrix elements whose row and column indices are even.
Double the size of the image: all the pixels are repeated to
produce an image with the same size as the original, but with
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 Operations
We can stretch the gray levels in the center of the range out by
applying a piecewise linear function
This function has the effect of stretching the gray levels [a,b] to
gray levels [c,d], where a<c and d>b according to the equation:
imadjust(I,[a,b],[c,d])
Pixel values less than c are all converted to c, and pixel values
greater than d are all converted to d.
j=
cd
ba
iac
Digital Image Processing Using Matlab 32
Histogram Stretching
Digital Image Processing Using Matlab 33
Before Histogram Stretching
Digital Image Processing Using Matlab 34
After Histogram Stretching
Digital Image Processing Using Matlab 35
Histogram Equalization
A new image whose pixels have gray values calculated from the
gray values under the mask.
Linear function of all the gray values in the mask, then the filter
is called a linear filter.
filter2(filter,image,shape)
Digital Image Processing Using Matlab 41
Masks
Digital Image Processing Using Matlab 42
Filtering
Working
Flow
Digital Image Processing Using Matlab 43
Frequencies; Low and High Pass Filters
Blurring Effect
Digital Image Processing Using Matlab 45
Gaussian Filters
Digital Image Processing Using Matlab 46
Gaussian Filters
Digital Image Processing Using Matlab 47
Noise
'
>
otherwise
th n m g
n m I
0
| ) , ( | 1
) , (
We can implement those two steps by basic MATLAB functions.
Edge Detection
Digital Image Processing Using Matlab 52
1. Prewitt operator 2. Sobel operator
1
1
1
]
1
1 0 1
1 0 1
1 0 1
1
1
1
]
1
1 1 1
0 0 0
1 1 1
1
1
1
]
1
1 0 1
2 0 2
1 0 1
1
1
1
]
1
1 2 1
0 0 0
1 2 1
vertical
horizontal
Common Edge Operators
Digital Image Processing Using Matlab 53
Canny Edge Detector
Single response
HSV:
Hue: The true color attribute (red, green, blue, orange, yellow,
and so on).
Value: The degree of brightness: a well lit color has high intensity; a
dark color has low intensity.
Digital Image Processing Using Matlab 57
Color Image
Digital Image Processing Using Matlab 58
Color Conversion
Digital Image Processing Using Matlab 59
Initial Color Image
Digital Image Processing Using Matlab 60
RGB Color Space
RED GREEN
BLUE
Digital Image Processing Using Matlab 61
HSV Color Space
HUE
SATURATION VALUE
Digital Image Processing Using Matlab 62
COLOR COMPOSITE
Aster 1 Aster 3
Aster 2
Digital Image Processing Using Matlab 63
COLOR COMPOSITE
Aster 1-2-3
Aster 2-1-3 Aster 3-2-1