0% found this document useful (0 votes)
33 views23 pages

Statistical Operations: - Gray-Level Transformation - Histogram Equalization - Multi-Image Operations

The document discusses several techniques for statistical operations and image processing including: 1) Gray-level transformation, histogram equalization, and multi-image operations. 2) Creating histograms to represent the distribution of pixel intensities in an image. 3) Altering image brightness globally by adding or subtracting a constant value from all pixel intensities.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views23 pages

Statistical Operations: - Gray-Level Transformation - Histogram Equalization - Multi-Image Operations

The document discusses several techniques for statistical operations and image processing including: 1) Gray-level transformation, histogram equalization, and multi-image operations. 2) Creating histograms to represent the distribution of pixel intensities in an image. 3) Altering image brightness globally by adding or subtracting a constant value from all pixel intensities.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

Statistical Operations

• Gray-level transformation
• Histogram equalization
• Multi-image operations

240-373 Image Processing 1


Histogram

• If the number of pixels at each gray level in a


n image is counted (may use the following co
de fragment)

for (row=0; row<rowmax; roww++)


for (col=0; col=colmax; col++)
{
count[image[row,col]]++;
}

240-373 Image Processing 2


Histogram

• The array “count” can be plotted to represent


a “histogram” of the image as the number of
pixels at particular gray level
• The histogram can yield useful information
about the nature of the image. An image may
be too bright or too dark.

240-373 Image Processing 3


Histogram Illustration

Histogram
10
9
1 2 3 2 3 2 8
0 0 1 2 1 4 7
4 4 2 1 2 1 6
1 2 1 2 1 2 5
5 4 2 1 4 0
4
3
2
1
0 0 1 2 3 4 5

240-373 Image Processing 4


Global Attenuation in Brightness

• To alter the brightness of an image by adding


or subtracting all pixel values with a constant

for (row=0; row<rowmax; roww++)


for (col=0; col=colmax; col++)
{
image[row,col] += constant;
}

240-373 Image Processing 5


Intensity Transformation
1
Adjusted Image

0.5

0
0 0.5 1

Histogram Histogram

240-373 Image Processing 6


Intensity Transformation
1
Adjusted Image

0.5

0
0 0.5 1

Histogram Histogram

240-373 Image Processing 7


Intensity Transformation
1
Adjusted Image

0.5

0
0 0.5 1

Histogram Histogram

240-373 Image Processing 8


Intensity Transformation
1
Adjusted Image

0.5

0
0 0.5 1

Histogram Histogram

240-373 Image Processing 9


Thresholding

• Use:
– To remove the gray level trends in an image
– To make gray level more discrete
– To segment or split an image into distinct parts
• Operation:
– setting all gray levels below a certain level to
“zero”, and above a certain level to a maximum
brightness

240-373 Image Processing 10


Code for Thresholding

for (row=0; row<rowmax; roww++)


for (col=0; col=colmax; col++)
{
if (image[row,col] > threshold)
image[row,col] = MAX;
else
image[row,col] = MIN;
}

240-373 Image Processing 11


Intensity Transformation
1
Adjusted Image

0.5

0
0 0.5 1

Histogram Histogram

240-373 Image Processing 12


Thresholding Errors

• Rarely is it possible to identify a perfect gray


level break, what we want to be background
pixels become foreground or vice versa
– Type 1: not all pixels caught that should be
included
– Type 2: some pixels caught should not be
included in the group

240-373 Image Processing 13


An image before and after thresholding

240-373 Image Processing 14


Bunching (Quantizing)

• Use:
– to reduce the number of different gray level in an
image
– to segment an image
– to remove unwanted gray level degradation
• Operation:
– Close gray levels are combined, thus removing
unwanted variations in data

240-373 Image Processing 15


Bunching (Quantizing)

• Method 1: inspecting histogram and


combining close group into single gray level
• Method 2: identifying a set of gray levels
allowed in the final image, then changing the
gray level in every pixel to its nearest allowed
value

240-373 Image Processing 16


Bunching Example

1 8 4 3 6 2 5 2 8 4 6 2 5 0 9 3 3 6 3 6 3 9 3 6 3 6
0 3 8 3 6 5 4 0 3 8 3 8 7 0 3 9 3 6 6 3 0 3 9 3 9 6
3 8 4 7 6 2 8 3 7 3 7 6 1 3 9 3 6 6 3 9 3 6 3 6 6 0
0 9 8 0 5 4 8 5 9 3 7 2 9 0 9 9 0 6 3 9 6 9 3 6 3 9

0 **** 0 ******
1 ** 1
2 ***** 2
3 ********* 3 *******************
4 ***** 4
5 ***** 5
6 ***** 6 ***************
7 ***** 7
8 ********* 8
9 *** 9 ************
240-373 Image Processing 17
Bunching Code

for (row=0; row<rowmax; row++)


for (col=0; col<colmax; col++)
{
image[row,col] = bunchsize*((int)image[row,col]/bunchsize);
}

bunchsize = number of levels to be grouped into one

240-373 Image Processing 18


Splittings

• Use:
– to increase the different two groups of gray levels
so that the contrast between segments compose
of one group of the other is enhanced
• Operation:
– rounding the gray levels up if they are in the
range and down if they are in another

240-373 Image Processing 19


Splitting Example

• The characters on a car number-plate are at


gray level 98
• The background of the characters is at gray
level 99
• Pushing 98 down to 80 and pushing 99 up to
120 will give the picture a better contrast
around the number plate

Question: How to find a good splitting level?

240-373 Image Processing 20


Automatic Selection of Splitting Level

• Use:
– to find the best gray level for splitting--usually for
thresholding to black and white
• Operation: g
– Let t ( g )   f (i )
i 0

where f ( g ) is the number of pixels at gray level g and


t ( g ) is the actual number of pixels at gray level g or less
in the image

240-373 Image Processing 21


Automatic Selection of Splitting Level

– Let P=NxM = the number of pixels under consideration


– Let m(g) = mean gray level for only those pixels containi
ng gray level between zero and g, i.e.
g

 g . f (i )
m( g )  i 0
t( g )

If the maximum number of gray level is G (G=0,…,G-1) then e


valuate the following equation (T = splitting threshold)

 t( g ) 2
T  max    m( g )  m(G  1)   1
 P  t( g ) 
A Processing
240-373 Image B 22
Example
Histogram f(g) t(g) g.f(g) g.f(g) m(g) A B A*B

0 **** 4 4 0 0 0 0.08 23.04 0.18


1 ** 2 6 2 2 0.3 0.13 20.25 2.83
2 ***** 5 11 10 12 1.1 0.27 13.69 3.70
3 ********* 9 20 27 39 2 0.63 7.84 4.94
4 ***** 5 25 20 59 2.4 0.93 5.76 5.36
5 ***** 5 30 25 84 2.8 1.36 4.00 5.44
6 ***** 5 35 30 114 3.3 2.06 2.25 4.64
7 ***** 5 40 35 149 3.7 3.33 1.21 4.03
8 ********* 9 49 72 221 4.5 16.33 0.09 1.47
9 *** 3 52 27 248 4.8 -INF-
T = max(A*B) - 1 = 4
240-373 Image Processing 23

You might also like