Merge pull request #10287 from sturkmen72:update_createsamples_cpp
* update createsamples adds command-line option -rngseed replaces rand() -> theRNG() * Update utility.cpp * apps(createsamples): fix warpPerspective pixels access bug
This commit is contained in:
committed by
Alexander Alekhin
parent
7d4a67f2a8
commit
c5ed507737
@@ -45,16 +45,15 @@
|
||||
* Create test/training samples
|
||||
*/
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "utility.hpp"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
int i = 0;
|
||||
@@ -77,8 +76,7 @@ int main( int argc, char* argv[] )
|
||||
int width = 24;
|
||||
int height = 24;
|
||||
double maxscale = -1.0;
|
||||
|
||||
srand((unsigned int)time(0));
|
||||
int rngseed = 12345;
|
||||
|
||||
if( argc == 1 )
|
||||
{
|
||||
@@ -94,9 +92,10 @@ int main( int argc, char* argv[] )
|
||||
" [-maxzangle <max_z_rotation_angle = %f>]\n"
|
||||
" [-show [<scale = %f>]]\n"
|
||||
" [-w <sample_width = %d>]\n [-h <sample_height = %d>]\n"
|
||||
" [-maxscale <max sample scale = %f>]\n",
|
||||
" [-maxscale <max sample scale = %f>]\n"
|
||||
" [-rngseed <rng seed = %d>]\n",
|
||||
argv[0], num, bgcolor, bgthreshold, maxintensitydev,
|
||||
maxxangle, maxyangle, maxzangle, scale, width, height, maxscale );
|
||||
maxxangle, maxyangle, maxzangle, scale, width, height, maxscale, rngseed );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -178,8 +177,14 @@ int main( int argc, char* argv[] )
|
||||
{
|
||||
maxscale = atof( argv[++i] );
|
||||
}
|
||||
else if (!strcmp(argv[i], "-rngseed"))
|
||||
{
|
||||
rngseed = atoi(argv[++i]);
|
||||
}
|
||||
}
|
||||
|
||||
cv::setRNGSeed( rngseed );
|
||||
|
||||
printf( "Info file name: %s\n", ((infoname == NULL) ? nullname : infoname ) );
|
||||
printf( "Img file name: %s\n", ((imagename == NULL) ? nullname : imagename ) );
|
||||
printf( "Vec file name: %s\n", ((vecname == NULL) ? nullname : vecname ) );
|
||||
@@ -200,7 +205,8 @@ int main( int argc, char* argv[] )
|
||||
}
|
||||
printf( "Width: %d\n", width );
|
||||
printf( "Height: %d\n", height );
|
||||
printf( "Max Scale: %g\n", maxscale);
|
||||
printf( "Max Scale: %g\n", maxscale );
|
||||
printf( "RNG Seed: %d\n", rngseed );
|
||||
|
||||
/* determine action */
|
||||
if( imagename && vecname )
|
||||
|
||||
Reference in New Issue
Block a user