0% found this document useful (0 votes)
4 views

Lecture-4

The document discusses the fundamentals of digital image processing, focusing on grey scale and color digital images, and the methods used for processing them. It covers concepts such as spatial and frequency domain processing, point operations, clipping, rounding errors, and the use of look-up tables (LUTs) for altering pixel values. The document also explains how images are displayed on monitors and the relationship between stored and displayed pixel values.

Uploaded by

wattpadknight
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lecture-4

The document discusses the fundamentals of digital image processing, focusing on grey scale and color digital images, and the methods used for processing them. It covers concepts such as spatial and frequency domain processing, point operations, clipping, rounding errors, and the use of look-up tables (LUTs) for altering pixel values. The document also explains how images are displayed on monitors and the relationship between stored and displayed pixel values.

Uploaded by

wattpadknight
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 102

Informatics and Image Processing

Dr Abel Zhou
[email protected]
Contents prepared by Prof Rob Davidson
[email protected]
Grey Scale Digital Images

Grey scale digital images can be considered as a


single 2D array of values or numbers in rows and
columns given by I(x,y)
0 1 2 3 4 5 6
0 178 47 19 40 161 141 214 17
1 173 78 14 66 38 17 26 204
2 30 156 240 234 101 236 26 99
3 70 39 105 52 97 255 182 183
4 230 143 118 94 200 169 16 173
5 20 57 102 202 13 119 13 64
6 51 131 166 83 175 231 82 149
7 115 162 135 64 7 69 184 142
8 238 91 224 218 146 128 96 66
44 62 196 92 17 31 67 249
119 10 31 152 238 19 232 3
211 39 167 225 42 61 82 94
Basics of Colour Digital Images

Colour images can be considered as the


equivalent of 3 grey scale images
Each array represents the values for red, green
and blue
Red Green Blue
0 1 2 3 0 1 2 3 0 1 2 3
0 186 186 72 135 0 247 123 27 247 0 22 181 164 123
1 119 16 97 60 1 100 120 113 210 1 203 240 31 144
2 202 108 2 82 2 202 124 105 82 2 140 2 42 245
3 153 157 113 164 3 104 157 169 203 3 89 139 204 27
4 203 174 242 99 4 67 70 142 55 4 2 154 185 125
5 252 244 135 156 5 17 31 173 168 5 33 46 165 30
6 222 135 64 242 6 53 44 160 184 6 129 106 43 135
7 101 35 91 91 7 46 232 10 59 7 60 91 74 99
General Areas of Image Processing
2 major types of DIP – Spatial Domain and
Frequency Domain (other domains can be used)
Spatial Domain
– any operation to make changes to the image is
undertaken on the numbers in the image matrix (which
can be displayed as an image, hence the term “spatial”)
Frequency Domain
– the image matrix undergoes a 2D Fourier transform, the
operations are undertaken on these Fourier values and
the Fourier values are then converted back to a matrix for
viewing. (more on this later)
Spatial Domain Image Processing

3 general areas of Spatial Domain digital image


processing
– Point Operations
• Baxes (Ch 4) calls this Pixel Point Processing
– Local Operations
• Baxes calls this Pixel Group Processing
– Global Operations
Clipping
Clipping is where the pixel value that result from
the operation exceeds the limits of the bit depth
of the image
Clipping may result from any operation on an
image.
eg. in an 8 bit depth image (0 to 255)
– operation = x 2, pixel value = 150
new (output) value = 300 is clipped to 255
– operation = - 50, pixel value = 10
new (output) value = - 40 is clipped to 0
Rounding Errors

Rounding errors also result from operations on


the image
In this case, the operation results in a new value
that is not an integer
eg. in an 8 bit depth image
– operation = x1.5, pixel value = 15
new value = 22.5
new output value is rounded to 23
Spatial Domain Processing
Point Operations
Point Operations are primarily used to:
– display images
– change brightness and contrast or colour of the
image
– do NOT change spatial detail in the image
A point operation operates on a single pixels at a
time
Point Operation Process

