-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw_bound_node.m
More file actions
44 lines (41 loc) · 854 Bytes
/
draw_bound_node.m
File metadata and controls
44 lines (41 loc) · 854 Bytes
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
function draw_bound_node(I,YS,YE,XS,XE) % I is actual image grayscale
I = rgb2gray(I);
k = size(I)
R = zeros(k(1),k(2),3);
R(:,:,1) = I;
R(:,:,2) = I;
R(:,:,3) = I;
L = length(XS);
for l = 1:L
if YS(l) == 0
YS(l) = 1;
end
if YE(l) == 0
YE(l) = 1;
end
if XS(l) == 0
XS(l) = 1;
end
if XE(l) == 0
XE(l) = 1;
end
end
for i = 1:l
for m = XS(i):XE(i)
R(m,YS(i),1) = 255;
R(m,YE(i),1) = 255;
R(m,YS(i),2) = 0;
R(m,YE(i),2) = 0;
R(m,YS(i),2) = 0;
R(m,YE(i),2) = 0;
end
for n = YS(i):YE(i)
R(XS(i),n,1) = 255;
R(XE(i),n,1) = 255;
R(XS(i),n,2) = 0;
R(XE(i),n,2) = 0;
R(XS(i),n,3) = 0;
R(XE(i),n,3) = 0;
end
end
figure,imshow(R);