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
9d0f6796
"tests/vscode:/vscode.git/clone" did not exist on "5747542f35e549d71cf6852678349373981291e6"
Commit
9d0f6796
authored
Mar 30, 2013
by
Davis King
Browse files
Added the --rmdiff option and also improved the formatting in the output of -h
parent
1e1f4efb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
5 deletions
+36
-5
tools/imglab/src/main.cpp
tools/imglab/src/main.cpp
+36
-5
No files found.
tools/imglab/src/main.cpp
View file @
9d0f6796
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
#include <dlib/dir_nav.h>
#include <dlib/dir_nav.h>
const
char
*
VERSION
=
"0.
4
"
;
const
char
*
VERSION
=
"0.
5
"
;
...
@@ -122,23 +122,29 @@ int main(int argc, char** argv)
...
@@ -122,23 +122,29 @@ int main(int argc, char** argv)
command_line_parser
parser
;
command_line_parser
parser
;
parser
.
add_option
(
"h"
,
"Displays this information."
);
parser
.
add_option
(
"h"
,
"Displays this information."
);
parser
.
add_option
(
"v"
,
"Display version."
);
parser
.
set_group_name
(
"Creating XML files"
);
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
(
"r"
,
"Search directories recursively for images."
);
parser
.
add_option
(
"r"
,
"Search directories recursively for images."
);
parser
.
add_option
(
"convert"
,
"Convert foreign image Annotations from <arg> format to the imglab format. "
"Supported formats: pascal-xml, pascal-v1, idl."
,
1
);
parser
.
set_group_name
(
"Viewing/Editing XML files"
);
parser
.
add_option
(
"l"
,
"List all the labels in the given XML file."
);
parser
.
add_option
(
"l"
,
"List all the labels in the given XML file."
);
parser
.
add_option
(
"rename"
,
"Rename all labels of <arg1> to <arg2>."
,
2
);
parser
.
add_option
(
"rename"
,
"Rename all labels of <arg1> to <arg2>."
,
2
);
parser
.
add_option
(
"v"
,
"Display version."
);
parser
.
add_option
(
"parts"
,
"The display will allow image parts to be labeled. The set of allowable parts "
parser
.
add_option
(
"parts"
,
"The display will allow image parts to be labeled. The set of allowable parts "
"defined in a space separated list contained in <arg>."
,
1
);
"defined in a space separated list contained in <arg>."
,
1
);
parser
.
add_option
(
"convert"
,
"Convert foreign image Annotations from <arg> format to the imglab format. "
parser
.
add_option
(
"rmdiff"
,
"Remove boxes marked as difficult."
);
"Supported formats: pascal-xml, pascal-v1, idl."
,
1
);
parser
.
parse
(
argc
,
argv
);
parser
.
parse
(
argc
,
argv
);
const
char
*
singles
[]
=
{
"h"
,
"c"
,
"r"
,
"l"
,
"convert"
,
"parts"
};
const
char
*
singles
[]
=
{
"h"
,
"c"
,
"r"
,
"l"
,
"convert"
,
"parts"
,
"rmdiff"
};
parser
.
check_one_time_options
(
singles
);
parser
.
check_one_time_options
(
singles
);
const
char
*
c_sub_ops
[]
=
{
"r"
,
"convert"
};
const
char
*
c_sub_ops
[]
=
{
"r"
,
"convert"
};
parser
.
check_sub_options
(
"c"
,
c_sub_ops
);
parser
.
check_sub_options
(
"c"
,
c_sub_ops
);
parser
.
check_incompatible_options
(
"c"
,
"l"
);
parser
.
check_incompatible_options
(
"c"
,
"l"
);
parser
.
check_incompatible_options
(
"c"
,
"rmdiff"
);
parser
.
check_incompatible_options
(
"c"
,
"rename"
);
parser
.
check_incompatible_options
(
"c"
,
"rename"
);
parser
.
check_incompatible_options
(
"c"
,
"parts"
);
parser
.
check_incompatible_options
(
"c"
,
"parts"
);
parser
.
check_incompatible_options
(
"l"
,
"rename"
);
parser
.
check_incompatible_options
(
"l"
,
"rename"
);
...
@@ -146,6 +152,7 @@ int main(int argc, char** argv)
...
@@ -146,6 +152,7 @@ int main(int argc, char** argv)
parser
.
check_incompatible_options
(
"convert"
,
"l"
);
parser
.
check_incompatible_options
(
"convert"
,
"l"
);
parser
.
check_incompatible_options
(
"convert"
,
"rename"
);
parser
.
check_incompatible_options
(
"convert"
,
"rename"
);
parser
.
check_incompatible_options
(
"convert"
,
"parts"
);
parser
.
check_incompatible_options
(
"convert"
,
"parts"
);
parser
.
check_incompatible_options
(
"rmdiff"
,
"rename"
);
const
char
*
convert_args
[]
=
{
"pascal-xml"
,
"pascal-v1"
,
"idl"
};
const
char
*
convert_args
[]
=
{
"pascal-xml"
,
"pascal-v1"
,
"idl"
};
parser
.
check_option_arg_range
(
"convert"
,
convert_args
);
parser
.
check_option_arg_range
(
"convert"
,
convert_args
);
...
@@ -184,6 +191,30 @@ int main(int argc, char** argv)
...
@@ -184,6 +191,30 @@ int main(int argc, char** argv)
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
if
(
parser
.
option
(
"rmdiff"
))
{
if
(
parser
.
number_of_arguments
()
!=
1
)
{
cerr
<<
"The --rmdiff option requires you to give one XML file on the command line."
<<
endl
;
return
EXIT_FAILURE
;
}
dlib
::
image_dataset_metadata
::
dataset
data
;
load_image_dataset_metadata
(
data
,
parser
[
0
]);
for
(
unsigned
long
i
=
0
;
i
<
data
.
images
.
size
();
++
i
)
{
std
::
vector
<
dlib
::
image_dataset_metadata
::
box
>
boxes
;
for
(
unsigned
long
j
=
0
;
j
<
data
.
images
[
i
].
boxes
.
size
();
++
j
)
{
if
(
!
data
.
images
[
i
].
boxes
[
j
].
difficult
)
boxes
.
push_back
(
data
.
images
[
i
].
boxes
[
j
]);
}
data
.
images
[
i
].
boxes
=
boxes
;
}
save_image_dataset_metadata
(
data
,
parser
[
0
]);
return
EXIT_SUCCESS
;
}
if
(
parser
.
option
(
"l"
))
if
(
parser
.
option
(
"l"
))
{
{
if
(
parser
.
number_of_arguments
()
!=
1
)
if
(
parser
.
number_of_arguments
()
!=
1
)
...
...
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