The process of the Point Operation is, starting at the


top left of the image, to calculate the new (output)
pixel value and place this new value at the same
spatial location in a new (output) matrix of the same
dimension as the original image.
The process then moves to the pixel to the right and
perform the operation until all pixels in the row have
an output.
The process then moves to the next row and
continues until the entire image has an output.
Point Operation Process
I(x,y)
0 1 2 3 4 4 6
Operation
0 152 120 22 215 34 1 0 117 x 1.5
1 3 114 199 134 88 20 60 199
2
3
234
141
72
214
65
169
17
134
145
85
185
234
235
237
181
68
O(x,y)
4 241 154 141 231 145 236 35 27 0 1 2 3 4 4 6
5 45 95 65 127 123 94 47 166 0 255 180 33
6 127 98 137 149 67 45 52 29 1
7 162 81 83 189 69 195 94 171 2
8 64 123 130 100 58 226 214 34 3
102 189 174 35 169 203 243 135 4
213 235 219 137 22 195 168 208 5
227 103 192 243 102 220 187 21 6
7
8
Point Operation Process

The Point Operation process is denoted by:

O(x,y) = p . I(x,y)
where:
I(x,y) is the image
p is the point operation
O(x,y) is the output image
Point Operations

The output of a point operations can be:


– a new stored image (not yet displayed)
• the new image O(x,y) will be the same size, rows and
columns, and have the same bit depth, as the original
image I(x,y)
– the displaying of stored image
• displayed contrast or brightness may or may not be
altered compared to the original image values
• LUTs will typically be used to do this operation
Display of Digital Images

The previous image examples had intensities


ranging from 0 to 255 (ie 8 bit depth), which
when converted to analogue for humans to
perceive, will give a variation of intensities,
normally viewed from white (255) to black (0).
Exception to viewing of max. pixel value being
white & min. pixel value being black are common
in medical imaging, ie x-ray which are viewed as
a negative
Digital Image Display (Grey Scale)
Concept of grey scale, single matrix digital
images to mono-chromatic (grey-scale) monitor

digital image - I(x,y) inside monitor


Pixel Value (not visible) B/W LEDs
128
LED intensity of 128

display on monitor O (x,y)


OUTPUT
LED intensity shade of grey
(value of 128)
Review of Basics of Colour
Colour is a mixture of 3 primary colours; red, green
& blue or cyan, magenta & yellow
2 type of colour mixing, additive (left) & subtractive

http://www.widescreenmuseum.com/oldcolor/additive-subtractive.htm
Digital Image Display (Grey Scale)
Concept of grey scale digital images to a colour
display monitor
digital image – I(x,y) inside monitor
(not visible) 3 x LEDs (R,G, B)
Pixel Value
R – intensity of 128
128
G – intensity of 128
B – intensity of 128
display on monitor – O(x,y)
R OUTPUT
G shade of grey
B (value of 128)
Basics of Colour Digital Images

My notation is
Ic (x, y) where Ic is the colour image
Each colour array is often referred to as a “band”
The visible displayed colour is a mix (additive) of
the 3 colour values
– eg blue (0, 0, 255)
Possible no. of colours = 256 x 256 x 256
= 16,777,216
Colour Image Display
Concept of colour digital images to display
Pixel Value digital image inside monitor
I (x,y) 3 x colour arrays (not visible) 3 x colour LEDs (R,G, B)
R = 109
G = 249 R – intensity = 109
B = 65
G – intensity = 249
B – intensity = 65
display on monitor
R OUTPUT
G hue of additive
B colour
red, green & blue colour bands

image – mix of the 3 bands


