Sie sind auf Seite 1von 34

Digital Image Processing Project

Segmentation of Images
Using Edge Detection.
By : Al-baihan, Abdullah

Date : Tuesday 17/4/2007

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

I. Introduction:
The Image Processing is part of computer Sciences, It is applying in
many domain in the world like; medicine it can use in Breast Cancer
Detection, in space, in Speech recognition ,in Handwriting recognition ,in
Biometric identification, in Document classification ,In industry , Optical
Character Recognisation, Internet search engines , etc.
The Image Processing has some Fundamentals steps like;
1-Image Acquisition:
Image acquisition is the first and most important step in Digital
Imaging Systems. All deconvolution algorithms need high quality
images.[1]
2-Filtering:
Filtering is often used in image processing to smooth noise, and to
enhance or detect features within an image. Some of filter is linear and
nonlinear.
3-Feature extraction:
Feature extraction is the operation to extract various image features for
identifying or interpreting meaningful physical objects from images. It is
involves using algorithms to detect and isolate various desired portions of a
digitized image or video stream.[2]
4-segmentation:
Segmentation procedures partition an image into its constituent
parts or objects. in general , autonomous segmentation is one of the most
difficult tasks in digital image processing. A rugged segmentation procedure
brings the process long way toward successful solution of imaging problems
that require objects to be identified individually. [3]
Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

The segmentation step has some approaches like;


1-Edge-based methods.
Edge-based methods center around contour detection
2-Region-based techniques.
A region-based method usually proceeds as follows: the image is
partitioned into connected regions by grouping neighboring pixels of
similar intensity levels.
3-Connectivity-preserving relaxation methods.
The main idea is to start with some initial boundary shape
represented in the form of spline curves, and iteratively modify it by
applying various shrink/expansion operations according to some energy
function.
4-Threshold techniques.
Threshold techniques, which make decisions based on local pixel
information, are effective when the intensity levels of the objects fall
squarely outside the range of levels in the background.
The Threshold techniques has many methods like; Edge detection , it
is a problem of fundamental importance in image analysis.
My project is segmentation of Image using Edge information.
In chapter 1 I will explain the segmentation concept and available
approaches for Segmentation of image. In chapter2 I will explain the two
classes of image. In chapter3 I will explain the three classes of image. In
chapter4 I will explain the four classes of image. In the last of this report I
present some conclusion and Future works.
Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

Chapter#1 Segmentation
In this chapter I will explain the Segmentation concept and the
available approaches for Segmentation of image ,In last of this chapter I
will present conclusion.
Segmentation procedures partition an image into its constituent
parts or objects. in general , autonomous segmentation is one of the most
difficult tasks in digital image processing. A rugged segmentation procedure
brings the process long way toward successful solution of imaging problems
that require objects to be identified individually. on the other hand, weak
or erratic segmentation algorithm almost always guarantee eventual
failure. in general , the more accurate the segmentation, the more likely
recognition is to succeed. [3] page 27.
Segmentation is a very important problem in digital image
processing. It use to classification the objects from the background and
other objects. when the objects are classification the Segmentation is stop.
In section 1.1 I will explain briefly Edge-based methods. In section 1.2
I will explain briefly Region-based techniques. In section 1.3 I will explain
briefly Connectivity-preserving relaxation methods. In section 1.4 I will
explain briefly Threshold techniques. In last of this chapter I will present
conclusion.

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

1.1 Edge-based methods.


Edge-based methods center around contour detection: their weakness
in connecting together broken contour lines make them, too, prone to
failure in the presence of blurring. [4]

1.2 Region-based techniques.


A region-based method usually proceeds as follows: the image is
partitioned into connected regions by grouping neighboring pixels of similar
intensity levels. Adjacent regions are then merged under some criterion
involving perhaps homogeneity or sharpness of region boundaries.
Overstringent criteria create fragmentation; lenient ones overlook blurred
boundaries and overmerge. Hybrid techniques using a mix of the methods
above are also popular. [4]

1.3 Connectivity-preserving relaxation methods.


A connectivity-preserving relaxation-based segmentation method,
usually referred to as the active contour model, was proposed recently. The
main idea is to start with some initial boundary shape represented in the
form of spline curves, and iteratively modify it by applying various
shrink/expansion operations according to some energy function. Although
the energy-minimizing model is not new, coupling it with the maintenance
of an ``elastic'' contour model gives it an interesting new twist. As usual
Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

with such methods, getting trapped into a local minimum is a risk against
which one must guard; this is no easy task. [4]

1.4 Threshold techniques.


