SlideShare a Scribd company logo
1 of 8
Download to read offline
20BEC001 AADITYA DARAKH EXP6 IMAGE PROCESSING 2ECDE51
Objective: To realize edge detection algorithms in MATLAB.
clc;
close all;
clear all
z=imread("AADI_IMAGE.jpeg");
z=rgb2gray(z);
1. Generate a 3x3 mask for detecting vertical edges, horizontal edges, principal diagonal edges and
secondary diagonal edges and write a MATLAB code to detect these edges. Plot the results and
comment on them.
h1=[1,1,1;2,2,2;-1,-1,-1];
h45=[-1,-1,2;-1,2,-1;2,-1,-1];
v1=[-1,2,-1;-1,2,-1;-1,2,-1];
v45=[2,-1,-1;-1,2,-1;-1,-1,2];
figure(1),
subplot(151);g1=imfilter(z,h1);imshow(g1);xlabel('horizontal');
subplot(152);g2=imfilter(z,h45);imshow(g2);xlabel('h+45');
subplot(153);t1=imfilter(z,v1);imshow(t1);xlabel('vertical');
subplot(154);t2=imfilter(z,v45);imshow(t2);xlabel('v+45');
1
2. Apply the following edge detectors on an image and observe their effect on the resultant image. Note
your observations.  Sobel  Prewitt  Roberts  log  Canny
a=imread("AADI_IMAGE.jpeg");
z=rgb2gray(a);
prewitt=[-1,-1,-1;0,0,0;1,1,1];prewittv=[-1,0,1;-1,0,1;-1,0,1];
sobel=[-1,-1,2;-1,2,-1;2,-1,-1];sobelv=[-1,0,-1;-2,0,0;1,1,1];
sobeld1=[0,1,2;-1,2,-1;-1,2,-1];sobeld2=[-2,-1,0;-1,0,1;0,1,2];
prewittd1=[0,1,1;-1,0,1;-1,-1,0];prewittd2=[-1,-1,0;-1,0,-1;0,1,1];
LOG=[0,0,-1,0,1;0,-1,-2,-1,0;-1,-2,16,-2,-1;0,-1,-2,-1,0;0,0,-1,0,0];
figure(2),
subplot(241);g1=imfilter(z,prewitt);imshow(g1);title('prewitt');
subplot(242);g2=imfilter(z,prewittv);imshow(g2);title('prewitt+v');
subplot(243);g3=imfilter(z,sobel);imshow(g3);title('sobel');
subplot(244);g4=imfilter(z,sobelv);imshow(g4);title('sobelv');
subplot(245);g5=imfilter(z,sobeld1);imshow(g5);title('sobeld1');
subplot(246);g6=imfilter(z,sobeld2);imshow(g6);title('sobeld2');
subplot(247);g7=imfilter(z,prewittd1);imshow(g7);title('prewittd1');
subplot(248);g8=imfilter(z,prewittd2);imshow(g8);title('prewittd2');
3. Analyze the effect of thresholding for edge detection.
figure(),
l1=imfilter(z,LOG);imshow(l1);xlabel('LoG')
2
figure(),
d=graythresh(z);
u=(0:0.1:1);
for i=1:10
subplot(2,5,i);l2=edge(z,"canny",u(i),0.6);imshow(l2);xlabel(u(i));title('canny')
end
figure(),
for i=1:10
subplot(2,5,i);l2=edge(z,"log",u(i),0.6);imshow(l2);xlabel(u(i));title('LoG')
end
3
figure(),
for i=1:10
subplot(2,5,i);l2=edge(z,"sobel",u(i));imshow(l2);xlabel(u(i));title('Sobel')
end
4
figure(),
for i=1:10
subplot(2,5,i);l2=edge(z,"roberts",u(i));imshow(l2);xlabel(u(i));title('Roberts')
end
5
figure(),
for i=1:10
subplot(2,5,i);l2=edge(z,"prewitt",u(i));imshow(l2);xlabel(u(i));title('Prewitt')
end
6
4. For the filters listed in example 2, write a MATLAB code to perform edge detection without using the
inbuilt MATLAB function. You may follow the following steps:
figure(),
subplot(141);k1=edge(z,"sobel");imshow(k1);title('sobel')
subplot(142);k2=edge(z,"prewitt");imshow(k2);title('prewitt')
subplot(143);k3=edge(z,"roberts");imshow(k3);title('roberts')
subplot(144);k4=edge(z,"canny");imshow(k4);title('canny')
7
8

