0% found this document useful (0 votes)
30 views29 pages

Image Processing Techniques Guide

This document discusses various topics in image processing including: 1. Image restoration, enhancement, and compression techniques. 2. Representing digital images using matrices of integer numbers indexed by pixel coordinates. 3. The use of histograms to analyze the distribution of pixel intensities in an image, including normalization and cumulative histograms. Histogram equalization is discussed as an application. 4. Various intensity transforms including photographic negative and gamma transforms are described and examples given.

Uploaded by

mustafa arkan
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)
30 views29 pages

Image Processing Techniques Guide

This document discusses various topics in image processing including: 1. Image restoration, enhancement, and compression techniques. 2. Representing digital images using matrices of integer numbers indexed by pixel coordinates. 3. The use of histograms to analyze the distribution of pixel intensities in an image, including normalization and cumulative histograms. Histogram equalization is discussed as an application. 4. Various intensity transforms including photographic negative and gamma transforms are described and examples given.

Uploaded by

mustafa arkan
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/ 29

Content

1. Image processing
 Image Restoration
 Image Enhancement
 Image Compression
2. Computer Imaging Systems
3. Representing Digital Images
4. Image Histogram
 Definition of histogram
 Properties of histogram
 Type of histogram
 Applications of Histogram
 Histogram Modifications
 Histogram equalization
Photographic Negative
This is perhaps the simplest intensity transform. Supposing that we have a gray
level image in the range [0, 1]. It is expected to transform the:
 Black points (0s) into the white ones (1s).
 White pixels (1s) into the black ones (0s).
this simple transform can be denoted by ( assume that f(x, y) is normalized into
the range [0, 1]).
𝒇 (x, y)= 1- 𝒇 (x, y)
For a 256 gray level image, the transformation can be accomplished
𝒇 (x, y)= 1- 𝒇 (x, y) / 256
An example of the photographic negative transform is shown in figure below

1-1=0
1 0 0 1 0 1 1 0
0 1 1 0 1 0 0 1
1 0 1 1 0 1 0 0
0 1 0 1 1 0 1 0
Figure (a) A panda image, (b) negative transformed image
Gamma transform
Gamma transform is also called power-law transform. It is mathematically
denoted as follows:
𝒇 (x, y) = C * 𝒇 (𝒙, 𝒚)𝜸

Where: 𝑪 and 𝜸 are two constants.


 The gamma transform can make pixels look brighter or darker
depending on the value of 𝜸.

 When 𝒇 (𝒙, 𝒚) is within the range [0, 1] and


 𝜸 is larger than one, it makes the image darker.
 𝜸 is smaller than one, it makes the image look brighter.
 Figure below shows the output of the gamma transform against different inputs
with the parameters set as ( 𝜸 = 0.5, 1 and 2), ( C = 1).

 From this plot, we can see that the


curve with 𝜸 = 2 is below the
curve with 𝜸 = 1.

 This indicates that the output is


smaller than the input, which
explains why an image in the
Gamma transform, when 𝜸 = 2,
will become darker.

Figure (a) shown gamma transformed


images different parameters
Gamma=2, (b) Gamma=0.5
Image processing is computer imaging where application involves a
human being in the visual loop. In other words the image are to be
examined and an acted upon by people. The major topics within the field
of image processing include:

1- Image Restoration
 Is the process of taking an
image with some known, or
estimated degradation, and
restoring it to its original
appearance.
 Image restoration is often used
in the field of photography or
publishing where an image was
somehow degraded but needs to
be improved before it can be
printed.
2- Image Enhancement
Involves taking an image and improving it visually, typically by taking
advantages of human Visual Systems responses, One of the simplest
enhancement techniques is to simply stretch the contrast of an image.

Enhancement methods tend to be


problem-specific.
For example: a method that is used to
enhance satellite images may not suitable
for enhancing medical images.
Although enhancement and restoration
are similar in aim, to make an image look
better, they differ in how they approach Image with poor Image enhancement by
contrast contrast stretching
the problem.

• Restoration method attempt to model the distortion to the image and


reverse the degradation,
• Enhancement methods use knowledge of the human visual systems
responses to improve an image visually.
3- Image Compression
Involves reducing the typically massive amount of data needed to represent
an image, This done by eliminating data that are visually unnecessary and
by taking advantage of the redundancy that is inherent in most images.
Image processing systems are used in many and various types of
environments, such as:

