You are on page 1of 4

Experiment 13 10-244

Title: To implement edge detection using Robert operator.

Estimated time to complete this experiment: 2 hours

Objective: In this experiment, student should be able to understand the formula to apply Robert operator
on an image so as to detect the edges in the image.

PEO to be achieved:

Expected Outcome of Experiment:


Detect edges using diagonal differences between neighboring pixels.

Books/ Journals/ Websites referred:


 http://www.mathworks.in/help/matlab/

Pre Lab/ Prior Concepts: Basic MATLAB knowledge of the standard mask of Robert operator in
the x and y direction.
______________________________________________________________________________________

Historical Profile:
1963 – The Roberts cross operator is used in image processing and computer vision for edge detection. It
was one of the first edge detectors and was initially proposed by Lawrence. As a differential operator, the
idea behind the Roberts cross operator is to approximate the gradient of an image through discrete
differentiation which is achieved by computing the sum of the squares of the differences between diagonally
adjacent pixels.

New Concepts to be learned: How to detect edges in an image.

Software & Hardware Required: MATLAB software and PC Hardware


Experiment 13 10-244

Flow Chart:

Start

Read the image in an object

Use the Robert operator mask to detect


the edges in the image

Plot the image

Stop

Stepwise Procedure:
1. Open Matlab software
2. Goto New  Script
3. Write the program code given below.
4. Save the code with an “.m” extension.
5. Run the code to get the output.

Program Code:

clc;
clear all;
A = imread('cameraman.tif');
a = double(A);
w1 = [1 0 ; 0 -1]
w2 = [0 1 ; -1 0]
[i j] = size(a);
for x = 2:i-1
for y = 2:j-1
a1(x,y) = [w1(1)*a(x,y)+w1(2)*a(x,y+1)+w1(3)*a(x+1,y)+w1(4)*a(x+1,y+1)];
a2(x,y) =[w2(1)*a(x,y)+w2(2)*a(x,y+1)+w2(3)*a(x+1,y)+w2(4)*a(x+1,y+1)];
end
end
a3 = a1 + a2;
Experiment 13 10-244
subplot(2,2,1)
imshow(A);
title('Original Image');

subplot(2,2,2);
imshow(uint8(a1));
title('X-Gradient');

subplot(2,2,3);
imshow(uint8(a2));
title('Y-Gradient');

subplot(2,2,4);
imshow(uint8(a3));
title('Modified Image');

Output:

Conclusion:
Therefore we obtain the x-gradient and y-gradient using Robert operator and are able to determine
the edges in an image as the sum of both the gradients.

Real Life Application: Used in image processing and computer vision for edge detection.
Experiment 13 10-244
_________________________________________________________________________
_______

Viva Questions:

1. What is the x-direction mask of Robert operator?


1 0
2. What is the y- 0 -1 direction mask of Robert operator?

0 -1
3. What is the 1 0 advantage of Robert operator?
 It uses diagonal differences to detect edges, which give more accurate results.

_________________________________________________________________________
_______

You might also like