Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
91c63155
Commit
91c63155
authored
Jun 19, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further simplified initial image selection.
parent
991cb97a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
20 deletions
+21
-20
main.cpp
tools/imglab/src/main.cpp
+21
-20
No files found.
tools/imglab/src/main.cpp
View file @
91c63155
...
...
@@ -409,15 +409,13 @@ int main(int argc, char** argv)
parser
.
add_option
(
"h"
,
"Displays this information."
);
parser
.
add_option
(
"c"
,
"Create an XML file named <arg> listing a set of images."
,
1
);
parser
.
add_option
(
"d"
,
"Include all images files in directory <arg> in the new image file list."
,
1
);
parser
.
add_option
(
"r"
,
"Search directories recursively for images."
);
parser
.
parse
(
argc
,
argv
);
const
char
*
singles
[]
=
{
"h"
,
"c"
,
"r"
};
parser
.
check_one_time_options
(
singles
);
parser
.
check_sub_option
(
"c"
,
"d"
);
parser
.
check_sub_option
(
"d"
,
"r"
);
parser
.
check_sub_option
(
"c"
,
"r"
);
if
(
parser
.
option
(
"h"
))
{
...
...
@@ -437,30 +435,33 @@ int main(int argc, char** argv)
make_empty_file
(
filename
);
const
std
::
string
parent_dir
=
get_parent_directory
(
file
(
filename
)).
full_name
();
unsigned
long
depth
=
0
;
if
(
parser
.
option
(
"r"
))
depth
=
30
;
image_dataset_metadata
metadata
;
metadata
.
name
=
"imglab dataset"
;
metadata
.
comment
=
"Created by imglab tool."
;
for
(
unsigned
long
i
=
0
;
i
<
parser
.
number_of_arguments
();
++
i
)
{
const
string
temp
=
strip_path
(
file
(
parser
[
i
]).
full_name
(),
parent_dir
);
metadata
.
images
.
push_back
(
image
(
temp
));
}
for
(
unsigned
long
i
=
0
;
i
<
parser
.
option
(
"d"
).
count
();
++
i
)
{
unsigned
long
depth
=
0
;
if
(
parser
.
option
(
"r"
))
depth
=
30
;
try
{
const
string
temp
=
strip_path
(
file
(
parser
[
i
]).
full_name
(),
parent_dir
);
metadata
.
images
.
push_back
(
image
(
temp
));
}
catch
(
dlib
::
file
::
file_not_found
&
)
{
// then parser[i] should be a directory
std
::
vector
<
file
>
files
=
get_files_in_directory_tree
(
parser
.
option
(
"d"
).
argument
(
0
,
i
)
,
match_endings
(
".png .PNG .jpeg .JPEG .jpg .JPG .bmp .BMP .dng .DNG"
),
depth
);
sort
(
files
.
begin
(),
files
.
end
());
std
::
vector
<
file
>
files
=
get_files_in_directory_tree
(
parser
[
i
]
,
match_endings
(
".png .PNG .jpeg .JPEG .jpg .JPG .bmp .BMP .dng .DNG"
),
depth
);
sort
(
files
.
begin
(),
files
.
end
());
for
(
unsigned
long
j
=
0
;
j
<
files
.
size
();
++
j
)
{
metadata
.
images
.
push_back
(
image
(
strip_path
(
files
[
j
].
full_name
(),
parent_dir
)));
for
(
unsigned
long
j
=
0
;
j
<
files
.
size
();
++
j
)
{
metadata
.
images
.
push_back
(
image
(
strip_path
(
files
[
j
].
full_name
(),
parent_dir
)));
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment