forked from mcv-m1-project-2017/team6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListFilesClear.m
39 lines (38 loc) · 1.39 KB
/
ListFilesClear.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
function files = ListFilesClear(directory)
%{
Juan Felipe Montesinos
Yi Xiao
Ferran Carrasquer Mas
Master in Computer Vision
Computer Vision Center, Barcelona
---------------------------
Project M1/Block1
---------------------------
Creates a list of files for a directory given. It assumes the format
applied in the data training set:
-Ground-truth text files: gt.name.txt
-Masks: mask.name.png
-Photos: name.jpg
%}
f = dir(directory);
files = [];
for i=1:size(f,1),
if f(i).isdir==0,
if strcmp(f(i).name(end-2:end),'ppm')==1 || strcmp(f(i).name(end-2:end),'jpg')==1 || strcmp(f(i).name(end-2:end),'png')==1|| strcmp(f(i).name(end-2:end),'txt')==1;
if strcmp(f(i).name(end-2:end),'jpg')==1
f(i).name=f(i).name(1:length(f(i).name)-4);
%f(i).name=extractBefore(f(i).name,'.jpg');
%avilable for matlab 2016b or above
elseif strcmp(f(i).name(end-2:end),'png')==1
f(i).name=f(i).name(6:length(f(i).name)-4);
%f(i).name=extractBetween(f(i).name,'mask.','.png');
%avilable for matlab 2016b or above
elseif strcmp(f(i).name(end-2:end),'txt')==1
f(i).name=f(i).name(4:length(f(i).name)-4);
%f(i).name=extractBetween(f(i).name,'gt.','.txt');
%avilable for matlab 2016b or above
end
files = [files ; f(i)];
end
end
end