1. Medical community
2. Computer – Aided Design
3. Virtual Reality
4. Image Processing.

Image before compression Image after compression


92 KB 6.59 KB
Computer imaging systems are comprised of two primary components
types, hardware and software.

 The hardware components can be divided into image acquiring sub


system (computer, scanner, and camera) and display devices (monitor,
printer).
 The software allows us to manipulate the image and perform any
desired processing on the image data.

Computer image system


The result of sampling and quantization is matrix of integer numbers. We
will use two principal ways to represent digital images.
• Assume that an image f(x, y) is sampled so that the resulting digital image
has rows and columns. The values of the coordinates (x, y) now become
discrete quantities.
• For notational clarity and convenience, we shall use integer values for
these discrete coordinates. Thus, the values of the coordinates at the
origin are (x, y) = (0, 0).
The next coordinate values along the first
row of the image are represented as (x, y)=
(0, 1). It is important to keep in mind that
the notation (0, 1) is used to signify the
second sample along the first row.
It does not mean that these are the actual
values of physical coordinates when the
image was sampled.
Coordinate convention used in this book
to represent digital images
The notation introduced in the preceding paragraph allows us to write the
complete M*N digital image in the following compact matrix form:

 The right side of this equation is by definition a digital image.


 Each element of this matrix array is called an image element, picture
element, and pixel.
In some discussions, it is advantageous to use a more traditional matrix
notation to denote a digital image and its elements:
The quality of digital image is directly related to the Number of pixel and
lines along with the range of brightness values, in the image. These aspects
are known as image Resolution

Image resolution: is the capability of the digital image to resolve the


elements of the original scene.

For digital image, the resolution characteristic can be broken in to two


primary parts
1- Spatial resolution.
2- Brightness resolution or (color resolution) in the image color.
The histogram of an image records the frequency distribution of gray levels
in the image. The histogram of an 8-bit image, can be thought of as a table
with 256 entries, or “bins”, indexed from 0 to 255. in bin 0 we record the
number of times a gray level of 0 occurs; in bin 1 we record the number of
times a gray level of 1 occurs, and so on , up to bin 255.
One of the principle uses of the
histogram is in the selection of
threshold parameter. Closely related to
the histogram of an image is it’s
cumulative histogram, which record
the cumulative frequency distribution
of gray levels in an image
The cumulative frequency of a gray levels, I, is the number of times that
gray level less than or equal to I occurs in an image. Cumulative frequencies,
Ci , ar computed from histogram counts, hi , using
𝒋
C j= 𝒊=𝟎 𝒉𝒊
We can normalize a histogram by dividing the counts in each bin by the total
number of pixels in the image associated with that histogram. This gave us a
table of estimated probabilities. i.e. probability density function (pdf) of the
image .

A normalized histogram can be mathematically defined as


p(rk) = nk/n Gray nk p(rk)
Level (rk)
where n is the total number of pixels in the 0 1120 0.068
image and p(rk) is the probability (percentage) of 1 3214 0.196
the kth gray level (rk). 2 4850 0.296
3 3425 0.209

Table below shows the pixel counts for a 4 1995 0.122

hypothetical image containing 128×128 pixels, 5 784 0.048


with eight gray levels. 6 541 0.033
7 455 0.028
total 16.384 1.000
 Histograms are normally represented using a bar
chart, with one bar per gray level, in which the
height of the bar is proportional to the number (or
percentage) of pixels that correspond to that
particular gray level.
 A normalized cumulative histogram is a table of
Cumulative probabilities, i.e , the cumulative
distribution function (CDF) of the image .

• When an image is condensed into a histogram, all spatial information is


discarded.
• The histogram specifies the number of pixels having each gray level but
gives no hint as to where those pixels are located within the image.
• Thus the histogram is unique for any particular image, but the reverse is
not true.
• Vastly different images could have identical histograms.
• Such operations as moving objects around within an image typically have
no effect on the histogram.
You can get a general idea of the brightness of an image by looking at the
histogram and observing the spatial distribution of the values

1. If the histogram values are


concentrated toward the left, the
image is darker .
2. If the histogram values are
concentrated toward the right, the
image is lighter .

3. A histogram in which the pixel counts


