libeblearntools
ebl::patch_dataset< Tdata > Class Template Reference

#include <patch_dataset.h>

Inheritance diagram for ebl::patch_dataset< Tdata >:
ebl::dataset< Tdata >

List of all members.

Public Member Functions

 patch_dataset (const char *name, const char *inroot, const char *outdir, uint max_folders=1)
virtual ~patch_dataset ()
 Destructor.
virtual bool add_data (idx< Tdata > &d, const t_label label, const string *class_name, const char *filename=NULL, const rect< int > *r=NULL, pair< int, int > *center=NULL, const rect< int > *visr=NULL, const rect< int > *cropr=NULL, const vector< object * > *objs=NULL, const jitter *jittforce=NULL)
 Extract patches from image.

Protected Member Functions

void save_patches (vector< idx< Tdata > > &patches, const string &outdir, uint max_folders, const string &filename, double scale, const t_label label)

Protected Attributes

uint max_folders

Detailed Description

template<class Tdata>
class ebl::patch_dataset< Tdata >

The patch_dataset class extracts random patches at differents scales from images. This can be used to generate background patches from a set of images known to exclude the non-background classes. All possible patches at each specified scale and matching the output size are found, then randomized and only the first n patches of the random list are saved per image, n being specified in the constructor as 'max_folders' variable.


Constructor & Destructor Documentation

template<class Tdata >
ebl::patch_dataset< Tdata >::patch_dataset ( const char *  name,
const char *  inroot,
const char *  outdir,
uint  max_folders = 1 
)

Initialize the dataset's name and other internal variables, but does not allocate data matrices, user must call alloc for that effect. outdims are the target output dimensions of each sample. inroot is the root directory from which we extract data.

Parameters:
max_foldersThe first 'max_folders' patches of each image's random list of patches are saved in a different folder each.

Member Function Documentation

template<class Tdata >
void ebl::patch_dataset< Tdata >::save_patches ( vector< idx< Tdata > > &  patches,
const string &  outdir,
uint  max_folders,
const string &  filename,
double  scale,
const t_label  label 
) [protected]

save patches into directory outdir, creating 1 subdirectory per patch until reaching max_folders, then filling last folder with remaining patches, using filename as base filename for patches filenames.


The documentation for this class was generated from the following files: