utils.cc File Reference

Generic utilities for scene generation example implementation. More...

#include "utils.hh"

Functions

const std::string getUsage (const char *argv_0)
 Returns string with program usage information. More...
 
void parseArgs (int argc, char **argv, unsigned int &scenes, unsigned int &start, std::string &imgs_dir, std::string &dataset_dir)
 Parses command-line arguments. More...
 
bool createDirectory (std::string &path)
 Creates the directory given its path. More...
 
std::mt19937 mt_rng (rng())
 
int getRandomInt (int min, int max)
 Get a random integer in a given interval. More...
 
double getRandomDouble (double min, double max)
 Get a random double in a given interval. More...
 
void shuffleIntVector (std::vector< int > &vector)
 Randomly shuffles an integer vector. More...
 

Variables

std::random_device rng
 
std::uniform_int_distribution< int > uniform_dist
 

Detailed Description

Generic utilities for scene generation example implementation.

Author
João Borrego : jsbruglie
Rui Figueiredo : ruipimentelfigueiredo

Function Documentation

bool createDirectory ( std::string &  path)

Creates the directory given its path.

Parameters
pathThe path string
Returns
true on success
double getRandomDouble ( double  min,
double  max 
)

Get a random double in a given interval.

Value is sampled from uniform distribution

Parameters
minInterval lower bound
maxInterval upper bound
Returns
Random double
int getRandomInt ( int  min,
int  max 
)

Get a random integer in a given interval.

Value is sampled from uniform distribution

Parameters
minInterval lower bound
maxInterval upper bound
Returns
Random integer
const std::string getUsage ( const char *  argv_0)

Returns string with program usage information.

Returns
Program usage
std::mt19937 mt_rng ( rng()  )
void parseArgs ( int  argc,
char **  argv,
unsigned int &  scenes,
unsigned int &  start,
std::string &  imgs_dir,
std::string &  dataset_dir 
)

Parses command-line arguments.

Parameters
argcArgument count
argvArgument values
scenesNumber of scenes to generate
startIndex of the first scene
imgs_dirImage output directory
dataset_dirDataset annotations output directory
void shuffleIntVector ( std::vector< int > &  vector)

Randomly shuffles an integer vector.

Variable Documentation

std::random_device rng
std::uniform_int_distribution<int> uniform_dist