The previous examples of displaying images
shows the pixel values at I(x,y) being sent to the
monitor as the displayed value
– this is equivalent of a multiple by 1 (x1) operation,
ie the pixel values do not change
To change the DISPLAYED brightness and
contrast a point operation would be need to
change the pixels values in O(x,y) then display
O(x,y)
– this would be a slow process and use disk space
Grey / Colour Manipulation & Viewing
The pixel values in the image, I(x,y), are stored on
the hard drive of the computer and do not change.
The viewed grey scales and colours can be changed
and seen on the monitor without creating a new
image, O(x,y)
This is achieved through the use of “look-up tables”
Some new notation
– Is (x,y) is the stored image value,
– Id (x,y), is the displayed image intensity or colour
Look-Up Tables
A means of altering the value of the stored
pixel, so it can be displayed as a different value
ie. a different displayed intensities or colours

LUTs are always used to display the stored


image
Look-Up Table (LUT)

A LUT is considered to be a point operation that


can have any mathematical calculation as its basis.
– can also be used for creation of a new stored image
LUTs are still constrained by the bit depth of the
image ie, clipping and the output value must be an
integer
LUT’s are used to improve performance of the
point operation.
Look-Up Table (LUT)

Each operation is performed on each possible


value within the image ie. in an 8 bit depth
image, on the values 0, 1, 2, ………, 255.
If the image has a spatial resolution of 1000
rows and columns, then the operation, without
the use of LUT’s, would have to be performed
1,000,000 times, rather than 256 times
With LUT’s, values still need to be “looked-up”
but overall operation performance is improved.
Input Operation Output
Value Value
0 x 1.5 0
1 x 1.5 2
2 x 1.5 3
Concept of a 3 x 1.5 5
4 x 1.5 6
LUT 5 x 1.5 8
6 x 1.5 9
7 x 1.5 11
8 x 1.5 12
9 x 1.5 14
10 x 1.5 15
11 x 1.5 17
12 x 1.5 18
Note:
Output values
are integers &
between 0 and
250 x 1.5 255 255
251 x 1.5 255
252 x 1.5 255
253 x 1.5 255
254 x 1.5 255
255 x 1.5 255
0
2
3
5
6
a LUT 8 Output values are
9 calculated and put
with an 11 into the LUT.
operation 12
14
of To display an input
15
value, n, the
x 1.5 17
program counts n+1
18
rows and uses that
value

e.g. input value of


255
128, the program
255
counts 129 rows and
255
255
uses that value
255
255
Input Operation Output Look-Up Table
Value Value
0 x 1.5 0
1 x 1.5 2
2 x 1.5 3 Graphical display
3 x 1.5 5
4 x 1.5 6 250

5 x 1.5 8
6 x 1.5 9 200
7 x 1.5 11

Displayed Image
8 x 1.5 12 150
9 x 1.5 14
10 x 1.5 15
100
11 x 1.5 17
12 x 1.5 18
50

0
0 50 100 150 200 250
250 x 1.5 255 Stored Im age
251 x 1.5 255
252 x 1.5 255
253 x 1.5 255
254 x 1.5 255 Operations:- x 1.5 calculation x 1 calculation
255 x 1.5 255 (or original image LUT)
Grey scale display
Grey scale images have one band (channel) of
pixel values – uses 1 LUT
The output value from the LUT goes to the 3
LUTs for each RGB colour LED in the monitor
As the intensities of the RGB colour LEDs are
equal, a grey (white → black) colour will be
perceived on the monitor
Displayed greys can be manipulated by altering
the operation of the LUT
Grey scale image display – colour monitor
R G B
Look-up Table Look-up Table Look-up Table
0 10 0 10 0 10
Stored Image Is(x, y) 1 11 1 11 1 11
2 12 2 12 2 12
Pixel Value
3 13 3 13 3 13
4 4 14 4 14 4 14

254 255 254 255 254 255


255 255 255 255 255 255

