Naming fixes and code beautification
This commit is contained in:
parent
57cf3d1766
commit
74d8527f8a
@ -50,6 +50,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -218,28 +219,22 @@ int main( int argc, char* argv[] )
|
||||
|
||||
printf( "Done\n" );
|
||||
}
|
||||
else if( imagename && bgfilename && infoname && pngoutput)
|
||||
else if( imagename && bgfilename && infoname)
|
||||
{
|
||||
printf( "Create training set from a single image and a collection of backgrounds.\n"
|
||||
"Output format: %s\n"
|
||||
"Annotations are in a separate directory\n",
|
||||
(( pngoutput ) ? "JPG" : "PNG") );
|
||||
|
||||
PngDatasetGenerator creator( infoname );
|
||||
creator.create( imagename, bgcolor, bgthreshold, bgfilename, num,
|
||||
invert, maxintensitydev, maxxangle, maxyangle, maxzangle,
|
||||
showsamples, width, height );
|
||||
|
||||
printf( "Done\n" );
|
||||
}
|
||||
else if( imagename && bgfilename && infoname )
|
||||
{
|
||||
printf( "Create test samples from single image applying distortions...\n"
|
||||
printf( "Create data set from single image applying distortions...\n"
|
||||
"Output format: %s\n",
|
||||
(( pngoutput ) ? "JPG" : "PNG") );
|
||||
(( pngoutput ) ? "PNG" : "JPG") );
|
||||
|
||||
JpgDatasetGrenerator creator( infoname );
|
||||
creator.create( imagename, bgcolor, bgthreshold, bgfilename, num,
|
||||
std::auto_ptr<DatasetGenerator> creator;
|
||||
if( pngoutput )
|
||||
{
|
||||
creator = std::auto_ptr<DatasetGenerator>( new PngDatasetGenerator( infoname ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
creator = std::auto_ptr<DatasetGenerator>( new JpgDatasetGenerator( infoname ) );
|
||||
}
|
||||
creator->create( imagename, bgcolor, bgthreshold, bgfilename, num,
|
||||
invert, maxintensitydev, maxxangle, maxyangle, maxzangle,
|
||||
showsamples, width, height );
|
||||
|
||||
|
@ -3029,12 +3029,12 @@ DatasetGenerator::~DatasetGenerator()
|
||||
}
|
||||
|
||||
|
||||
JpgDatasetGrenerator::JpgDatasetGrenerator(const char* filename)
|
||||
:DatasetGenerator(IOutput::createOutput(filename,IOutput::JPG_TEST_SET))
|
||||
JpgDatasetGenerator::JpgDatasetGenerator( const char* filename )
|
||||
:DatasetGenerator( IOutput::createOutput( filename, IOutput::JPG_DATASET ) )
|
||||
{
|
||||
}
|
||||
|
||||
CvSize JpgDatasetGrenerator::scaleObjectSize(const CvSize& bgImgSize,
|
||||
CvSize JpgDatasetGenerator::scaleObjectSize( const CvSize& bgImgSize,
|
||||
const CvSize& ,
|
||||
const CvSize& sampleSize) const
|
||||
{
|
||||
@ -3074,13 +3074,13 @@ CvRect DatasetGenerator::getObjectPosition(const CvSize& bgImgSize,
|
||||
|
||||
|
||||
PngDatasetGenerator::PngDatasetGenerator(const char* filename)
|
||||
:DatasetGenerator(IOutput::createOutput(filename,IOutput::PNG_TRAINING_SET))
|
||||
:DatasetGenerator( IOutput::createOutput( filename, IOutput::PNG_DATASET ) )
|
||||
{
|
||||
}
|
||||
|
||||
CvSize PngDatasetGenerator::scaleObjectSize( const CvSize& bgImgSize,
|
||||
const CvSize& imgSize,
|
||||
const CvSize& ) const
|
||||
const CvSize& imgSize,
|
||||
const CvSize& ) const
|
||||
{
|
||||
float scale;
|
||||
|
||||
|
@ -227,10 +227,10 @@ private:
|
||||
};
|
||||
|
||||
/* Provides the functionality of test set generating */
|
||||
class JpgDatasetGrenerator: public DatasetGenerator
|
||||
class JpgDatasetGenerator: public DatasetGenerator
|
||||
{
|
||||
public:
|
||||
JpgDatasetGrenerator(const char* filename);
|
||||
JpgDatasetGenerator(const char* filename);
|
||||
private:
|
||||
CvSize scaleObjectSize(const CvSize& bgImgSize,
|
||||
const CvSize& ,
|
||||
|
@ -34,10 +34,10 @@ IOutput* IOutput::createOutput(const char *filename,
|
||||
{
|
||||
IOutput* output = 0;
|
||||
switch (type) {
|
||||
case IOutput::PNG_TRAINING_SET:
|
||||
case IOutput::PNG_DATASET:
|
||||
output = new PngDatasetOutput();
|
||||
break;
|
||||
case IOutput::JPG_TEST_SET:
|
||||
case IOutput::JPG_DATASET:
|
||||
output = new JpgDatasetOutput();
|
||||
break;
|
||||
default:
|
||||
|
@ -11,7 +11,7 @@ struct CvRect;
|
||||
class IOutput
|
||||
{
|
||||
public:
|
||||
enum OutputType {PNG_TRAINING_SET, JPG_TEST_SET};
|
||||
enum OutputType {PNG_DATASET, JPG_DATASET};
|
||||
public:
|
||||
virtual bool write( const CvMat& img,
|
||||
const CvRect& boundingBox ) =0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user