-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetGt.m
More file actions
44 lines (34 loc) · 962 Bytes
/
getGt.m
File metadata and controls
44 lines (34 loc) · 962 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 [superGT, name] = getGt(path,ext,pattern, labels, imgsize)
fullpath = fullfile(path,ext);
list = dir(fullpath);
name = {list.name};
str = sprintf('%s#', name{:});
num = sscanf(str, pattern);
[dummy, index] = sort(num);
name = name(index)';
rlabels = labels(:);
numlab = max(rlabels);
n = imgsize(1);
m= imgsize(2);
for k = 1:size(name,1)
X = (sprintf('************GT to frame: %d',k));
disp(X);
filename = char(name(k));
filepath = fullfile(path,filename);
frameG = imread(filepath);
%frame = imresize(frame, [120 160]);
frame = imresize(frameG, [n m]);
%GT
gtframe = logical(frame);
gtframe = im2double(gtframe);
gtframe = gtframe(:);
for t=0:numlab
f = find(rlabels==t);
GTSpLocal = gtframe(f(:,1)); %GT
GTSPL{t+1} = GTSpLocal'; %GT
end
superGT(:,k) = GTSPL; %GT
end
Z = (sprintf('Finalizing GT'));
disp(Z);
end