More Related Content

Similar to ip6_final.pdf

Graphic Design Lab File.docx
Graphic Design Lab File.docxGraphic Design Lab File.docx
Graphic Design Lab File.docxPayalJindal19
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignmentAbdullah Al Shiam
 
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docxLiterary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docxjeremylockett77
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualUma mohan
 
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)Austin Benson
 
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedis Labs
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graphkinan keshkeh
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia岳華 杜
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming languageLincoln Hannah
 
implement the following funtions. myg1 and myg2 are seperate. x and .pdf
implement the following funtions. myg1 and myg2 are seperate. x and .pdfimplement the following funtions. myg1 and myg2 are seperate. x and .pdf
implement the following funtions. myg1 and myg2 are seperate. x and .pdfforladies
 
4.5 sec and csc worked 3rd
4.5   sec and csc worked 3rd4.5   sec and csc worked 3rd
4.5 sec and csc worked 3rdJonna Ramsey
 
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...seijihagawa
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Alamgir Hossain
 
The graph above is just an example that shows the differences in dis.pdf
The graph above is just an example that shows the differences in dis.pdfThe graph above is just an example that shows the differences in dis.pdf
The graph above is just an example that shows the differences in dis.pdfjyothimuppasani1
 

Similar to ip6_final.pdf (20)

Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
Graphic Design Lab File.docx
Graphic Design Lab File.docxGraphic Design Lab File.docx
Graphic Design Lab File.docx
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
 
Test
TestTest
Test
 
Primitives
PrimitivesPrimitives
Primitives
 
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docxLiterary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
 
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
 
Graphics point clipping c program
Graphics point clipping c programGraphics point clipping c program
Graphics point clipping c program
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming language
 
implement the following funtions. myg1 and myg2 are seperate. x and .pdf
implement the following funtions. myg1 and myg2 are seperate. x and .pdfimplement the following funtions. myg1 and myg2 are seperate. x and .pdf
implement the following funtions. myg1 and myg2 are seperate. x and .pdf
 
4.5 sec and csc worked 3rd
4.5   sec and csc worked 3rd4.5   sec and csc worked 3rd
4.5 sec and csc worked 3rd
 
DSP_EXP.pptx
DSP_EXP.pptxDSP_EXP.pptx
DSP_EXP.pptx
 
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
 
The graph above is just an example that shows the differences in dis.pdf
The graph above is just an example that shows the differences in dis.pdfThe graph above is just an example that shows the differences in dis.pdf
The graph above is just an example that shows the differences in dis.pdf
 

Recently uploaded

一比一原版西悉尼大学毕业证(UWS毕业证)成绩单如可办理
一比一原版西悉尼大学毕业证(UWS毕业证)成绩单如可办理一比一原版西悉尼大学毕业证(UWS毕业证)成绩单如可办理
一比一原版西悉尼大学毕业证(UWS毕业证)成绩单如可办理awuboo
 
一比一原版(Drexel毕业证书)美国芝加哥城市学院毕业证如何办理
一比一原版(Drexel毕业证书)美国芝加哥城市学院毕业证如何办理一比一原版(Drexel毕业证书)美国芝加哥城市学院毕业证如何办理
一比一原版(Drexel毕业证书)美国芝加哥城市学院毕业证如何办理Fir
 