Threshold techniques, which make decisions based on local pixel
information, are effective when the intensity levels of the objects fall
squarely outside the range of levels in the background. Because spatial
information is ignored, however, blurred region boundaries can create
havoc. [4]
The Threshold techniques has many methods like; Edge information.

1.4.1 Edge detection.


Is a problem of fundamental importance in image analysis. In typical
images, edges characterize object boundaries and are therefore useful for
segmentation, registration, and identification of objects in a scene.

In general, the type of image is different according to number of


objects in the image. Like the following condition:
1. Two classes: Background and one object.

Before Segmentation
Segmentation of Images
Using Edge Detection.

After Segmentation

By : Al-baihan, Abdullah

2. Three classes: Background and two different object classes.

3.
4.
Before Segmentation

After Segmentation

3. Four classes : Background and three different classes.

Before Segmentation

After Segmentation

In my project I will use the threshold techniques to estimate thresholds in


image for four classes Images.

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

conclusion
In this chapter I explained the Segmentation

concept and the

available approaches for Segmentation of image , Segmentation is a very


important problem in digital image processing. It use to classification the
objects from the background and other objects. when the objects are
classification the Segmentation is stop.
briefly Edge-based methods, Region-based techniques , Connectivitypreserving relaxation methods and Threshold techniques. The Threshold
techniques has many methods like; Edge information. In general, the type
of image is different according to number of objects in the image. Two
classes: Background and one object. Three classes: Background and two
different object classes. Four classes: Background and three different
classes.

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

10

Chapter#2 Segmentation Algorithm for two Classes Images:


In this Chapter, I will discuss the proposed algorithm for two classes
image segmentation. By two classes I mean images that have only
background and single class of objects. The diagram shown below depicts in
details the algorithm and how the threshold is selected.

In This chapter I will show the result of applying he proposed


segmentation algorithm using edge information. I will present the square
shape result without noise and with 3.0, 5.0, 7.0 noise. And the histogram for
each result. And I will present the Circle shape result without noise and with
3.0, 5.0, 7.0 noise. And the histogram for each result. I will present the real
image "flower" result without noise and with 3.0, 5.0, 7.0 noise. And the
histogram for each result.

Initially, the algorithm takes the input image (I) to be segmented and
edge detected image (K) and scan the edge detected image (K) to find edges.
After that it applies the segmentation process on the input image as shown
below to get the threshold value. Then I do simple thresholding on the input
image.

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

11

S5

S7
S8

S6

s1
s2

s3

s4

Input Image (I)


