-
Notifications
You must be signed in to change notification settings - Fork 1
/
corr.m
123 lines (102 loc) · 3.11 KB
/
corr.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
% Finding correlation analysis of an image
% ----------------------------------------------
function corr(a,b)
% Decompose in to R,G,B
%---------------------------------------
R=a(:,:,1);
G=a(:,:,2);
B=a(:,:,3);
%---------------------------------------
% Finding the correlation of adjacent pixels-------------Red
%----------------------------------------
A=double(R);
% Horizontal
x1 = A(:,1:end-1);
y1 = A(:,2:end);
fprintf(sprintf('%s Red:',b));
horizontal_values=cor_value(x1,y1)
pause(4);
% Vertical
x2 = A(1:end-1,:);
y2 = A(2:end,:);
fprintf(sprintf('%s Red:',b));
vertical_vlaues=cor_value(x2,y2)
pause(4);
% Diagonal,
x3 = A(1:end-1,1:end-1);
y3 = A(2:end,2:end);
fprintf(sprintf('%s Red:',b));
Diagonal_values=cor_value(x3,y3)
%----------------------------------------
pause(4);
%----------------------------------------
% Correlation Figures
figure;
plot(1,1),cor_figure(x1,y1,1),title(sprintf('%s Horizontal Red',b));
plot(1,1),cor_figure(x2,y2,1),title(sprintf('%s Vertical Red',b));
plot(1,1),cor_figure(x3,y3,1),title(sprintf('%s Diagonal Red',b));
%----------------------------------------
pause(4);
%---------------------------------------
% Finding the correlation of adjacent pixels-------------Green
%----------------------------------------
A=double(G);
% Horizontal
x1 = A(:,1:end-1);
y1 = A(:,2:end);
fprintf(sprintf('%s Green:',b));
horizontal_values=cor_value(x1,y1)
pause(4);
% Vertical
x2 = A(1:end-1,:);
y2 = A(2:end,:);
fprintf(sprintf('%s Green:',b));
vertical_vlaues=cor_value(x2,y2)
pause(4);
% Diagonal,
x3 = A(1:end-1,1:end-1);
y3 = A(2:end,2:end);
fprintf(sprintf('%s Green:',b));
Diagonal_values=cor_value(x3,y3)
%----------------------------------------
pause(4);
%----------------------------------------
% Correlation Figures
figure;
plot(1,1),cor_figure(x1,y1,2),title(sprintf('%s Horizontal Green',b));
plot(1,1),cor_figure(x2,y2,2),title(sprintf('%s Vertical Green',b));
plot(1,1),cor_figure(x3,y3,2),title(sprintf('%s Diagonal Green',b));
%----------------------------------------
pause(4);
%---------------------------------------
% Finding the correlation of adjacent pixels-------------Blue
%----------------------------------------
A=double(B);
% Horizontal
x1 = A(:,1:end-1);
y1 = A(:,2:end);
fprintf(sprintf('%s Blue:',b));
horizontal_values=cor_value(x1,y1)
pause(4);
% Vertical
x2 = A(1:end-1,:);
y2 = A(2:end,:);
fprintf(sprintf('%s Blue:',b));
vertical_vlaues=cor_value(x2,y2)
pause(3);
% Diagonal,
x3 = A(1:end-1,1:end-1);
y3 = A(2:end,2:end);
fprintf(sprintf('%s Blue:',b));
Diagonal_values=cor_value(x3,y3)
%----------------------------------------
pause(3);
%----------------------------------------
% Correlation Figures
figure;
plot(1,1),cor_figure(x1,y1,3),title(sprintf('%s Horizontal Blue',b));
plot(1,1),cor_figure(x2,y2,3),title(sprintf('%s Vertical Blue',b));
plot(1,1),cor_figure(x3,y3,3),title(sprintf('%s Diagonal Blue',b));
%----------------------------------------
end
%----------------------------------------