MATLAB CODE - for Edge Detection of an Image by using different masks


clc;
close all;
clear all;

% Read Colour Image and convert it to a grey level Image
% Display the original Image

mycolourimage = imread('grayflower256.jpg');
myimage = rgb2gray(mycolourimage);
subplot(3,3,1);
imshow(myimage); title('Original Image');

% Apply Sobel Operator
% Display only the horizontal Edges

sobelhz = edge(myimage,'sobel','horizontal');
subplot(3,3,2);
imshow(sobelhz,[]); title('Sobel - Horizontal Edges');

% Apply Sobel Operator
% Display only the vertical Edges

sobelvrt = edge(myimage,'sobel','vertical');
subplot(3,3,3);
imshow(sobelhz,[]); title('Sobel - Vertical Edges');


% Apply Sobel Operator
% Display both horizontal and vertical Edges
sobelvrthz = edge(myimage,'sobel','both');
subplot(3,3,4);
imshow(sobelvrthz,[]); title('Sobel - All edges');


% Apply Roberts Operator
% Display both horizontal and vertical Edges

robertsedg = edge(myimage,'roberts');
subplot(3,3,5);
imshow(robertsedg,[]); title('Roberts - Edges');

% Apply Prewitt Operator
% Display both horizontal and vertical Edges

robertsedg = edge(myimage,'prewitt');
subplot(3,3,6);
imshow(robertsedg,[]); title('Prewitt - Edges');

% Apply Laplacian Filter  

f=fspecial('laplacian');
lapedg = imfilter(myimage,f,'symmetric');
subplot(3,3,7);
imshow(lapedg,[]); title('Laplacian Filter');

% Apply LOG edge detection
% The sigma used is 3

f=fspecial('log',[15,15],3.0);
logedg1 = edge(myimage,'zerocross',[],f);
subplot(3,3,8);
imshow(logedg1); title('Log with sigma 3');

% Apply Canny edge detection  
cannyedg = edge(myimage,'canny');
subplot(3,3,9);
imshow(cannyedg,[]); title('Canny Edge');




MATLAB CODE - for Edge Detection of an Image by using different masks MATLAB CODE - for Edge Detection of an Image by using different masks Reviewed by Suresh Bojja on 10/21/2015 09:54:00 PM Rating: 5

Subjects & Labs

AC (6) ADS (2) ATMEL (6) AWP (5) C- Language (3) CAO (5) CDAC (1) Cloud Computing (1) CMC (6) CN (10) CONSERVATION & MANAGEMENT Complete Notes (1) Control Sys (2) CVSM (2) Data Analytics (1) DC (5) Digital System Design (3) DIP (17) DLD (10) DLD Lab Manual (1) DS (4) DSD&DICA (9) DSP (6) EDC (45) Electonic Components (2) Embedded (7) EMWTL (6) ENERGY AUDIT (1) Engg. Mechanics (2) Engg.Chemistry (11) Faculty Files (6) Faculty Labs (1) Fuzzy (3) II MID (1) Job Exam Papers (4) LICA (1) Linux OS (1) Materials (1) MATLAB (27) MCU IDE 8051 (1) MEMS (4) MPMC (57) MPMC LAB Manual (3) MTECH (6) MWE (2) OC (1) PDC (9) Projects (8) RADAR (1) Research (9) RVSP (3) SC (1) Softwares (1) SS (1) STLD (18) TCSS (1) TSSN (1) TV Engg (1) VHDL (4) VLSI (8) VLSI Lab manual (1) WCN (1) Wireless Commu. (1) WSN (2)

Contact Form :

Name

Email *

Message *

Theme images by enjoynz. Powered by Blogger.