Norco College - M4MH Athlete Pilot - 4.30.24 - Presentation.pdf
Norco College - M4MH Athlete Pilot - 4.30.24 - Presentation.pdfNorco College - M4MH Athlete Pilot - 4.30.24 - Presentation.pdf
Norco College - M4MH Athlete Pilot - 4.30.24 - Presentation.pdfRebeccaPontieri
 
Gloria Marquez Resume 2024pdf.pdf pdfpdf
Gloria Marquez Resume 2024pdf.pdf pdfpdfGloria Marquez Resume 2024pdf.pdf pdfpdf
Gloria Marquez Resume 2024pdf.pdf pdfpdfgmarquez046
 
obat aborsi Lumajang wa 082135199655 jual obat aborsi cytotec asli di Lumajang
obat aborsi Lumajang wa 082135199655 jual obat aborsi cytotec asli di Lumajangobat aborsi Lumajang wa 082135199655 jual obat aborsi cytotec asli di Lumajang
obat aborsi Lumajang wa 082135199655 jual obat aborsi cytotec asli di Lumajangsiskavia95
 
Russian ℂall Girls Vijay Nagar Hire Me Neha 96XXXXXXX Top Class ℂall Girl Ser...
Russian ℂall Girls Vijay Nagar Hire Me Neha 96XXXXXXX Top Class ℂall Girl Ser...Russian ℂall Girls Vijay Nagar Hire Me Neha 96XXXXXXX Top Class ℂall Girl Ser...
Russian ℂall Girls Vijay Nagar Hire Me Neha 96XXXXXXX Top Class ℂall Girl Ser...Mumbai Escorts
 
Our great adventures in Warsaw - On arrival training
Our great adventures in Warsaw - On arrival trainingOur great adventures in Warsaw - On arrival training
Our great adventures in Warsaw - On arrival trainingAngelaHakobjanyan
 
Captain america painting competition -- 13
Captain america painting competition -- 13Captain america painting competition -- 13
Captain america painting competition -- 13Su Yan-Jen
 
obat aborsi pemalang wa 081336238223 jual obat aborsi cytotec asli di pemalan...
obat aborsi pemalang wa 081336238223 jual obat aborsi cytotec asli di pemalan...obat aborsi pemalang wa 081336238223 jual obat aborsi cytotec asli di pemalan...
obat aborsi pemalang wa 081336238223 jual obat aborsi cytotec asli di pemalan...yulianti213969
 
Sun day thang 4 sun life team trung dai
Sun day thang 4 sun life team trung daiSun day thang 4 sun life team trung dai
Sun day thang 4 sun life team trung daiGiangTra20
 
Sui Generis Magazine volume one Kristen Murillo.pdf
Sui Generis Magazine volume one Kristen Murillo.pdfSui Generis Magazine volume one Kristen Murillo.pdf
Sui Generis Magazine volume one Kristen Murillo.pdfkristenmurillo218
 
Hosewife Bangalore Just VIP Btm Layout 100% Genuine at your Door Step
Hosewife Bangalore Just VIP Btm Layout 100% Genuine at your Door StepHosewife Bangalore Just VIP Btm Layout 100% Genuine at your Door Step
Hosewife Bangalore Just VIP Btm Layout 100% Genuine at your Door Stepdarmandersingh4580
 
obat aborsi rembang wa 081336238223 jual obat aborsi cytotec asli di rembang9...
obat aborsi rembang wa 081336238223 jual obat aborsi cytotec asli di rembang9...obat aborsi rembang wa 081336238223 jual obat aborsi cytotec asli di rembang9...
obat aborsi rembang wa 081336238223 jual obat aborsi cytotec asli di rembang9...yulianti213969
 
obat aborsi Cibitung wa 082223595321 jual obat aborsi cytotec asli di Cibitung
obat aborsi Cibitung wa 082223595321 jual obat aborsi cytotec asli di Cibitungobat aborsi Cibitung wa 082223595321 jual obat aborsi cytotec asli di Cibitung
obat aborsi Cibitung wa 082223595321 jual obat aborsi cytotec asli di Cibitungsiskavia916
 