Displayed grey
displayed value LEDs - monitor
intensity
14 R
14
14 G
14
B
Displayed Image Id(x, y)
Colour display
Colour images have 3 bands (channels) of pixel values and uses 3
LUT’s – 1 for each band
3 pixel values form each band, same x,y coordinates, are the input
values for each RGB LUT.
The output value from the LUT’s goes to the corresponding colour
(RGB) LEDs in the monitor
The values of the intensities of the RGB colour LEDs will often not be
equal, hence a colour (rather than grey) will be perceived on the
monitor
Displayed colours can be manipulated by altering the LUT’s of each
band.
This can be done equally or differently on each colour LUT.
Typically, display of colour images is by a x1 LUT equally on all LUTs
RGB one-on-one (or x 1) LUTs

250 250
250

Red Green Blue


200 200
200

150 150 150

100 100 100

50 50 50

0 0 0
0 50 100 150 200 250 0 50 100 150 200 250 0 50 100 150 200 250
Colour display
with a change of brightness (+10)
Look-up Table Look-up Table Look-up Table
Stored Image Is(x, y) 0 10 0 10 0 10 to display
1 11 1 11 1 11
2 12 2 12 2 12
R = 109 3 13 3 13 3 13
G = 249 4 14 4 14 4 14

B = 65

254 255 254 255 254 255


255 255 255 255 255 255
Red Green Blue

displayed RGB LEDs - monitor displayed colour


values
R = 119 R
G = 255 G
B = 75 B
Displayed Image Id(x, y)
Look-up Table Look-up Table Look-up Table
0 10 0 10 0 10
1 11 1 11 1 11 Look-Up Tables x 3
2 12 2 12 2 12
3 13 3 13 3 13
4 14 4 14 4 14

254 255 254 255 254 255


255 255 255 255 255 255
Graphical display of the
Red Green Blue
Look-Up Tables

250 250 250

200
Red 200
Green 200
Blue
150 150 150

100 100 100

50 50 50

0 0 0
0 50 100 150 200 250 0 50 100 150 200 250 0 50 100 150 200 250
Other colour image formats
To reduce file size, some other colour file formats
have been developed
Colour palettes can be used to replace the 3
separate bands in a “normal” colour image
– these are used in GIF images
The palette is a separate list of colour values, RGB
values (intensities), that are used in that image.
The I (x,y) value “looks up” the value of a colour in
the palette
Image Palette

0 1 2 3 4 Red Green Blue


0 1 6 19 31 13 1 12 56 200
1 20 30 22 14 7 2 44 67 164
2 13 27 1 17 3 3 100 15 163
3 28 25 35 27 34 4 35 156 207
4 27 19 17 34 11 5 65 51 35
5 25 1 29 29 4 6 0 0 255 - Blue
6 10 11 28 10 18

max. number of colours is 256 due to 8 bit depth


of LUT. The LUT is part of the image header
only the colours used in the image have values
in the palette eg. if the image has 3 colours, the
palette will only have 3 rows.
even with 256 colours, storage size is less than
the format that uses 3 band of colours
Psuedo-colour display of a
grey scale image
Grey scale images have one band (channel) of
pixel values, but use 3 different LUT’s when
displayed on a colour monitor
The same image value goes to the 3 x LUT’s for
the corresponding colour (RGB) LEDs in the
monitor
The LUT calculations do not have to be equal,
hence a colour will be perceived on the monitor
Displayed colours can be manipulated by
altering the 3 LUT’s of each colour LED.
Psuedo-colour display
Stored Image Is(x, y) Look Up Table
0 0
Look Up Table
0 0
Look Up Table
0 255
1 1 1 2 1 254
2 2 2 4 2 253
3 3 3 6 3 252

4 4 4 4 8 4 251

254 254 254 2 254 1


255 255 255 0 255 0

Red Green Blue

displayed RGB LEDs - monitor displayed colour


values
R=4 R
G=8 G
B = 251 B
Displayed Image Id(x, y)
Look Up Table Look Up Table Look Up Table
0 0 0 0 0 255
1 1 1 2 1 254 Actual Look-Up Tables
2 2 2 4 2 253
3 3 3 6 3 252
4 4 4 8 4 251

254 254 254 2 254 1


255 255 255 0 255 0

Red Green Blue 250

200

Displayed Image
Graphical display of the 150

