Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
3e0c58c5
Commit
3e0c58c5
authored
Jun 10, 2014
by
Vlad Shakhuro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add labelling reading to app
parent
4f161937
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
13 deletions
+43
-13
main.cpp
apps/icf/main.cpp
+43
-13
No files found.
apps/icf/main.cpp
View file @
3e0c58c5
...
...
@@ -7,12 +7,22 @@ using std::string;
#include <vector>
using
std
::
vector
;
#include <fstream>
using
std
::
ifstream
;
using
std
::
getline
;
#include <sstream>
using
std
::
stringstream
;
#include <opencv2/core.hpp>
using
cv
::
Rect
;
#include "icfdetector.hpp"
#include "waldboost.hpp"
using
cv
::
adas
::
ICFDetectorParams
;
using
cv
::
adas
::
ICFDetector
;
static
bool
read_pos_int
(
const
char
*
str
,
int
*
n
)
{
int
pos
=
0
;
...
...
@@ -45,24 +55,42 @@ static bool read_overlap(const char *str, double *overlap)
return
true
;
}
static
vector
<
vector
<
Rect
>
>
read_labelling
(
const
string
&
filename
)
static
bool
read_labelling
(
const
string
&
path
,
vector
<
string
>&
filenames
,
vector
<
vector
<
Rect
>
>&
labelling
)
{
return
vector
<
vector
<
Rect
>
>
();
}
string
labelling_path
=
path
+
"/gt.txt"
;
string
filename
,
line
;
int
x1
,
y1
,
x2
,
y2
;
char
delim
;
ifstream
ifs
(
labelling_path
.
c_str
());
if
(
!
ifs
.
good
()
)
return
false
;
static
vector
<
string
>
get_filenames
(
const
string
&
labelling_path
)
{
return
vector
<
string
>
();
while
(
getline
(
ifs
,
line
)
)
{
stringstream
stream
(
line
);
stream
>>
filename
;
filenames
.
push_back
(
path
+
"/"
+
filename
);
vector
<
Rect
>
filename_labelling
;
while
(
stream
>>
x1
>>
y1
>>
x2
>>
y2
>>
delim
)
{
filename_labelling
.
push_back
(
Rect
(
x1
,
y1
,
x2
,
y2
));
}
labelling
.
push_back
(
filename_labelling
);
filename_labelling
.
clear
();
}
return
true
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
==
1
)
{
printf
(
"Usage: %s OPTIONS, where OPTIONS are:
\n
"
"
\n
"
"--
labelling <path> - path to
labelling
\n
"
" (
data should be in the same directory
)
\n
"
"--
path <path> - path to dir with data and
labelling
\n
"
" (
labelling should have name gt.txt
)
\n
"
"
\n
"
"--feature_count <count> - number of features to generate
\n
"
"
\n
"
...
...
@@ -78,14 +106,14 @@ int main(int argc, char *argv[])
return
0
;
}
string
labelling_
path
,
model_path
;
string
path
,
model_path
;
ICFDetectorParams
params
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
!
strcmp
(
"--
labelling
"
,
argv
[
i
])
)
if
(
!
strcmp
(
"--
path
"
,
argv
[
i
])
)
{
i
+=
1
;
labelling_
path
=
argv
[
i
];
path
=
argv
[
i
];
}
else
if
(
!
strcmp
(
"--feature_count"
,
argv
[
i
])
)
{
...
...
@@ -144,8 +172,10 @@ int main(int argc, char *argv[])
try
{
ICFDetector
detector
;
vector
<
vector
<
Rect
>
>
labelling
=
read_labelling
(
labelling_path
);
vector
<
string
>
filenames
=
get_filenames
(
labelling_path
);
vector
<
string
>
filenames
;
vector
<
vector
<
Rect
>
>
labelling
;
read_labelling
(
path
,
filenames
,
labelling
);
detector
.
train
(
filenames
,
labelling
,
params
);
}
catch
(
const
char
*
err
)
...
...
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