-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprocessing.m
62 lines (62 loc) · 1.58 KB
/
processing.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
function [new] = processing(dp, img)
sz = size(img);
sz(2) = sz(2) - 1;
new = zeros(sz,'uint8');
sz = size(img);
arr = dp(sz(1),:);
[~, index] = min(arr);
%disp(index);
count = 1;
for j = 1:sz(2)
if j==index
% PASS
else
new(sz(1),count,1) = img(sz(1),j,1);
new(sz(1),count,2) = img(sz(1),j,2);
new(sz(1),count,3) = img(sz(1),j,3);
count = count + 1;
end
end
for i = (sz(1)-1):-1:1
if index == sz(2)
if dp(i,index) < dp(i,index-1)
% PASS
else
index = index - 1;
end
elseif index==1
if dp(i,index) < dp(i,index+1)
% PASS
else
index = index + 1;
end
else
if dp(i,index-1) < dp(i,index)
if dp(i,index-1) < dp(i,index+1)
index = index - 1;
else
index = index + 1;
end
else
if dp(i,index) < dp(i,index+1)
% PASS
else
index = index + 1;
end
end
end
%disp(index);
count = 1;
%imshow(new);
for j = 1:sz(2)
if j==index
% PASS
else
new(i,count,1) = img(i,j,1);
new(i,count,2) = img(i,j,2);
new(i,count,3) = img(i,j,3);
count = count + 1;
end
end
end
end