3 Look-Up Tables 100

50
Plot of LUT - Red
Plot of LUT - Green 0
0 50 100 150 200 250

Plot of LUT - Blue Stored Im age


Brightness and Contrast
All operations via LUT potentially change the
image or displayed brightness and contrast
– Brightness
• changed by increases or decreases in the pixel value
• simple LUT operation – addition or subtraction
– Contrast
• changed by increasing or decreasing the difference
between 2 pixels
• simple LUT operation – multiplication or division
Note. In MI brightness and contrast are changed using WW /
WL, which IS a just a LUT
Graphical Display of Typical LUTs
250 250

200 200

Straight
Log
Output values

Output values
150
ie. x by 1 150

100 100

50 50

0 0
0 50 100 150 200 250 0 50 100 150 200 250
Input Values Input Values

250 250

200 200

Exponential
Output values

Output values
150 150

100 Window Width 100

/ Level
50 50

0 0
0 50 100 150 200 250 0 50 100 150 200 250
Input Values Input Values
Use of LUT to alter Brightness
Use of LUT to alter Contrast
WW / WL of original image
250

Window Width
=125
200
Output values

150

100

Window Level
(or Centre)
50 = 95

0
0 50 100 150 200 250
Input Values
WW / WL – changed to increase image contrast
250
Window Width
=62

200
Output values

150

100

50 Window Level
= 95

0
0 50 100 150 200 250

Input Values
WW / WL – changed to increase image brightness
250

Window Width
= 125
200
Output values

150

100

50 Window Level
(now 120 )

0
0 50 100 150 200 250

Input Values
Graphical Display of S-Shaped LUTs
typical shapes used in the viewing of CR and DR x-ray images
with changes of brightness and contrast

original image brightness level – Red original image contrast level – Red
image with increased brightness – Blue image with increased contrast – Blue

250
250

200
200

150
150

100
100

50 50

0 0
0 50 100 150 200 250 0 50 100 150 200 250
LUT
Results

Take note of
the image and
displayed
histograms.
Review this
section after
undertaking
the histogram
section
Histograms

An example of another point operation


A variety of histograms
– Image
– Region or ROI (region of interest)
– Transect
Image Histogram

Image Histogram (Baxes – brightness histogram)


are a plot of potential pixel values (in an 8 bit
depth image – 0 to 255) vs no of pixels with that
value.
Can be thought of as, from statistics, a frequency
distribution plot
Y axis can plot number of pixels or % of total no.
of pixels
Image Histogram

Provides
– an indication of distribution of pixels values
– if displayed with a linear LUT, image contrast &
brightness
Can be used to aid in adjustment of image
contrast levels and brightness
Does not provide any information about what
can be perceived within the image, ie. does not
provided any spatial information
900

800

Image Histogram
700
No.
of 600

pixels 500

400

300

200

100

0 50 100 150 200 250

Pixel values

Image Histogram: Plot of pixel values v no of pixels with that value


Image Contrast: - well balanced
High Image Contrast

Low Image Contrast


Image Histogram Operations

Histogram Stretching
– a display process, through where the histogram is stretched
through the point operation of multiplication or division
– changes the displayed / image contrast
– equivalent to Window Width in MI
Histogram Sliding
– a display process, through where the histogram is altered
through the point operation of addition or subtraction
– changes the displayed / image brightness
– equivalent to Window Level in MI
Histogram Stretching
Histogram Sliding
Histogram Sliding
Image Histogram Operations

Histogram Equalisation
– an automated process that enables a high or low contrast
image to become well balanced contrast image.
– achieved through a ‘non-linear’ process where by some
pixels values are changed at a different rate to others
(operations like x, ÷, +, - are linear operations as the
relative increase is the same across all pixel values)
– not commonly used in medical imaging though is used in
optometry
1

0.9

Non-linear 0.8

enhancement plot 0.7

(for this image 0.6

LUT
equalisation)
0.5

0.4

Depends on the 0.3

shape of the 0.2

