Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
91c63155
Commit
91c63155
authored
Jun 18, 2011
by
Davis King
Browse files
Further simplified initial image selection.
parent
991cb97a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
20 deletions
+21
-20
tools/imglab/src/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)
...
@@ -409,15 +409,13 @@ int main(int argc, char** argv)
parser
.
add_option
(
"h"
,
"Displays this information."
);
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
(
"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
.
add_option
(
"r"
,
"Search directories recursively for images."
);
parser
.
parse
(
argc
,
argv
);
parser
.
parse
(
argc
,
argv
);
const
char
*
singles
[]
=
{
"h"
,
"c"
,
"r"
};
const
char
*
singles
[]
=
{
"h"
,
"c"
,
"r"
};
parser
.
check_one_time_options
(
singles
);
parser
.
check_one_time_options
(
singles
);
parser
.
check_sub_option
(
"c"
,
"d"
);
parser
.
check_sub_option
(
"c"
,
"r"
);
parser
.
check_sub_option
(
"d"
,
"r"
);
if
(
parser
.
option
(
"h"
))
if
(
parser
.
option
(
"h"
))
{
{
...
@@ -437,30 +435,33 @@ int main(int argc, char** argv)
...
@@ -437,30 +435,33 @@ int main(int argc, char** argv)
make_empty_file
(
filename
);
make_empty_file
(
filename
);
const
std
::
string
parent_dir
=
get_parent_directory
(
file
(
filename
)).
full_name
();
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
;
image_dataset_metadata
metadata
;
metadata
.
name
=
"imglab dataset"
;
metadata
.
name
=
"imglab dataset"
;
metadata
.
comment
=
"Created by imglab tool."
;
metadata
.
comment
=
"Created by imglab tool."
;
for
(
unsigned
long
i
=
0
;
i
<
parser
.
number_of_arguments
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
parser
.
number_of_arguments
();
++
i
)
{
{
const
string
temp
=
strip_path
(
file
(
parser
[
i
]).
full_name
(),
parent_dir
);
try
metadata
.
images
.
push_back
(
image
(
temp
));
{
}
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
)
catch
(
dlib
::
file
::
file_not_found
&
)
{
{
unsigned
long
depth
=
0
;
// then parser[i] should be a directory
if
(
parser
.
option
(
"r"
))
depth
=
30
;
std
::
vector
<
file
>
files
=
get_files_in_directory_tree
(
parser
.
option
(
"d"
).
argument
(
0
,
i
)
,
std
::
vector
<
file
>
files
=
get_files_in_directory_tree
(
parser
[
i
]
,
match_endings
(
".png .PNG .jpeg .JPEG .jpg .JPG .bmp .BMP .dng .DNG"
),
match_endings
(
".png .PNG .jpeg .JPEG .jpg .JPG .bmp .BMP .dng .DNG"
),
depth
);
depth
);
sort
(
files
.
begin
(),
files
.
end
());
sort
(
files
.
begin
(),
files
.
end
());
for
(
unsigned
long
j
=
0
;
j
<
files
.
size
();
++
j
)
for
(
unsigned
long
j
=
0
;
j
<
files
.
size
();
++
j
)
{
{
metadata
.
images
.
push_back
(
image
(
strip_path
(
files
[
j
].
full_name
(),
parent_dir
)));
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