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