original histogram 0.1

0
0 50 100 150 200 250 300

900

1000
800
900
700
800

600
700

500 600

500
400

400
300
300
200
200

100
100

0 0

0 50 100 150 200 250 0 50 100 150 200 250


900

1000
800
900
700
800

600
700

500 600

500
400

400
300
300
200
200

100
100

0 0

0 50 100 150 200 250 0 50 100 150 200 250


palm histogram equalise histogram
1500
1000

900

800

700 1000

600

500

400
500
300

200

100

0 0

0 50 100 150 200 250 0 50 100 150 200 250


Histogram Equalisation Image.
Normal gray-scale fundoscopic image. Post-histogram equalisation processing

Priya R, Aruna P. Review of automated diagnosis of diabetic retinopathy using the support vector machine.
International Journal of Applied Engineering Research, 1(4), 2011
Other Histogram Information

In calculating a histogram, other image


information can be gained
– pixel value info – maximum, minimum, mean,
standard deviation, variance
– row & column info – no of rows, columns & pixels

– Useful, especially in medical images when


measuring values, eg. CT numbers
Histogram for Region of Interest

A Region of Interest Histogram is similar to an


image histogram, except only in a selected
region of the image
More commonly used for the statistical
information
– eg. a ROI in CT will provide mean and SD CT values
to give the clinician an indication to the density of
that region
Transect Histogram

Also called a pixel or line profile


A plot of pixel values vs pixel locations along a
prescribed line
Useful in evaluating changes in an image due to:
– local operations (discussed later) which change
perceived spatial resolution
– point operation which change local image contrast
Transect Histogram
or
Pixel Profile

300

250

200

150

100

50

0
0 50 100 150 200 250
Distance along profile
300 300

250 250

200 200

150 150

100 100

50 50

0 0
0 50 100 150 200 250 0 50 100 150 200 250
Distance along profile Distance along profile
Spatial Domain Processing
Local Operations
Local Operations are primarily used to change spatial
detail or the perceived spatial resolution of the image
A local operation operates on a group pixels ie. they
take into account neighbouring pixel values
At the same time, local operations can alter the image
brightness and / or contrast
Local Operations
Instead of operating on a single pixel like point operators, local
operators operate on a group or neighbourhood of pixels in the
image.
– the size of the neighbourhood can vary
The result of the local operation is a single pixel in the new
image.
The new value must be an integer and fit within the bit depth
(clipping may occur)
An operation on a pixel and its neighbour will mean spatial detail
will change
Local Operation Process
Local Operation Process
– filter or kernel size is selected, usually square. Typical sizes, but
not limited to, are 3x3 or 5x5
– filter operates on the same size area, neighbourhood, in top left
of image
– output value, a single value, is stored in a new pixel location that
would be the centre of the original neighbourhood.
– filter is moved 1 pixel to right, operation occurs and moved until
row completed and moved 1 row down, etc
Local Operation Process
The Local Operation process is denoted by:
O(x,y) = k(a,b) ⊗ I(x,y) where k(a,b) is the kernel
this whole process is known as Convolution
A B C
a general term of k(a,b) (for a 3 x 3 kernel) = D E F
G H I

The first step of this local operation is a 3x3 kernel is placed in top left of
the image
O(x2,y2) = [I(x1,y1) * A] + [I(x1,y2) * B] + [I(x1,y3) * C]
+ [I(x2,y1) * D] + [I(x2,y2) * E] + [I(x2,y3) * F]
+ [I(x3,y1) * G] + [I(x3,y2) * H)] + [I(x3,y3) * I]
Note: * is multiplication
Local Operation Process
I(x,y) Operation 3x3
0 1 2 3 4 5 6 A B C
0 153 216 29 205 70 216 182 D E F
1 121 204 149 218 174 159 232 G H I
2 178 103 201 131 170 216 253
3 242 158 112 47 120 237 176
4
5
45
26
87
175
49
17
97
73
191
27
242
146
98
61 O(x,y)
6 104 229 63 147 247 125 51
0 1 2 3 4 5 6
7 126 20 157 181 166 66 226
0
8 199 153 10 51 202 186 150 1 156
2
3
4
5
6
7
8
Local Operation Process
in this case the operation is as
per the previous slides,
multiply image values by the
kernel value and sum them all
together to get O(x,y).
However there are other types
of kernel operations – more on
this later