that are restricted to a smaller range
indicate low contrast.
4. A histogram in which the pixel counts
evenly cover a broad range of
grayscale levels indicates an image
with good contrast .
1. Thresholding
A grayscale image can be converted into a
black-and-white image by choosing a
threshold and converting all values above the
threshold to the maximum intensity and all
values below the threshold to the minimum
intensity. A histogram is a convenient means
of identifying an appropriate threshold.

2. Image Enhancement
Image enhancement refers to the process of
transforming an image so as to make it more
visually appealing or to facilitate further
analysis. An image histogram can help us to
quickly identify processing operations that
are appropriate for a particular image.
The gray level histogram of an image is the distribution of the gray level in an
image.

The histogram can be modified by


mapping functions, which will
1. Stretch,
2. Shrink (compress),
3. Slide the histogram

Figure below illustrates a graphical


representation of histogram stretch,
shrink and slide.
1. Stretch histogram
The mapping function for histogram stretch can be found by the following
equation:

Where:
I(r, c) max is the largest gray- level in the image I(r, c).
I(r, c) min is the smallest gray- level in the image I(r, c).
max and min the maximum and minimum gray – level values possible
(for an 8-bit image these are 255 and 0).

This equation will take an image and stretch the


histogram a cross the entire gray-level range which has
the effect of increasing the contrast of a low contrast
image of histogram stretching.
 In most of the pixel values in an image fall within small
range, but a few outlines force the histogram to span the
entire range, a pure histogram stretch will not improve
the image.
 In this case it is useful to allow a small proceeding of the
pixel values to be aliped at the low and high end of the
range (for an 8-bit image this means truncating at 0 and
255).
2. Shrink (compress)
The opposite of a histogram stretch is a histogram shrink, used to decrease
image contrast by compressing the gray levels. The mapping function for a
histogram shrinking can be found by the following equation:
𝑺𝒉𝒓𝒊𝒏𝒌𝒎𝒂𝒙 − 𝑺𝒉𝒓𝒊𝒏𝒌𝒎𝒊𝒏
𝑺𝒉𝒓𝒊𝒏𝒌 𝑰 𝒓, 𝒄 = 𝑰 𝒓, 𝒄 − 𝑰(𝒓, 𝒄)𝒎𝒊𝒏 + 𝑺𝒉𝒓𝒊𝒏𝒌𝒎𝒊𝒏
𝑰(𝒓, 𝒄)𝒎𝒂𝒙 − 𝑰(𝒓, 𝒄)𝒎𝒊𝒏

Where : Shrink max and shrink min correspond


to the maximum and minimum desired in the
compressed histogram.

In general, this process produces an image


of reduced contrast and may not seem to
be useful an image enhancement.
3. Slide the histogram
The histogram slide techniques can be used to make an image either darker or
lighter but retain the relationship between gray-level values.
This can be a accomplished by simply adding or subtracting a fixed number
for all the gray-level values, as follows:
𝑺𝒍𝒊𝒅𝒆 𝑰 𝒓, 𝒄 = 𝑰 𝒓, 𝒄 + 𝑶𝑭𝑭𝑺𝑬𝑻

Where: OFFSET values is the amount to


slide the histogram.

In this equation, a positive OFFSET


value will increase the overall brightness;
where as a negative OFFSET will create
a darker image, figure below shows
histogram sliding
Example :
Suppose you have the following sub of image. Perform the following operation
1. Stretch histogram.
7 12 8 7
2. Shrink (compress) histogram
3. Slide the histogram 11 9 6 4
Where: Image with 6 bit for each pixel 10 5 1 5
Shrinkmax = 30, Shrinkmin = 10
OFFSET values = 50

Answer :
1. Stretch histogram
I(r,c)max = 12 , I(r,c)min = 1 , Max = 63 , Min = 0

34.36

I( r, c) = ((7-1)/(12-1) ) * (63-0)+0
= (6/11)*63 = 34.36
2. Shrink histogram 7 12 8 7
I(r,c)max = 12, I(r,c)min = 1, 11 9 6 4
Shrinkmax =30, Shrinkmin =10 10 5 1 5

