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
9d0f6796
Commit
9d0f6796
authored
Mar 30, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the --rmdiff option and also improved the formatting in the output of -h
parent
1e1f4efb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
5 deletions
+36
-5
main.cpp
tools/imglab/src/main.cpp
+36
-5
No files found.
tools/imglab/src/main.cpp
View file @
9d0f6796
...
...
@@ -15,7 +15,7 @@
#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)
command_line_parser
parser
;
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
(
"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
(
"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 "
"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. "
"Supported formats: pascal-xml, pascal-v1, idl."
,
1
);
parser
.
add_option
(
"rmdiff"
,
"Remove boxes marked as difficult."
);
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
);
const
char
*
c_sub_ops
[]
=
{
"r"
,
"convert"
};
parser
.
check_sub_options
(
"c"
,
c_sub_ops
);
parser
.
check_incompatible_options
(
"c"
,
"l"
);
parser
.
check_incompatible_options
(
"c"
,
"rmdiff"
);
parser
.
check_incompatible_options
(
"c"
,
"rename"
);
parser
.
check_incompatible_options
(
"c"
,
"parts"
);
parser
.
check_incompatible_options
(
"l"
,
"rename"
);
...
...
@@ -146,6 +152,7 @@ int main(int argc, char** argv)
parser
.
check_incompatible_options
(
"convert"
,
"l"
);
parser
.
check_incompatible_options
(
"convert"
,
"rename"
);
parser
.
check_incompatible_options
(
"convert"
,
"parts"
);
parser
.
check_incompatible_options
(
"rmdiff"
,
"rename"
);
const
char
*
convert_args
[]
=
{
"pascal-xml"
,
"pascal-v1"
,
"idl"
};
parser
.
check_option_arg_range
(
"convert"
,
convert_args
);
...
...
@@ -183,6 +190,30 @@ int main(int argc, char** argv)
}
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"
))
{
...
...
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