Bushberg, JT, Seibert, JA, Leidholdt, EM & Boone, JM 2002, The essential physics of
medical imaging, 2nd edn, Lippincott, Williams and Wilkins, Philadelphia, p.312
An output value of the process is placed in O(x,y) in the
middle of where kernel would be located in O(x,y)
This process is then repeated by moving the kernel 1
column and producing a new output value.
Once this row is completed, the kernel is moved back to
the beginning of the row and 1 row down.
Again, this is repeated until the entire image has been
covered
Local Operation Process
I(x,y) Operation 3x3
0 1 2 3 4 5 6
0 153 216 29 205 70 216 182
1 121 204 149 218 174 159 232
2 178 103 201 131 170 216 253
3 242 158 112 47 120 237 176
4
5
45
26
87
175
49
17
97
73
191
27
242
146
98
61 O(x,y)
6 104 229 63 147 247 125 51
0 1 2 3 4 5 6
7 126 20 157 181 166 66 226
0
8 199 153 10 51 202 186 150 1 156 124
2
3
4
5
6
7
8
Local Operation Process
I(x,y) Operation 3x3
0 1 2 3 4 5 6
0 153 216 29 205 70 216 182
1 121 204 149 218 174 159 232
2 178 103 201 131 170 216 253
3 242 158 112 47 120 237 176
4
5
45
26
87
175
49
17
97
73
191
27
242
146
98
61 O(x,y)
6 104 229 63 147 247 125 51
0 1 2 3 4 5 6
7 126 20 157 181 166 66 226
0
8 199 153 10 51 202 186 150 1 156 124 132
2 178
3
4
5
6
7
8
Local Operation Process
A decision has to be made about the outer row(s) & column(s) of the
new image, O(x,y)
– In process shown previously, no new values of O(x,y) in outer
row / column, then “pad” these with zeros
– Alternative, have filter start outside of original image, I(x,y) and
fill in outer row / column with values
• no values outside of the image exist, so some filter values
would be multiplied by zero. O(x,y) values in outer row /
column will be inaccurate.
Alternate Local Operation Process
I(x,y) Operation 3x3

127 155 147 106 116 187 223 113


147 122 215 168 100 214 223 116
40 145 54 25 234 179 206 213
8 229 106 223 227 182 117 7 O(x,y)
215 225 122 196 128 14 212 203
0 1 2 3 4 4 6
149 74 189 69 124 131 171 234
0 25
49 251 75 74 159 68 59 207
1
109 32 55 113 41 164 151 58
2
13 219 31 40 97 245 161 210
3
133 141 218 14 164 27 143 52
4
212 250 143 197 53 191 16 25
5
37 63 68 130 143 19 20 202
6
7
8
Types of Local Operators

The spatial appearance of O(x,y) will depend


upon:
– values in the kernel
– size of the kernel
Collectively, known as Linear Filters
Main types:
– Low Pass Filters
– High Pass Filters
Low Pass Filters

Generally smooth or blur the edges of an image


Called “Low Pass” as these filters have little or no effect
on low frequency area, i.e. large smooth objects, in the
image.
– “passes over low frequency areas”
Amount of smoothing / blurring will
– depend on values in the filter
– generally increase blurring as filter size increase
Low Pass Filters
Properties of the filter or kernel
– kernel values will add up to 1
– all kernel values will be positive
3 x 3 Mean or 5 x 5 Mean
Average Filter 0.04 0.04 0.04 0.04 0.04
0.04 0.04 0.04 0.04 0.04
0.111 0.111 0.111 0.04 0.04 0.04 0.04 0.04
0.111 0.111 0.111 0.04 0.04 0.04 0.04 0.04
0.04 0.04 0.04 0.04 0.04
0.111 0.111 0.111
or
or
1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1
1 1 1 ÷9 1 1 1 1 1 ÷ 25
3x3 Low Pass

