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
0175116f
Commit
0175116f
authored
Jun 19, 2011
by
Davis King
Browse files
renamed some things
parent
fbce4cd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
25 deletions
+25
-25
tools/imglab/src/main.cpp
tools/imglab/src/main.cpp
+25
-25
No files found.
tools/imglab/src/main.cpp
View file @
0175116f
...
...
@@ -20,7 +20,7 @@ using namespace dlib;
namespace
dlib
{
namespace
im
glab
namespace
im
age_dataset_metadata
{
struct
box
{
...
...
@@ -45,7 +45,7 @@ namespace dlib
std
::
vector
<
box
>
boxes
;
};
struct
image_
dataset
_metadata
struct
dataset
{
std
::
vector
<
image
>
images
;
std
::
string
comment
;
...
...
@@ -68,13 +68,13 @@ namespace dlib
}
void
save_image_dataset_metadata
(
const
image_
dataset
_metadata
&
metada
ta
,
const
dataset
&
me
ta
,
const
std
::
string
&
filename
)
{
create_image_metadata_stylesheet_file
();
const
std
::
vector
<
image
>&
images
=
meta
data
.
images
;
const
std
::
vector
<
image
>&
images
=
meta
.
images
;
ofstream
fout
(
filename
.
c_str
());
if
(
!
fout
)
...
...
@@ -83,8 +83,8 @@ namespace dlib
fout
<<
"<?xml version='1.0' encoding='ISO-8859-1'?>
\n
"
;
fout
<<
"<?xml-stylesheet type='text/xsl' href='image_metadata_stylesheet.xsl'?>
\n
"
;
fout
<<
"<dataset>
\n
"
;
fout
<<
"<name>"
<<
meta
data
.
name
<<
"</name>
\n
"
;
fout
<<
"<comment>"
<<
meta
data
.
comment
<<
"</comment>
\n
"
;
fout
<<
"<name>"
<<
meta
.
name
<<
"</name>
\n
"
;
fout
<<
"<comment>"
<<
meta
.
comment
<<
"</comment>
\n
"
;
fout
<<
"<images>
\n
"
;
for
(
unsigned
long
i
=
0
;
i
<
images
.
size
();
++
i
)
{
...
...
@@ -137,21 +137,21 @@ namespace dlib
image
temp_image
;
box
temp_box
;
image_
dataset
_metadata
&
metada
ta
;
dataset
&
me
ta
;
public:
doc_handler
(
image_
dataset
_metadata
&
metadata_
dataset
&
metadata_
)
:
meta
data
(
metadata_
)
meta
(
metadata_
)
{}
virtual
void
start_document
(
)
{
meta
data
=
image_dataset_metadata
();
meta
=
dataset
();
ts
.
clear
();
temp_image
=
image
();
temp_box
=
box
();
...
...
@@ -236,7 +236,7 @@ namespace dlib
}
else
if
(
name
==
"image"
&&
ts
.
back
()
==
"images"
)
{
meta
data
.
images
.
push_back
(
temp_image
);
meta
.
images
.
push_back
(
temp_image
);
temp_image
=
image
();
}
}
...
...
@@ -247,11 +247,11 @@ namespace dlib
{
if
(
ts
.
size
()
==
2
&&
ts
[
1
]
==
"name"
)
{
meta
data
.
name
=
trim
(
data
);
meta
.
name
=
trim
(
data
);
}
else
if
(
ts
.
size
()
==
2
&&
ts
[
1
]
==
"comment"
)
{
meta
data
.
comment
=
trim
(
data
);
meta
.
comment
=
trim
(
data
);
}
else
if
(
ts
.
size
()
>=
2
&&
ts
[
ts
.
size
()
-
1
]
==
"label"
&&
ts
[
ts
.
size
()
-
2
]
==
"box"
)
...
...
@@ -294,12 +294,12 @@ namespace dlib
// ------------------------------------------------------------------------------------
void
load_image_dataset_metadata
(
image_
dataset
_metadata
&
metada
ta
,
dataset
&
me
ta
,
const
std
::
string
&
filename
)
{
xml_error_handler
eh
;
doc_handler
dh
(
meta
data
);
doc_handler
dh
(
meta
);
std
::
ifstream
fin
(
filename
.
c_str
());
if
(
!
fin
)
...
...
@@ -427,7 +427,7 @@ int main(int argc, char** argv)
if
(
parser
.
option
(
"c"
))
{
using
namespace
dlib
::
im
glab
;
using
namespace
dlib
::
im
age_dataset_metadata
;
const
std
::
string
filename
=
parser
.
option
(
"c"
).
argument
();
// make sure the file exists so we can use the get_parent_directory() command to
...
...
@@ -439,15 +439,15 @@ int main(int argc, char** argv)
if
(
parser
.
option
(
"r"
))
depth
=
30
;
image_
dataset
_metadata
metada
ta
;
meta
data
.
name
=
"imglab dataset"
;
meta
data
.
comment
=
"Created by imglab tool."
;
dataset
me
ta
;
meta
.
name
=
"imglab dataset"
;
meta
.
comment
=
"Created by imglab tool."
;
for
(
unsigned
long
i
=
0
;
i
<
parser
.
number_of_arguments
();
++
i
)
{
try
{
const
string
temp
=
strip_path
(
file
(
parser
[
i
]).
full_name
(),
parent_dir
);
meta
data
.
images
.
push_back
(
image
(
temp
));
meta
.
images
.
push_back
(
image
(
temp
));
}
catch
(
dlib
::
file
::
file_not_found
&
)
{
...
...
@@ -460,21 +460,21 @@ int main(int argc, char** argv)
for
(
unsigned
long
j
=
0
;
j
<
files
.
size
();
++
j
)
{
meta
data
.
images
.
push_back
(
image
(
strip_path
(
files
[
j
].
full_name
(),
parent_dir
)));
meta
.
images
.
push_back
(
image
(
strip_path
(
files
[
j
].
full_name
(),
parent_dir
)));
}
}
}
save_image_dataset_metadata
(
meta
data
,
filename
);
save_image_dataset_metadata
(
meta
,
filename
);
return
EXIT_SUCCESS
;
}
if
(
parser
.
number_of_arguments
()
==
1
)
{
dlib
::
imglab
::
image_dataset_metadata
metada
ta
;
load_image_dataset_metadata
(
meta
data
,
parser
[
0
]);
save_image_dataset_metadata
(
meta
data
,
"out.xml"
);
dlib
::
image_dataset_metadata
::
dataset
me
ta
;
load_image_dataset_metadata
(
meta
,
parser
[
0
]);
save_image_dataset_metadata
(
meta
,
"out.xml"
);
}
}
catch
(
exception
&
e
)
...
...
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