Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Computer Graphics

Edge Detection

By
Dr. Hassan Althobaiti
Outline
• Edge Detection (Gradient Operators)
• Roberts (Roberts Cross)
• Exercise #6 – Page 246 (Robert’s edge detector)
• Implementation of Robert’s Operator in C#
Edge Detection
Derivative (Backward Difference)
Image strip 6 6 6 6 5 4 3 2 1 1 1 1 1 1 6 6 6 6 6

1st derivative 0 0 0 -1 -1 -1 -1 -1 0 0 0 0 0 5 0 0 0 0

𝐵𝑎𝑐𝑘𝑤𝑎𝑟𝑑 𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑥 = −1 1

−1
𝐵𝑎𝑐𝑘𝑤𝑎𝑟𝑑 𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑦 =
1
Derivative (Backward Difference)
Image strip 6 6 6 6 5 4 3 2 1 1 1 1 1 1 6 6 6 6 6

1st derivative 0 0 0 -1 -1 -1 -1 -1 0 0 0 0 0 5 0 0 0 0
Textbook: Robert’s Edge Detector
Exercise #6 (Page 134):

Find the results of applying the Robert’s edge detector to the


following image. Use the absolute value form of the operator.
For the result, don’t worry about top row and left column.

5 7 4 3

4 0 0 0

6 1 2 1
Exercise #6 (Page 134):

Find the results of applying the Robert’s edge detector to the


following image. Use the absolute value form of the operator.
For the result, don’t worry about top row and left column.

5 7 4 3 X X X X

4 0 0 0 X 8

6 1 2 1 X

0−5 + 4−7 =𝟖
Exercise #6 (Page 134):

Find the results of applying the Robert’s edge detector to the


following image. Use the absolute value form of the operator.
For the result, don’t worry about top row and left column.

5 7 4 3 X X X X

4 0 0 0 X 8 11

6 1 2 1 X

0−5 + 4−7 =𝟖
0 − 7 + 0 − 4 = 𝟏𝟏
Exercise #6 (Page 134):

Find the results of applying the Robert’s edge detector to the


following image. Use the absolute value form of the operator.
For the result, don’t worry about top row and left column.

5 7 4 3 X X X X

4 0 0 0 X 8 11 7

6 1 2 1 X

0−5 + 4−7 =𝟖
0 − 7 + 0 − 4 = 𝟏𝟏
0−4 + 0−3 =𝟕
Exercise #6 (Page 134):

Find the results of applying the Robert’s edge detector to the


following image. Use the absolute value form of the operator.
For the result, don’t worry about top row and left column.

5 7 4 3 X X X X

4 0 0 0 X 8 11 7

6 1 2 1 X 9

0−5 + 4−7 =𝟖 1−4 + 6−0 =𝟗


0 − 7 + 0 − 4 = 𝟏𝟏
0−4 + 0−3 =𝟕
Exercise #6 (Page 134):

Find the results of applying the Robert’s edge detector to the


following image. Use the absolute value form of the operator.
For the result, don’t worry about top row and left column.

5 7 4 3 X X X X

4 0 0 0 X 8 11 7

6 1 2 1 X 9 3

0−5 + 4−7 =𝟖 1−4 + 6−0 =𝟗


0 − 7 + 0 − 4 = 𝟏𝟏 2−0 + 1−0 = 𝟑
0−4 + 0−3 =𝟕
Exercise #6 (Page 134):

Find the results of applying the Robert’s edge detector to the


following image. Use the absolute value form of the operator.
For the result, don’t worry about top row and left column.

5 7 4 3 X X X X

4 0 0 0 X 8 11 7

6 1 2 1 X 9 3 3

0−5 + 4−7 =𝟖 1−4 + 6−0 =𝟗


0 − 7 + 0 − 4 = 𝟏𝟏 2−0 + 1−0 = 𝟑
0−4 + 0−3 =𝟕 1−0 + 2−0 =𝟑
Another Example: Robert’s Edge Detector
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0
1 1 1 1 X

0 0 0 0 X

1−1 + 1−1 =𝟎
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0 0
1 1 1 1 X

0 0 0 0 X

1−1 + 1−1 =𝟎
1−1 + 1−1 =𝟎
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0 0 0
1 1 1 1 X

0 0 0 0 X

1−1 + 1−1 =𝟎
1−1 + 1−1 =𝟎
1−1 + 1−1 =𝟎
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0 0 0
1 1 1 1 X 0

0 0 0 0 X

1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎


1−1 + 1−1 =𝟎
1−1 + 1−1 =𝟎
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0 0 0
1 1 1 1 X 0 0

0 0 0 0 X

1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎


1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎
1−1 + 1−1 =𝟎
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0 0 0
1 1 1 1 X 0 0 0

0 0 0 0 X

1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎


1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎
1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0 0 0
1 1 1 1 X 0 0 0

0 0 0 0 X 2

1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎 0−1 + 0−1 =𝟐


1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎
1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0 0 0
1 1 1 1 X 0 0 0

0 0 0 0 X 2 2

1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎 0−1 + 0−1 =𝟐


1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎 0−1 + 0−1 =𝟐
1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎
Exercise: Robert’s Edge Detector

1 1 1 1 X X X X

1 1 1 1 X 0 0 0
1 1 1 1 X 0 0 0

0 0 0 0 X 2 2 2

1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎 0−1 + 0−1 =𝟐


1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎 0−1 + 0−1 =𝟐
1−1 + 1−1 =𝟎 1−1 + 1−1 =𝟎 0−1 + 0−1 =𝟐
Let’s code Robert’s operator in
C#

You might also like