5x5 Low Pass

Original

5x5 Low Pass


Low Pass Filters
Gaussian Smoothed Filter
0.007307 0.032747 0.053991 0.032747 0.007307
0.032747 0.14676 0.24197 0.14676 0.032747
0.053991 0.24197 0.39894 0.24197 0.053991
0.032747 0.14676 0.24197 0.14676 0.032747
0.007307 0.032747 0.053991 0.032747 0.007307

Plot across Gaussian Filter above


at the line with the arrows 0.06

0.05

0.5
0.04

0.4 0.03

0.3 0.02

0.2 0.01
S7

0.1 0 S4
1 2 3 4 5 6 S1
7
0 8 9

0 2 4 6 8
Surface plot of 9x9 Gaussian Filter
Filter / Kernel Total Value
Spatial domain local operators change local contrast in
the image to change spatial details
Low pass mean filters always have a sum total of their
values of 1
Reason – a sum total will not change overall image
brightness
– A point operation of x by 1 – there is no change to the image
brightness or contrast
– If the sum total of the filter is NOT = 1, then overall image
brightness will change
Original Smoothed & filter sum total = 1 Smoothed & filter sum total = 0.5
Median Filter
The median filter is a low pass filter with its prime
function as “noise” removal, though not all types of
noise
Noise is a random event and typically results in a high
or low pixel values in the image.
– on an image it will appear as black or white dots (sometimes
called a “salt & pepper” appearance)
– this type of noise will be small in size compared to other
objects in the image
– low mAs x-rays will have a similar appearance
– NOTE. There are other types of noise that don’t have this
appearance, eg scatter radiation in x-ray
Noise in images
Median Filter

The median is a non-linear filter. The other low


pass filters are linear, ie. pixel values are
multiplied by constant filter values
A 3 x 3 mean filter will average the noise with
the other pixel values, but the noise will still
remain
Median Filter
A median filter can still use 3x3 or 5x5 kernels or any
other size.
The kernel is placed over the original image, I(x,y), as
previously seen with other filters / kernels
The pixel values are place in rank order and the median
value, ie the middle value, becomes the new pixel value in
O(x,y)
High or low noise values will be removed with little or no
smoothing of the image.
Median Filter Operation Process
I(x,y) 3x3 Filter
12

12 12 13 14 13 14 15
12 (can be other sizes)
12 13 14 254 14 15 13
13
13
to
13 12 13 14 13 14 15
13 ranked order
and
14
12 13 14 13 14 15 13 14
13 14 13 14 15 13 12 14
select the
254
15 13 12 13 14 13 14 median value

13

Noise (254) is
O(x,y)
removed
Comparison - 3x3 Low Pass Mean Filter
I(x,y) 3x3 Filter
12 12 13 14 13 14 15
.111 .111 .111 Low Pass
12 13 14 254 14 15 13
.111 .111 .111 Filter
.111 .111 .111
13 12 13 14 13 14 15

12 13 14 13 14 15 13

13 14 13 14 15 13 12

15 13 12 13 14 13 14

40

Noise (254) is
O(x,y)
averaged
with the other values,
not removed
Original 3x3 low
pass

5x5 low median


pass

Noisy image and effects of various filters


Original 3x3 low
pass

5x5 low median


pass

Noisy image and effects of various filters


Original Median Filter
Other Noise Removal Filter

Another linear filter used in noise reduction is the


Wiener filter.
This method measures the mean values in a
kernel (3x3, 5x5, etc.) and calculates the error of
the mean (similar to standard deviation) and
uses both values to calculate the new pixel value
Original median

Wiener filter
Noisy image and effects of various filters
median
Original

Wiener Filter

Noisy image and effects of various filters

You might also like