2010
A definition of Image Processing and
Computer Vision
Image Processing
◦ Manipulate image data
◦ Generate another image
Computer Vision Image Processing
◦ Process image data
◦ Generate symbolic data
Computer Vision
Multimedia 16/11/2010 2
Relationship between Image Coding, Image
Processing and Image Compression
Image Image
Coding Processing
Multimedia 16/11/2010 3
Rectify the defects introduced by the image
capturing process
Improve the image appearance for better
human perception
Identify and quantify structures in the image
Transform image into an alternative
representation in which some operations may
be performed more efficiently
Multimedia 16/11/2010 4
Three simple grey scale operations
Add a constant to each pixel of a grey
image
Scale the values by a constant multiplier
Apply a linear operations
Other grey level manipulations
False Contouring
Thresholding
Grey Level Histogram
Multimedia 16/11/2010 5
output
Manipulate the grey
or colour value of
an individual pixel
The only
information is
brightness or colour
Map each input
grey value to an
output grey value input
16/11/2010 Multimedia 6
Add a constant to each output
pixel of a grey image max
The output grey values
are truncated when
they exceed the valid
range
The entire image is
brightened up if the
constant is positive
min
The image is darkened
if the constant is
negative
input
16/11/2010 Multimedia 7
original -10% -30%
Multimedia 16/11/2010 8
Scale the values by output
a constant max
multiplier
The difference in
brightness is
raised/decreased
when the scale is
more/less than
0
1.0
input
16/11/2010 Multimedia 9
In general, combine the two simple
operations to adjust the contrast and
overall brightness
The brightness of the pixels in the new
image, P, can be related to the brightness
in the old image, p, by
Px, y k px, y l , x, y 1, N
where the overall brightness is controlled
by a level, l, and the contrast is
controlled by a gain, k.
16/11/2010 Multimedia 10
How much brightness should be added?
What scaling factor ought to be used?
Multimedia 16/11/2010 11
Interactive manipulation
User chooses the input grey values, a and b,
and output grey values a’ and b’.
The system performs linear mapping from [a,
b] to [a’, b’].
The extreme values 0 and 255 remain
unchanged.
Multimedia 16/11/2010 12
Interactive manipulation output
Maps linearly input
grey values from [a, b] b’
to the ouptut grey
values [a’, b’]
Certain portions [a, b]
are expanded
Other portions are a’
compressed
a b input
16/11/2010 Multimedia 13
An automatic approach:
use the full range of output
grey level
Find the minimum and 255
maximum brightness in
the image
Extend the range of
min to max brightness
in picture to the full
range [0, 255] of
brightness
A negative constant
and scale >1.0 0
increases the difference Min
in brightness Max
input
16/11/2010 Multimedia 14
+50%
-50%
-90%
Original 200x200 +90%
Multimedia 16/11/2010 15
False contouring output
Apply the
255
sawtooth operator
to the image
colours
Change gradual
changes into rapid
changes from dark
0
to bright values
input
16/11/2010 Multimedia 16
False Contouring
Highlight local intensity variations
Image divided into regions according to
pixels’ intensities
Multimedia 16/11/2010 17
Use a threshold to transforms an input
image into a binary image
Compare each input pixel value f(i, j)
against the threshold, θ, and setting the
output pixel value g(i, j) appropriately
0 if f (i, j )
g (i, j )
1 otherwise
Multimedia 16/11/2010 18
Different images can be
generated from using
different thresholds.
Higher threshold allows
only fewer brighter pixels
to become white.
16/11/2010 Multimedia 19
Sample black and
white images
16/11/2010 Multimedia 20
Many applications in image processing
Difficult to decide the value of threshold, θ.
The threshold value may depend on the
application required.
Multimedia 16/11/2010 21
The Grey Level Histogram or Intensity
Histogram
Plots the number of pixels with a particular
brightness level against the brightness level.
List of grey level values at the x-axis
Number of occurrence with the grey value at
the y-axis
Multimedia 16/11/2010 22
Intensity Histogram
800
700
600
500
400
300
Lena 256x256 200
100
Intensity concentrates 0
around 5 peaks
GreyLevel
16/11/2010 Multimedia 23
Intensity Histogram
500
400
300
200
Multimedia 16/11/2010 24
Intensity Histogram
12000
10000
8000
6000
4000
2000
Multimedia 16/11/2010 25
The intensity histogram shows
◦ Intensity concentrates around peaks
◦ Not all available grey levels are used.
The image may be normalised to cover the full
range of grey levels.
The old image O has histogram from O1 to O2.
The new image N will have histogram from N1 to
N2. The intensity of a pixel Nx,y is given by
N 2 N1
N x, y (Ox, y O1 ) N1 , x, y
O2 O1
16/11/2010 Multimedia 26
Histogram equalisation
◦ Assume that the image’s appearance will be
improved if the distribution of pixels over the
available grey levels is even.
◦ The cumulative histogram is generated from
the grey level histogram
◦ The cumulative histogram, G(i), is derived
from the grey level histogram, g(i), as
i
G (i) g (k )
k 0
16/11/2010 Multimedia 27
The cumulative intensity histogram of the
flower image
Cumulative Intensity Histogram
60000
50000
40000
30000
20000
10000
0
0 32 64 96 128 160 192 224
Multimedia 16/11/2010 28
The ideal case
◦ An equal number of
pixels having each
grey level
Equalisation
Transform expand expand
◦ warps the horizontal
axis of the histogram,
◦ Expand it in regions
where the number of
pixels with a grey Ideal
value is more than the case
ideal case
◦ Compress it in other
regions where the
number of pixels is
fewer than the ideal
case compress compress compress
Multimedia 16/11/2010 29
Maps each input, i, grey values to output, j,
grey values
The jth entry of the cumulative histogram
should have the value j*N/l. Thus,
j*N/l=G(i)
=> j=(l/N)*G(i)
The histogram manipulation is simple, but
it is not the best method to improve the
image’s appearance.
Multimedia 16/11/2010 30
The program may have the following codes
For Y = 1 To maxY
For X = 1 To maxX
oldColor = Pixel(X, Y)
newColor = Int(CumulativePixels(oldColor) * (maxGrey -
minGrey) / PixelCount) Mod 256
Next X
Next Y