-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOutputSeg.m
More file actions
24 lines (23 loc) · 925 Bytes
/
OutputSeg.m
File metadata and controls
24 lines (23 loc) · 925 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
files = dir('./DAVIS-2017-trainval-480p/DAVIS/SegPredictions/*.mat');
for file = files'
file_path = strcat(file.folder, '/', file.name);
index = strfind(file.name,'_');
class_name = file.name(1:index-1);
data = load(file_path);
for object = 1:size(data.choice,1)
channel = data.choice(object);
if isfield(data, 'pixel_level')
for frame = 2:length(data.pixel_level)
mask = data.pixel_level{frame}(:,:,channel);
foldername = strcat('./DAVIS-2017-trainval-480p/DAVIS/SegPredictions/', ...
class_name, '/', int2str(object));
if ~exist(foldername, 'dir')
mkdir(foldername)
end
filename = strcat(foldername, '/', sprintf('%05d', frame), '.png');
imwrite(mask, filename);
disp(filename);
end
end
end
end