DeFeliceKitley_Resume_BFAVCDGraduated2024
DeFeliceKitley_Resume_BFAVCDGraduated2024DeFeliceKitley_Resume_BFAVCDGraduated2024
DeFeliceKitley_Resume_BFAVCDGraduated2024KitleyDeFelice
 
K_ E_ S_ Retail Store Scavenger Hunt.pptx
K_ E_ S_ Retail Store Scavenger Hunt.pptxK_ E_ S_ Retail Store Scavenger Hunt.pptx
K_ E_ S_ Retail Store Scavenger Hunt.pptxKenSmith311760
 
My scariest moment presentation-part one
My scariest moment presentation-part oneMy scariest moment presentation-part one
My scariest moment presentation-part oneatetteh2001
 
一比一定制英国赫特福德大学毕业证学位证书
一比一定制英国赫特福德大学毕业证学位证书一比一定制英国赫特福德大学毕业证学位证书
一比一定制英国赫特福德大学毕业证学位证书AS
 
obat aborsi wonogiri wa 081336238223 jual obat aborsi cytotec asli di wonogir...
obat aborsi wonogiri wa 081336238223 jual obat aborsi cytotec asli di wonogir...obat aborsi wonogiri wa 081336238223 jual obat aborsi cytotec asli di wonogir...
obat aborsi wonogiri wa 081336238223 jual obat aborsi cytotec asli di wonogir...yulianti213969
 

Recently uploaded (20)

一比一原版西悉尼大学毕业证(UWS毕业证)成绩单如可办理
一比一原版西悉尼大学毕业证(UWS毕业证)成绩单如可办理一比一原版西悉尼大学毕业证(UWS毕业证)成绩单如可办理
一比一原版西悉尼大学毕业证(UWS毕业证)成绩单如可办理
 
一比一原版(Drexel毕业证书)美国芝加哥城市学院毕业证如何办理
一比一原版(Drexel毕业证书)美国芝加哥城市学院毕业证如何办理一比一原版(Drexel毕业证书)美国芝加哥城市学院毕业证如何办理
一比一原版(Drexel毕业证书)美国芝加哥城市学院毕业证如何办理
 
Norco College - M4MH Athlete Pilot - 4.30.24 - Presentation.pdf
Norco College - M4MH Athlete Pilot - 4.30.24 - Presentation.pdfNorco College - M4MH Athlete Pilot - 4.30.24 - Presentation.pdf
Norco College - M4MH Athlete Pilot - 4.30.24 - Presentation.pdf
 
Gloria Marquez Resume 2024pdf.pdf pdfpdf
Gloria Marquez Resume 2024pdf.pdf pdfpdfGloria Marquez Resume 2024pdf.pdf pdfpdf
Gloria Marquez Resume 2024pdf.pdf pdfpdf
 
obat aborsi Lumajang wa 082135199655 jual obat aborsi cytotec asli di Lumajang
obat aborsi Lumajang wa 082135199655 jual obat aborsi cytotec asli di Lumajangobat aborsi Lumajang wa 082135199655 jual obat aborsi cytotec asli di Lumajang
obat aborsi Lumajang wa 082135199655 jual obat aborsi cytotec asli di Lumajang
 
Russian ℂall Girls Vijay Nagar Hire Me Neha 96XXXXXXX Top Class ℂall Girl Ser...
Russian ℂall Girls Vijay Nagar Hire Me Neha 96XXXXXXX Top Class ℂall Girl Ser...Russian ℂall Girls Vijay Nagar Hire Me Neha 96XXXXXXX Top Class ℂall Girl Ser...
Russian ℂall Girls Vijay Nagar Hire Me Neha 96XXXXXXX Top Class ℂall Girl Ser...
 
