Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
b973b73a
Commit
b973b73a
authored
8 years ago
by
Bob Paulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -maxscale parameter to limit the amount sample images can scale in background images
parent
ec63343f
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
createsamples.cpp
apps/createsamples/createsamples.cpp
+10
-3
utility.cpp
apps/createsamples/utility.cpp
+7
-5
utility.hpp
apps/createsamples/utility.hpp
+1
-1
No files found.
apps/createsamples/createsamples.cpp
View file @
b973b73a
...
...
@@ -76,6 +76,7 @@ int main( int argc, char* argv[] )
double
scale
=
4.0
;
int
width
=
24
;
int
height
=
24
;
double
maxscale
=
-
1.0
;
srand
((
unsigned
int
)
time
(
0
));
...
...
@@ -92,9 +93,10 @@ int main( int argc, char* argv[] )
" [-maxyangle <max_y_rotation_angle = %f>]
\n
"
" [-maxzangle <max_z_rotation_angle = %f>]
\n
"
" [-show [<scale = %f>]]
\n
"
" [-w <sample_width = %d>]
\n
[-h <sample_height = %d>]
\n
"
,
" [-w <sample_width = %d>]
\n
[-h <sample_height = %d>]
\n
"
" [-maxscale <max sample scale = %f>]
\n
"
,
argv
[
0
],
num
,
bgcolor
,
bgthreshold
,
maxintensitydev
,
maxxangle
,
maxyangle
,
maxzangle
,
scale
,
width
,
height
);
maxxangle
,
maxyangle
,
maxzangle
,
scale
,
width
,
height
,
maxscale
);
return
0
;
}
...
...
@@ -172,6 +174,10 @@ int main( int argc, char* argv[] )
{
height
=
atoi
(
argv
[
++
i
]
);
}
else
if
(
!
strcmp
(
argv
[
i
],
"-maxscale"
)
)
{
maxscale
=
atof
(
argv
[
++
i
]
);
}
}
printf
(
"Info file name: %s
\n
"
,
((
infoname
==
NULL
)
?
nullname
:
infoname
)
);
...
...
@@ -194,6 +200,7 @@ int main( int argc, char* argv[] )
}
printf
(
"Width: %d
\n
"
,
width
);
printf
(
"Height: %d
\n
"
,
height
);
printf
(
"Max Scale: %g
\n
"
,
maxscale
);
/* determine action */
if
(
imagename
&&
vecname
)
...
...
@@ -213,7 +220,7 @@ int main( int argc, char* argv[] )
cvCreateTestSamples
(
infoname
,
imagename
,
bgcolor
,
bgthreshold
,
bgfilename
,
num
,
invert
,
maxintensitydev
,
maxxangle
,
maxyangle
,
maxzangle
,
showsamples
,
width
,
height
);
maxxangle
,
maxyangle
,
maxzangle
,
showsamples
,
width
,
height
,
maxscale
);
printf
(
"Done
\n
"
);
}
...
...
This diff is collapsed.
Click to expand it.
apps/createsamples/utility.cpp
View file @
b973b73a
...
...
@@ -38,7 +38,6 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include <cstring>
#include <ctime>
...
...
@@ -1308,7 +1307,7 @@ void cvCreateTestSamples( const char* infoname,
int
invert
,
int
maxintensitydev
,
double
maxxangle
,
double
maxyangle
,
double
maxzangle
,
int
showsamples
,
int
winwidth
,
int
winheight
)
int
winwidth
,
int
winheight
,
double
maxscale
)
{
CvSampleDistortionData
data
;
...
...
@@ -1337,7 +1336,6 @@ void cvCreateTestSamples( const char* infoname,
int
i
;
int
x
,
y
,
width
,
height
;
float
scale
;
float
maxscale
;
int
inverse
;
if
(
showsamples
)
...
...
@@ -1366,12 +1364,16 @@ void cvCreateTestSamples( const char* infoname,
for
(
i
=
0
;
i
<
count
;
i
++
)
{
icvGetNextFromBackgroundData
(
cvbgdata
,
cvbgreader
);
maxscale
=
MIN
(
0.7
F
*
cvbgreader
->
src
.
cols
/
winwidth
,
if
(
maxscale
<
0.0
)
{
maxscale
=
MIN
(
0.7
F
*
cvbgreader
->
src
.
cols
/
winwidth
,
0.7
F
*
cvbgreader
->
src
.
rows
/
winheight
);
}
if
(
maxscale
<
1.0
F
)
continue
;
scale
=
(
maxscale
-
1.0
F
)
*
rand
()
/
RAND_MAX
+
1.0
F
;
width
=
(
int
)
(
scale
*
winwidth
);
height
=
(
int
)
(
scale
*
winheight
);
x
=
(
int
)
((
0.1
+
0.8
*
rand
()
/
RAND_MAX
)
*
(
cvbgreader
->
src
.
cols
-
width
));
...
...
This diff is collapsed.
Click to expand it.
apps/createsamples/utility.hpp
View file @
b973b73a
...
...
@@ -86,7 +86,7 @@ void cvCreateTestSamples( const char* infoname,
int
invert
,
int
maxintensitydev
,
double
maxxangle
,
double
maxyangle
,
double
maxzangle
,
int
showsamples
,
int
winwidth
,
int
winheight
);
int
winwidth
,
int
winheight
,
double
maxscale
);
/*
* cvCreateTrainingSamplesFromInfo
...
...
This diff is collapsed.
Click to expand it.
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