The BOTTOM LINE Quote Of The Day

The BOTTOM LINE Quote Of The Day

Don't Ever Tell GOD How BIG Your Problems are.
Just Tell Your Problems How BIG your GOD is ;)

Sunday, May 12, 2013

Implementing Edge Detection Techniques to an Original Image



Lenna = imread('Lenna2.jpg');

figure;   SobLenna = edge(Lenna, 'sobel', 0.055, 'horizontal');
subplot(1,3,1);  imshow(SobLenna); xlabel('Horizontal');
SobLenna = edge(Lenna, 'sobel', 0.055, 'vertical'); 
subplot(1,3,2);  imshow(SobLenna); xlabel('Vertical'); title('Sobel Edge Detection');
SobLenna = edge(Lenna, 'sobel', 0.055, 'both');
subplot(1,3,3);  imshow(SobLenna); xlabel('Both');

figure;   PreLenna = edge(Lenna, 'prewitt', 0.055, 'horizontal');
subplot(1,3,1);  imshow(PreLenna); xlabel('Horizontal');
PreLenna = edge(Lenna, 'prewitt', 0.055, 'vertical'); 
subplot(1,3,2);  imshow(PreLenna); xlabel('Vertical'); title('Prewitt Edge Detection');
PreLenna = edge(Lenna, 'prewitt', 0.055, 'both');
subplot(1,3,3);  imshow(PreLenna); xlabel('Both');

figure;   RobLenna = edge(Lenna, 'roberts');
subplot(1,3,1);  imshow(RobLenna); xlabel('With Default Threshold');
RobLenna = edge(Lenna, 'roberts', 0.055);
subplot(1,3,2);  imshow(RobLenna); xlabel('Threshold = 0.055'); title('Roberts Edge Detection');
RobLenna = edge(Lenna, 'roberts', 0.1);
subplot(1,3,3);  imshow(RobLenna); xlabel('Threshold = 0.1');

figure;   LogLenna = edge(Lenna, 'log');
subplot(1,3,1);  imshow(LogLenna); xlabel('With Default Threshold & Sigma');
LogLenna = edge(Lenna, 'log', 0.0055);
subplot(1,3,2);  imshow(LogLenna); xlabel('Threshold = 0.0055 & Default Sigma');
title('Laplacian of Gaussian Edge Detection');
LogLenna = edge(Lenna, 'log', 0.0055, 1.5);
subplot(1,3,3);  imshow(LogLenna); xlabel('Threshold = 0.0055 & Sigma = 1.5');

figure;   CanLenna = edge(Lenna, 'canny');
subplot(1,3,1);  imshow(CanLenna); xlabel('With Default Threshold & Sigma');
CanLenna = edge(Lenna, 'canny', 0.155);
subplot(1,3,2);  imshow(CanLenna); xlabel('Threshold = 0.155 & Default Sigma');
title('Canny Edge Detection');
CanLenna = edge(Lenna, 'canny', 0.155, 1.25);
subplot(1,3,3);  imshow(CanLenna); xlabel('Threshold = 0.155 & Sigma = 1.25');

No comments:

Post a Comment