Searching for 100% original and safe abortion pills? Contact +971581248768 fo...
Searching for 100% original and safe abortion pills? Contact +971581248768 fo...Searching for 100% original and safe abortion pills? Contact +971581248768 fo...
Searching for 100% original and safe abortion pills? Contact +971581248768 fo...
 
Our great adventures in Warsaw - On arrival training
Our great adventures in Warsaw - On arrival trainingOur great adventures in Warsaw - On arrival training
Our great adventures in Warsaw - On arrival training
 
Captain america painting competition -- 13
Captain america painting competition -- 13Captain america painting competition -- 13
Captain america painting competition -- 13
 
obat aborsi pemalang wa 081336238223 jual obat aborsi cytotec asli di pemalan...
obat aborsi pemalang wa 081336238223 jual obat aborsi cytotec asli di pemalan...obat aborsi pemalang wa 081336238223 jual obat aborsi cytotec asli di pemalan...
obat aborsi pemalang wa 081336238223 jual obat aborsi cytotec asli di pemalan...
 
Sun day thang 4 sun life team trung dai
Sun day thang 4 sun life team trung daiSun day thang 4 sun life team trung dai
Sun day thang 4 sun life team trung dai
 
Sui Generis Magazine volume one Kristen Murillo.pdf
Sui Generis Magazine volume one Kristen Murillo.pdfSui Generis Magazine volume one Kristen Murillo.pdf
Sui Generis Magazine volume one Kristen Murillo.pdf
 
Hosewife Bangalore Just VIP Btm Layout 100% Genuine at your Door Step
Hosewife Bangalore Just VIP Btm Layout 100% Genuine at your Door StepHosewife Bangalore Just VIP Btm Layout 100% Genuine at your Door Step
Hosewife Bangalore Just VIP Btm Layout 100% Genuine at your Door Step
 
obat aborsi rembang wa 081336238223 jual obat aborsi cytotec asli di rembang9...
obat aborsi rembang wa 081336238223 jual obat aborsi cytotec asli di rembang9...obat aborsi rembang wa 081336238223 jual obat aborsi cytotec asli di rembang9...
obat aborsi rembang wa 081336238223 jual obat aborsi cytotec asli di rembang9...
 
obat aborsi Cibitung wa 082223595321 jual obat aborsi cytotec asli di Cibitung
obat aborsi Cibitung wa 082223595321 jual obat aborsi cytotec asli di Cibitungobat aborsi Cibitung wa 082223595321 jual obat aborsi cytotec asli di Cibitung
obat aborsi Cibitung wa 082223595321 jual obat aborsi cytotec asli di Cibitung
 
DeFeliceKitley_Resume_BFAVCDGraduated2024
DeFeliceKitley_Resume_BFAVCDGraduated2024DeFeliceKitley_Resume_BFAVCDGraduated2024
DeFeliceKitley_Resume_BFAVCDGraduated2024
 
K_ E_ S_ Retail Store Scavenger Hunt.pptx
K_ E_ S_ Retail Store Scavenger Hunt.pptxK_ E_ S_ Retail Store Scavenger Hunt.pptx
K_ E_ S_ Retail Store Scavenger Hunt.pptx
 
My scariest moment presentation-part one
My scariest moment presentation-part oneMy scariest moment presentation-part one
My scariest moment presentation-part one
 
一比一定制英国赫特福德大学毕业证学位证书
一比一定制英国赫特福德大学毕业证学位证书一比一定制英国赫特福德大学毕业证学位证书
一比一定制英国赫特福德大学毕业证学位证书
 
obat aborsi wonogiri wa 081336238223 jual obat aborsi cytotec asli di wonogir...
obat aborsi wonogiri wa 081336238223 jual obat aborsi cytotec asli di wonogir...obat aborsi wonogiri wa 081336238223 jual obat aborsi cytotec asli di wonogir...
obat aborsi wonogiri wa 081336238223 jual obat aborsi cytotec asli di wonogir...
 

ip6_final.pdf