3. 1-Applications of image processing
in remote sensing.
īŦ2- Image processing using NN.
3- Techniques of images retrieval.
4- Registration of medical images.
īŦ5- Image synthesize.
īŦ.
4. īŦ6- Image processing using pde.
īŦ7- Methods of texture analysis.
īŦ8- Reconstruction techniques.
9- Image processing using parallel
algorithm.
īŦ10- Multiresolution processing
īŦ11- Open.
īŦ12- Open
5. īŦThe text book
īŦDigital Image Processing
īŦUsing Matlab
īŦRafael C. Gonzalez
īŦUniversity of Tennessee
īŦRichard E. Woods
6. Title
LAB. ASS.
No.
Read , view, and display an image file1-
Zooming and Shrinking Images by Pixel Replication.2-
Image Enhancement Using Intensity Transformations.3-
âĸHistogram equalization & log. transformation.4-
âĸArithmetic operations & logic operation5-
7. Noise Generators & Noise Reduction.6-
Spatial filtering (smoothing & sharpening)7-
Two-Dimensional Fast Fourier Transfor.8-
Lowpass Filtering9-
Convert gray level image to color10-
FFT, and Hough transform11-
15. Ultrasound Image īŦProfiles of a
fetus at 4
months, the
face is about
4cm long
īŦUltra sound
image is
another
imaging
modality
īŦThe fetal arm
with the major
arteries
(radial and
ulnar) clearly
delineated.
16.
17.
18.
19.
20. īŦSection through Visible
Human Male - head,
including cerebellum,
cerebral cortex,
brainstem, nasal passages
(from Head subset)
īŦThis is an example of the
âvisible human projectâ
sponsored by NIH
40. Example of Matlab functions âĻ
īŦInput / Output
>>imread
>>imwrite
Image Display
>>imshow
īŦOthers
>>axis
>>colorbar
>>colormap
>>fft, fft2
41. Image Storage Formats
ī§ To store an image, the image is represented in a two-
dimensional matrix, in which each value corresponds
to the data associated with one image pixel.
ī§ When storing an image, information about each pixel,
the value of each colour channel in each pixel, has to
be stored.
ī§ Additional information may be associated to the
image as a whole, such as height and width, depth, or
the name of the person who created the image.
ī§ The most popular image storing formats include
PostScript, GIF (Graphics Interchange Format),
JPEG, TIFF (Tagged Image File Format), BMP
(Bitmap), etc.
43. Image Formation in the Eye
17100
15 x
īŊ
mmx 55.2īŊ
âCalculation of retinal image of an object
âĸThe eye has a sensor plane (100 million pixels)
44. The eyes have a USB2 data rate!
250,000 neurons in the optic nerve
variable voltage output on EACH nerve
17.5 million neural samples per second
12.8 bits per sample
224 Mbps, per eye (a 1/2 G bps system!).
Compression using lateral inhibition
between the retinal neurons
45. CCD KAF-3200E from Kodak.
(2184 x 1472 pixels,
Pixel size 6.8 microns2)
Image Sensor:Charge-Coupled Device (CCD)
w Used for convert a continuous
image into a digital image
w Contains an array of light sensors
wConverts photon into electric charges
accumulated in each sensor unit
46. Typical IP System
DIP Corrections
and/or
Enhancements
A/D
Scene Sensor A/D Media
D/A
D/A
Display
48. An color image
Fundamentals of Digital Images
f(x,y)
x
y
w An image: a multidimensional function of spatial coordinates.
w Spatial coordinate: (x, y) for 2D case such as photograph,
(x, y, z) for 3D case such as CT scan images
(x, y, t) for movies.
w The function f may represent intensity (for monochrome images)
or color (for color images).
Origin
52. Color image:
For example, 24-bit image or 24 bits per
pixel. There are 16,777,216 (224) possible
colors.
In other words, 8 bits for R(Red), 8 bits
for G(Green), 8 bits for B(Blue).
Since each value is in the range 0-255,
this format supports 256 x 256 x 256.
53. Image Types
Binary image or black and white image
Each pixel contains one bit :
1 represent white
0 represents black
īē
īē
īē
īē
īē
īš
īĒ
īĒ
īĒ
īĒ
īĒ
īŠ
1111
1111
0000
0000
Binary data
54. Image Types
Index image
Each pixel contains index number
pointing to a color in a color table
īē
īē
īē
īē
īš
īĒ
īĒ
īĒ
īĒ
īŠ
256
746
941
Index value
Index
No.
Red
component
Green
component
Blue
component
1 0.1 0.5 0.3
2 1.0 0.0 0.0
3 0.0 1.0 0.0
4 0.5 0.5 0.5
5 0.2 0.8 0.9
âĻ âĻ âĻ âĻ
Color Table
55. Image Sampling
Image sampling: discretize an image in the spatial domain
Spatial resolution / image resolution:
pixel size or number of pixels
56. Sampling & Quantization
âĸ The spatial and amplitude digitization of f(x,y) is
called:
âĸ - image sampling when it refers to spatial coordinates
(x,y) and
âĸ - gray-level quantization when it refers to the amplitude.
The digitization process requires decisions about: values
for N,M (where N x M: the image array) and
the number of discrete gray levels allowed for each
pixel.
62. Sampling & Quantization
âĸ Different versions (images) of the same
object can be generated through:
â Varying N, M numbers
â Varying k (number of bits)
â Varying both
63. Isopreference curves (in the NK plane)
âĸ Isopreference curves (in the NK plane)
â Each point: image having values of N and k
equal to the coordinates of this point
â Points lying on an isopreference curve
correspond to images of equal subjective
quality.
66. Sampling & Quantization
âĸ Conclusions:
â Quality of images increases as N & k increase
â Sometimes, for fixed N, the quality improved
by decreasing k (increased contrast)
â For images with large amounts of detail, few
gray levels are needed
67.
68.
69. Some Basic Relationship Between Pixels
(x,y) (x+1,y)(x-1,y)
(x,y-1)
(x,y+1)
(x+1,y-1)(x-1,y-1)
(x-1,y+1) (x+1,y+1)
y
x
(0,0)
Definition: f(x,y): digital image, Pixels: q, p
S: Subset of pixels of f(x,y).
70. Neighbors of a Pixel
p (x+1,y)(x-1,y)
(x,y-1)
(x,y+1)
4-neighbors of p:
N4(p) =
(xī1,y)
(x+1,y)
(x,yī1)
(x,y+1)
Neighborhood relation is used to tell adjacent pixels. It is
useful for analyzing regions.
Note: q īī N4(p) implies p īī N4(q)
4-neighborhood relation considers only vertical and
horizontal neighbors.
73. Connectivity
âĸ Two pixels are connected if:
â They are neighbors (i.e. adjacent in some sense
e.g. N4(p), N8(p), âĻ)
â Their gray levels satisfy a specified criterion of
similarity (e.g. equality, âĻ)
âĸ V is the set of gray-level values used to
define adjacency (e.g. V = {1} for
adjacency of pixels of value 1)
74. Adjacency
âĸ We consider three types of adjacency:
â 4-adjacency: two pixels p and q with values
from V are 4-adjacent if q is in the set N4(p)
â 8-adjacency : p & q are 8- adjacent if q is in the
set N8(p)
75. Adjacency
âĸ The third type of adjacency:
âĸ -m-adjacency: p & q with values from V are m-
adjacent if:
- q is in N4(p) or
- q is in ND(p) and the set N4(p)īN4(q) has
no pixels with values from V
Two image subsets S1 and S2 are adjacent if some pixel in
S1 is adjacent to some pixel in S2
S1
S2
76. Adjacency
âĸ Mixed adjacency is a modification of 8-
adjacency and is used to eliminate the
multiple path connections that often arise
when 8-adjacency is used.
100
010
110
100
010
110
100
010
110
77. Path
A path from pixel p at (x,y) to pixel q at (s, t) is
a sequence of distinct pixels:
(x0, y0), (x1, y1), (x2, y2),âĻ, (xn, yn)
such that
(x0,y0) = (x,y) and (xn, yn) = (s,t)
and
(xi, yi) is adjacent to (xi-1, yi-1), i = 1,âĻ,n
p
q
We can define type of path: 4-path, 8-path or m-path
depending on type of adjacency.
78. Distance
For pixel p, q, and z with coordinates (x,y), (s,t) and (u,v),
D is a distance function or metric if
w D (p, q) īŗī 0 (D (p, q) = 0 if and only if p = q)
D (p, q) = D (q, p)
D (p, z) īŖī ī D (p, q) + D (q, z)
Euclidean distance:
22
)()(),( tysxqpDe ī+īīŊ
79. Distance (cont.)
D4 - distance (city-block distance) is defined as
tysxqpD ī+īīŊ),(4
1 2
10
1 2
1
2
2
2
2
2
2
Pixels with D4(p) = 1 is 4-neighbors of p.
Pixels with D4 (p) = 2 is not 4-diagonl of p.
80. Distance (cont.)
D8 - distance (chessboard distance) is defined as
),max(),(8 tysxqpD īīīŊ
1
2
10
1
2
1
2
2
2
2
2
2
Pixels with D8 (p) = 1 is 8-neighbors of p.
22
2
2
2
222
1
1
1
1
81.
82.
83. Our objectives of studying this topic:
1- To know how to read the transformations
charts & histograms,
2- To evaluate the image quality,
3- To understand the principals of IP techniques.
4- To be able to develop IP algorithms,
Most IP techniques depend on the concepts used in this
chapter.
84. Spatial Domain Methods
īŦProcedures that operate directly on the
aggregate of pixels composing an
image
īŦ
īŦA neighborhood about (x,y) is defined
by using a square (or rectangular)
subimage area centered at (x,y).
)],([),( yxfTyxg īŊ
86. Spatial Domain Methods
īŦWhen the neighborhood is 1 x 1 then g
depends only on the value of f at (x,y) and T
becomes a gray-level transformation (or
mapping) function:
īŦs=T(r)
Where: r denotes the pixel intensity before
processing.
īĄs denotes the pixel intensity after
processing.
87. Image Enhancement in the Spatial Domain
Contrast Stretching: the values
for r below m are expanded
into wide range of s.
Thresholding: produce binary
image from gray level one.
97. Piecewise-Linear Transformation Functions
īŦ- 1-Contrast Stretching transformation:
The locations of (r1,s1) and (r2,s2) control the shape of the
transformation function.
If r1= s1 and r2= s2 the transformation is a linear function
and produces no changes.
98. īĄIf r1=r2, s1=0 and s2=L-1, the
transformation becomes a thresholding
function that creates a binary image.
īĄIntermediate values of (r1,s1) and (r2,s2)
produce various degrees of spread in the gray
levels of the output image, thus affecting its
contrast.
īĄGenerally, r1â¤r2 and s1â¤s2 is assumed.
99.
100. 2- Gray-Level Slicing Transformation
īŦTo highlight a specific range of gray
levels in an image (e.g. to enhance
certain features).
One way is to display a
high value for all gray
levels in the range of
interest and a low value
for all other gray levels
(binary image).
101. Gray-Level Slicing
īĄThe second approach is to brighten the
desired range of gray levels but preserve the
background and gray-level tonalities in the
image:
104. Histogram Processing
âĸThe histogram of a digital image with gray levels
from 0 to L-1 is a discrete function where:
Âģrk is the kth gray level
ânk is the # pixels in the image with that gray
level
ân is the total number of pixels in the image
k = 0, 1, 2, âĻ, L-1
âĸNormalized histogram: p(rk) = nk / n
âĸsum of all components = 1
105. īŦHistogram Is Invariant Under Certain
Image Operations
īĄRotation, scaling, flip
Rotate Clockwise
Scale
Flip
108. Histogram stretching:
For an image f(x,y) with gray level r at x,y this value can be transformed
to another gray level value s in the new image g(x,y), using the following
equ.:
g(x,y) = [(r- rmin) / ( rmax- rmin)] * [Max-Min] +Min
Where: rmax is the largest gray level in the image f(x,y).
rmin is the smallest gray level in the image f(x,y).
Max, Min correspond to the maximum and minimum
gray level values possible for the image g(x,y), (0-255).
Histogram shrinking :
g(x,y) = [( Max - Min ) / (rmax-rmin)] * [r â rmin] + Min
Where: Max, Min correspond to the maximum and minimum
desired gray level in the compressed (shrink) histogram.
109. Histogram Processing
âĸHistograms are the basis for numerous
spatial domain processing techniques, in
addition it is providing useful image
statistics.
âĸTypes of processing:
Histogram equalization
Histogram matching (specification)
Local enhancement
110.
111. To get a histogram equalization:
-Ex: if the gray levels for an image is given by k = 0, 1, 2, 3 and
number of pixels corresponding to these gray levels are 10,7,8,2
(histogram values), and the maximum k can be 7 (3bits/pixel).
-1- The sum of these values are 10, 17 , 25, 27.
-2- Normalize these values by dividing by the total number of
pixels, 27, we get 10/27, 17/27, 25/27, 27/27.
-3- Multiply these values by the maximum gray level value
available , 7, and then round the result to the closest integer. So, we
get the equalized values to be, 3,4, 6, 7 .
-4- The final step is done by putting all pixels in the original
image with k = 0, 1, 2, 3 to be with the new gray level distribution, 3,
4, 6 ,7.
112.
113.
114.
115.
116. .The global mean and variance are measured over an entire
image and are useful for overall intensity ad contrast
adjustments.The more powerful use of these parameters is in
local enhancement.
Let (x,y) be the coordinates of a pixel in an image, and let
Sx,y
denote a neighborhood (subimage) of specified size, centered
at (x,y). The mean value of mSx,y of the pixels Sx,y can be
computed using the equ.;
Use of histogram statistics for image enhancement
117. Where rs,t is the gray level at coordinates (s,t) in
the neighborhood, and p(rs,t) is the neighborhood
normalized histogram component corresponding to
that value of gray level.
The local mean is a measure of average gray level
in neighborhood Sx,y , and the variance is a
measure of contrast in that neighborhood.
126. Image Averaging
A noisy image:
),(),(),( yxnyxfyxg +īŊ
Averaging M different noisy images:
īĨīŊ
īŊ
M
i
i yxg
M
yxg
1
),(
1
),(
127. Image Averaging
As M increases, the variability of the pixel
values at each location decreases.
This means that g(x,y) approaches f(x,y) as the
number of noisy images used in the averaging
process increases.
Registering of the images is necessary to
avoid blurring in the output image.
129. Basic of spatial filtering
Template, Window, and Mask Operation
Question: How to compute the 3x3 average values at every pixels?
4
4
67
6
1
9
2
2
2
7
5
2
26
4
4
5
212
1
3
3
4
2
9
5
7
7
Solution: Imagine that we have
a 3x3 window that can be placed
everywhere on the image
Masking Window
130. 4.3
Template, Window, and Mask Operation (cont.)
Step 1: Move the window to the first location where we want to
compute the average value and then select only pixels
inside the window.
4
4
67
6
1
9
2
2
2
7
5
2
26
4
4
5
212
1
3
3
4
2
9
5
7
7
Step 2: Compute
the average value
Sub image p
Original image
4 1
9
2
2
3
2
9
7
Output image
Step 3: Place the
result at the pixel
in the output image
Step 4: Move the
window to the next
location and go to Step 2
131. Template, Window, and Mask Operation (cont.)
The 3x3 averaging method is one example of the mask
operation or one of the Spatial filters .
w The mask operation has the corresponding mask (sometimes
called window or template).
wThe mask of size m x n contains coefficients to be multiplied
w with pixel values.
w(-1,1) w(-1,1)
w(1,1)
w(0,0)
w(1,0)
w(0,1)
w(-1,-1)
w(0,-1)
w(1,-1)
Mask coefficients
1 1
1
1
1
1
1
1
1
9
1
Example : moving averaging
The mask of the 3x3 moving average
filter has all coefficients = 1/9
133. Template, Window, and Mask Operation (cont.)
The mask operation at each point is performed by:
1. Move the reference point (center) of mask to the
location to be computed
2. Compute sum of products between mask coefficients
and pixels in subimage under the mask.
Ex: For a 3*3 mask the response R of the linear filter at a
point (x,y) in the image is:
R = w(-1,-1) f( x-1,y-1)+ w(-1,0) f(x-1,y) +
w(-1,1) f(x-1,y+1) +
w(0,-1) f(x,y-1) + w(0,0) f(x,y) + w(0,1) f(x,y+1)
+ w(1,-1) f(x+1,y-1)+ w(1,0) f(x+1,y) +
w(1,1)f(x+1,y+1)
140. A low pass filter (kernal) would
blur the original
âĸAll positive values in a filter indicate a blurring operation
âĸThe larger the kernal, the higher the blur
âĸThe flatter the kernal, the higher the blur
1 1 1
1 1 1
1 1 1
1 1 1
1 2 1
1 1 1
1 1 1
1 4 1
1 1 1
Less blur
1/9 1/121/10
141. Nonlinear smoothing filters
(Order-Statistics filters)
They are nonlinear spatial filters whose
response is based on ordering the pixels
contained in the image area encompassed by the
filter, and then replacing the value of the center
pixel with the value determine by the ranking
(ordering) result.
Median , max, and min filters are examples of
order filters.However, median filter is the most
useful order-statistics filter.
142.
143.
144. Sharpening Filters
īŦTo highlight fine detail or to enhance
blurred detail.
īĄsmoothing ~ integration => summation
īĄsharpening ~ differentiation => differences
īŦCategories of sharpening filters:
īĄDerivative operators
īŦ- High-boost filtering
146. Derivatives
âĸ First derivative
âĸ for one dimensional digital function is defined in term of
differences such as:
âĸ Second derivative
ī ī
īļf
īļx
īŊ f (x +1) ī f (x)
īļ2
f
īļx2
īŊ f (x +1) + f (x ī1) ī2 f (x)
147.
148. Digital Function Derivatives
īŦFirst derivative:
īĄ0 in constant gray segments
īĄNon-zero at the onset of steps or ramps
īĄNon-zero along ramps
īŦSecond derivative:
īĄ0 in constant gray segments
īĄNon-zero at the onset and end of steps or ramps
īĄ0 along ramps of constant slope.
149. Observations
īŦ1st order derivatives produce thicker edges in an
image,
īŦ2nd order derivatives have stronger response to fine
detail,
īŦ1st order derivatives have stronger response to a
gray level step,
īŦ2nd order derivatives produce a double response at
step changes in gray level,
īŦ2nd order derivatives have stronger response to a line
than to a step and to a point than to a line.
158. 2-D, 2nd Order Derivatives
for Image Enhancement
īŦLaplacian (linear operator):
īŦDiscrete version:
ī ī
ī2
f īŊ
īļ2
f
īļx2
+
īļ2
f
īļy2
īļ2
f
īļ2
x2
īŊ f (x + 1, y) + f (x ī1, y) ī 2 f (x, y)
īļ2
f
īļ2
y2
īŊ f (x, y + 1) + f (x, y ī1) ī 2 f (x, y)
160. Laplacian Spatial Filtering
âĸ The sum of the coefficients is 0, indicating
that when the filter is passing over regions
of almost stable gray levels, the output of
the mask is 0 or very small.
âĸ Some scaling and/or clipping is involved (to
compensate for possible negative gray levels
after filtering).
161. Laplacian
īŦDigital implementation:
īŦTwo definitions of Laplacian: one is the negative of the other
īŦAccordingly, to recover background features:
īŦ: if the center coefficient of the Laplacian mask is negative
II: if the center coefficient of the Laplacian mask is positive.
ī2
f īŊ[f (x +1,y)+ f (xī1,y)+ f (x,y +1)+ f (x,yī1)]ī4 f (x,y)
g(x,y) īŊ{ f ( x,y)+ī2 f ( x,y)( II )
f ( x,y)īī2 f ( x,y)( I )
162.
163. Simplification
īŦFilter and recover original part in one step:
g(x,y)īŊ f(x,y)ī[f(x+1,y)+ f(xī1,y)+ f(x,y+1)+ f(x,yī1)]+4f(x,y)
g(x,y) īŊ5f (x,y)ī[ f (x +1,y)+ f (x ī1,y)+ f (x,y +1)+ f (x,y ī1)]
165. A high pass filter (kernal) would
sharpen the original
âĸ Negative values in a filter surrounding a center positive value
indicate a sharpening operation
âĸ The larger the negative values, the higher the sharpening
âĸ âNoiseâ is also sharpened when sharpening an image
More sharpening
0 -1 0
-1 5 -1
0 -1 0
1 -2 1
-2 5 -2
1 -2 1
166. īŦHighpass filtered image = Original â lowpass filtered image.
īŦwhere fs(x,y) denotes the sharpened image obtained by
unsharp mask process.
īŦHigh-boost filter is generalization of unsharp masking, If A is an
multiplication factor, then high-boost filter is given by:
fhb(x,y) = (A-1) f(x,y)+ fs(x,y)
= (A-1) ¡ original + original â lowpass
= (A-1) ¡ original + highpass
ī ī
fs(x,y) īŊ f (x,y) ī f (x,y)
167. ))(,(2),(
))(,(2),(
{
IyxfyxAf
IIyxfyxAfhbf
īī
ī+
īŊ
I: if the center coefficient of the Laplacian mask is negative
II: if the center coefficient of the Laplacian mask is positive.
fhb(x,y) = (A-1) f(x,y)+ fs(x,y)
If we use Laplacian as an image sharper, then one
Can replace fs(x,y) by g(x,y)(for Laplacian)
168. High-boost Filtering
īŦA=1 : standard highpass result
īŦA>1 : the high-boost image looks more like
the original with a degree of edge
enhancement, depending on the value of
A.
-1 -1
-1
A+8
-1
-1
-1
-1
-1
-1 0
0
A+4
-1
-1
0
-1
0