𝑺𝒉𝒓𝒊𝒏𝒌𝒎𝒂𝒙 − 𝑺𝒉𝒓𝒊𝒏𝒌𝒎𝒊𝒏
𝑺𝒉𝒓𝒊𝒏𝒌 𝑰 𝒓, 𝒄 = 𝑰 𝒓, 𝒄 − 𝑰(𝒓, 𝒄)𝒎𝒊𝒏 + 𝑺𝒉𝒓𝒊𝒏𝒌𝒎𝒊𝒏
𝑰(𝒓, 𝒄)𝒎𝒂𝒙 − 𝑰(𝒓, 𝒄)𝒎𝒊𝒏

I( r, c) = ((30 - 10) / (12-1) ) * (7 - 1) + 10 20.86


= (20/11)*6 + 10 = 20.86

3. Slide the histogram


OFFSET values = 50
57 62 58
𝑺𝒍𝒊𝒅𝒆 𝑰 𝒓, 𝒄 = 𝑰 𝒓, 𝒄 + 𝑶𝑭𝑭𝑺𝑬𝑻

I( r, c)= 7 + 50
= 57
• Is a popular technique for improving the appearance of a poor image.
It's a function is similar to that of a histogram stretch but often provides
more visually pleasing results a cross a wide rang of images.
• Histogram equalization is a technique where the histogram of the
resultant image is as flat as possible (with histogram stretching the overall
shape of the histogram remains the same)

The results in a histogram with a mountain grouped closely together to


"spreading or flatting histogram makes the dark pixels appear darker and
the light pixels appear lighter

The histogram equalization process for digital images consists of four steps:
1. Find the running sum of the histogram values
2. Normalize the values from step1 by dividing by total number of pixels.
3. Multiply the values from step2 by the maximum gray level value and
round.
4. Map the gray-level values to the results from step 3, using a one-to-one
correspondence.
Example : -
We have an image with 3 bit /pixel, so the possible range of values is 0 to 7 .
We have an image with the following histogram
Image Histogram
Gray level value 0 1 2 3 4 5 6 7 15
No. of Pixel 10
10 8 9 2 14 1 5 2
histogram value No. of
5 Pixel
0
01234567

Answer :
Step 1:
Great a running sum of histogram values. This means that the first values is
10, The second is 10+8=18, next is 10+8+9=27, and soon. Here we get
10,18,29,43,44,49,51.
Gray level value 0 1 2 3 4 5 6 7
No. of Pixel 10 8 9 2 14 1 5 2
Run sum 10 18 27 29 43 44 49 51
Step 2:
Normalize by dividing by total number of pixels. The total number of pixels is
10+8+9+2+14+1+5+2=51.
Gray level value 0 1 2 3 4 5 6 7
No. of Pixel 10 8 9 2 14 1 5 2
Run sum 10 18 27 29 43 44 49 51
Normalize 10/51 18/51 27/51 29/51 43/51 44/51 49/51 51/51

Step 3:
Multiply these values by the maximum gray level values in this case 7 , and
then round the result to the closet integer. After this is done we obtain
1,2,4,4,6,6,7,7. Gray level value 0 1 2 3 4 5 6 7
No. of Pixel 10 8 9 2 14 1 5 2
Run sum 10 18 27 29 43 44 49 51
Normalize 10/51 18/51 27/51 29/51 43/51 44/51 49/51 51/51
Multiply by 7 1 2 4 4 6 6 7 7

Step 4:
Map the original values to the results from step 3 by a one–to-one
correspondence. Old 0 1 2 3 4 5 6 7
New 1 2 4 4 6 6 7 7
All pixel in the original image with gray level 0 are set to 1, values of 1 are set
to 2, and values 2 set to 4, and values 3 set to 4, and so on.
Histogram equalization, you can see the original histogram and the resulting
histogram equalized histogram. Although the result is not flat, it is closer to
being flat than the original. Before Histogram Equalization

Image Histogram
Gray level
0 1 2 3 4 5 6 7
Before value 15
Histogram
Equalization No. of Pixel
histogram 10 8 9 2 14 1 5 2 10
value No. of
5 Pixel

After Gray level 0


0 1 2 3 4 5 6 7
Histogram value
Equalization 01234567
No. of Pixel
histogram 0 10 8 0 11 0 15 7
value Image Histogram
20
10 No. of
Pixel
0
01234567
After Histogram Equalization
Original image Histogram of original image

Image after histogram equalization Histogram after equalization

Histogram Equalization

You might also like