-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEdgeDetections.m
95 lines (68 loc) · 1.29 KB
/
EdgeDetections.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
close all;
clc;
clear;
img=imread('kw.bmp');
load maskiPP.mat;
figure(1);
X=3;
Y=2;
subplot(Y,X,1);
imshow(img,[]);
title("Orginal");
img_cov=conv2(img,R1,'same');
subplot(Y,X,2);
imshow(abs(img_cov),[]);
title("Roberts 1 Abs");
subplot(Y,X,3);
imshow((int8(img_cov)+128),[]);
title("Roberts 1 Scale");
img_cov=conv2(img,R2,'same');
subplot(Y,X,4);
imshow(abs(img_cov),[]);
title("Roberts 2 Abs");
subplot(Y,X,5);
imshow(int8((img_cov)+128),[]);
title("Roberts 2 Scale");
%%
figure(2);
X=3;
Y=2;
subplot(Y,X,1);
imshow(img,[]);
title("Orginal");
img_cov=conv2(img,P1,'same');
subplot(Y,X,2);
imshow(abs(img_cov),[]);
title("Prewitt 1 Abs");
subplot(Y,X,3);
imshow((int8(img_cov)+128),[]);
title("Prewitt 1 Scale");
img_cov=conv2(img,P2,'same');
subplot(Y,X,4);
imshow(abs(img_cov),[]);
title("Prewitt 2 Abs");
subplot(Y,X,5);
imshow((int8(img_cov)+128),[]);
title("Prewitt 2 Scale");
%%
figure(3)
X=3;
Y=2;
subplot(Y,X,1);
imshow(img,[]);
title("Orginal");
img_cov=conv2(img,S1,'same');
subplot(Y,X,2);
imshow(abs(img_cov),[]);
title("Sobel 1 Abs");
subplot(Y,X,3);
imshow((int8(img_cov)+128),[]);
title("Sobel 1 Scale");
img_cov2=conv2(img,S2,'same');
subplot(Y,X,4);
imshow(abs(img_cov2),[]);
title("Sobel 2 Abs");
subplot(Y,X,5);
imshow((int8(img_cov2)+128),[]);
title("Sobel 2 Scale");
%%