For each white pixel in image (K) {

(I)

Edge Detection

Edge Detected
image
(K)

Take 4 windows of size n, horizontal &


vertical & Diagonal. For each window,
compute their sums (s1 & s2).
D0 = |s1 s2|
D90 = |s3 s4|
D45 = |s5 s6|
D135 = |s7 s8|
If(Max (D0, D90, D45, D135) = D0
V[c++] = (s1+s2)/ (n*n*2) Else
Else
If(Max (D0, D90, D45, D135) = D90
V[c++]= (s3+s4)/(n*n*2)
If(Max (D0, D90, D45, D135) = D45
V[c++]= (s5+s6)/(n*n*2)
Else
V[c++]= (s7+s8)/(n*n*2)
H=Histogram(V, c);
After scanning, Select Max in h to be the
threshold }

Segmented image

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

12

The first result: Square shape.


Ideal

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

13

Noise7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

14

The second result: Circle shape.


Noise 7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

15

The third result: real image Flower.


Noise 7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

16

Conclusion:
I found the result of circle with 7.0 noise is better than result of
square with 7.0 noise and result of flower with 7.0 noise. Also I found
result of square with 7.0 noise is better than result of flower with 7.0 noise.

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

17

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

18

Chapter#3 Segmentation Algorithm for three Classes Images:


In this chapter , I will discuss the proposed algorithm for three classes
image segmentation. By three classes I mean images that have background
and two class of objects. The diagram shown below depicts in details the
algorithm and how the threshold is selected.

In This chapter I will show the result of applying he proposed


segmentation algorithm using edge information. I will present the square and
Circle shape result without noise and with 3.0, 5.0, 7.0 noise. And the
histogram for each result. I will present the real image "flower" result
without noise and with 3.0, 5.0, 7.0 noise. And the histogram for each result.

Initially, the algorithm takes the input image (I) to be segmented and
edge detected image (K) and scan the edge detected image (K) to find edges.
After that it applies the segmentation process on the input image as shown
below to get the histogram. Then it apply ISO-DATA on the histogram to
compute the T1 and T2. Then I do thresholding on the input image based on
the computed T1 & T2.

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

19

S5

S7
S8

s1

S6
s2

s3

s4

Input Image (I)

For each white pixel in image (K) {

(I)

Edge Detection

Take 4 windows of size n, horizontal


& vertical & Diagonal. For each
window, compute their sums (s1 &
s2).
D0 = |s1 s2|
D90 = |s3 s4|
D45 = |s5 s6|
D135 = |s7 s8|
If(Max (D0, D90, D45, D135) = D0
V[c++] = (s1+s2)/ (n*n*2)
Else
If(Max (D0, D90, D45, D135) = D90
V[c++]= (s3+s4)/(n*n*2)
If(Max (D0, D90, D45, D135) = D45
V[c++]= (s5+s6)/(n*n*2)
Else
V[c++]= (s7+s8)/(n*n*2)
H=Histogram(V, c);
T1,T2=ISO-Data(H);
Threshold based on T1 & T2 }

Edge Detected
image
(K)

Segmented image

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

20

The first result: Square & Circle shape.


Noise 7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

21

The second result: real image Flower.


Noise 7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

22

Conclusion
I note the result of image is enhancement after using segmentation
with three classes

in comparison with two classes, this appear in flower

image.

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

23

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

24

Chapter#4 Segmentation Algorithm for four Classes Images


In this chapter , I will discuss the proposed algorithm for four classes
image segmentation. By four classes I mean images that have background
and three class of objects. The diagram shown below depicts in details the
algorithm and how the threshold is selected.
In This chapter I will show the result of applying he proposed
segmentation algorithm using edge information. I will present the two
squares and Circle in one shape, result without noise and with 3.0, 5.0, 7.0
noise. And the histogram for each result. I will present the real image
"Flower" result without noise and with 3.0, 5.0, 7.0 noise. And the histogram
for each result. I will present the real image "Photo" result without noise
and with 3.0, 5.0, 7.0 noise. And the histogram for each result. I will present
the real image "Hill" result without noise and with 3.0, 5.0, 7.0 noise. And
the histogram for each result. I will present the real image "Cell" result
without noise and with 3.0, 5.0, 7.0 noise. And the histogram for each result.
I will present the real image "Skin" result without noise and with 3.0, 5.0,
7.0 noise. And the histogram for each result. I will present the real image
"Beach" result without noise and with 3.0, 5.0, 7.0 noise. And the histogram
for each result.
Initially, the algorithm takes the input image (I) to be segmented and
edge detected image (K) and scan the edge detected image (K) to find edges.
After that it applies the segmentation process on the input image as shown
below to get the histogram. Then it apply ISO-DATA-3 on the histogram to
compute the T1 , T2 and T3. Then I do thresholding on the input image
based on the computed T1 & T2&T3.
Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

25

S5

S7
S8

s1

S6

s3

s2

s4

For each white pixel in image (K) {


Input Image (I)
(I)

Edge Detection
Take 4 windows of size n, horizontal &
vertical & Diagonal. For each window,
compute their sums (s1 & s2).
D0 = |s1 s2|
D90 = |s3 s4|
D45 = |s5 s6|
D135 = |s7 s8|
If(Max (D0, D90, D45, D135) = D0
V[c++] = (s1+s2)/ (n*n*2)
Else
If(Max (D0, D90, D45, D135) = D90
V[c++]= (s3+s4)/(n*n*2)
If(Max (D0, D90, D45, D135) = D45
V[c++]= (s5+s6)/(n*n*2)
Else
V[c++]= (s7+s8)/(n*n*2)
H=Histogram(V, c);
T1,T2,T3=ISO-Data-3(H);
Threshold based on T1 & T2 & T3 }

Edge Detected
image
(K)

Segmented image

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

26

ISO-Data-3 method:
1-Select T1, T2, T3
2-Compute M1, M2, M3, M4,
3-Compute T1new =

M1 M 2
2

, T2new =

M2 M3
,
2

T3new =

M3 M 4
2

4- If ( | T1 T1new | > 1 or | T2 T2new | > 1 or | T3 T3new | > 1)


T1 T1new
T2 T2new
T3 T3new
Else
Finish

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

27

The first result: Two Squares & One Circle in one shape.
Noise 7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

28

The second result: Real Image flower.


Noise 7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

29

The third result: Real Image Hill .


Noise 7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

30

The fourth result: Real Image Cell .


Noise 7.0

Original

Histogram

Output

The fifth result: Real Image Beach .


Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

31

Noise 7.0

Original

Histogram

Output

The sixth result: Real Image Skin .

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

32

Noise 7.0

Original

Histogram

Output

The seventh result: Real Image Photo .


Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

33

Noise 7.0

Original

Histogram

Output

Segmentation of Images
Using Edge Detection.

By : Al-baihan, Abdullah

34