double scale = 4.0;
int width = 24;
int height = 24;
+ double maxscale = -1.0;
srand((unsigned int)time(0));
" [-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;
}
{
height = atoi( argv[++i] );
}
+ else if( !strcmp( argv[i], "-maxscale" ) )
+ {
+ maxscale = atof( argv[++i] );
+ }
}
printf( "Info file name: %s\n", ((infoname == NULL) ? nullname : infoname ) );
}
printf( "Width: %d\n", width );
printf( "Height: %d\n", height );
+ printf( "Max Scale: %g\n", maxscale);
/* determine action */
if( imagename && vecname )
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" );
}
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
-
#include <cstring>
#include <ctime>
int invert, int maxintensitydev,
double maxxangle, double maxyangle, double maxzangle,
int showsamples,
- int winwidth, int winheight )
+ int winwidth, int winheight, double maxscale )
{
CvSampleDistortionData data;
int i;
int x, y, width, height;
float scale;
- float maxscale;
int inverse;
if( showsamples )
for( i = 0; i < count; i++ )
{
icvGetNextFromBackgroundData( cvbgdata, cvbgreader );
-
- maxscale = MIN( 0.7F * cvbgreader->src.cols / winwidth,
+ if( maxscale < 0.0 )
+ {
+ maxscale = MIN( 0.7F * cvbgreader->src.cols / winwidth,
0.7F * cvbgreader->src.rows / winheight );
+ }
+
if( maxscale < 1.0F ) continue;
scale = (maxscale - 1.0F) * rand() / RAND_MAX + 1.0F;
+
width = (int) (scale * winwidth);
height = (int) (scale * winheight);
x = (int) ((0.1+0.8 * rand()/RAND_MAX) * (cvbgreader->src.cols - width));
int invert, int maxintensitydev,
double maxxangle, double maxyangle, double maxzangle,
int showsamples,
- int winwidth, int winheight );
+ int winwidth, int winheight, double maxscale );
/*
* cvCreateTrainingSamplesFromInfo