本文整理汇总了C++中tclap::ValueArg::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ValueArg::getValue方法的具体用法?C++ ValueArg::getValue怎么用?C++ ValueArg::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tclap::ValueArg
的用法示例。
在下文中一共展示了ValueArg::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canExecute
bool Characterization::canExecute(Feature* task)
{
// is argOnly set?
if (argOnly.getValue().size() > 0)
{
vector<string> onlies = argOnly.getValue();
vector<string>::iterator i;
for(i=onlies.begin(); i != onlies.end(); ++i)
{
string onlyFeat = *i;
if (onlyFeat.compare(task->getName()) == 0)
{
VerboseOutput::println(string("Characterization"), "option --only: extract feature only '" + onlyFeat + "'");
return true;
}
}
return false;
}
bool result = true;
// check if a certain level is requested
if( (task->getLevel() == argLevel.getValue()) ||
((argLevel.getValue() == 0) && (task->getLevel() < 4)) )
{
// check if certain features should be skipped
vector<string> nos = argNO.getValue();
vector<string>::iterator i;
for(i=nos.begin(); i != nos.end(); ++i)
{
string no = *i;
if (no.compare(task->getName()) == 0)
{
result = false;
}
}
}
else
{
result = false;
}
return result;
}
示例2: main
// }}}
int main(int argc, char* argv[]) { // {{{
// {{{ initial definitions
cmd.parse( argc, argv );
int error=0;
string option=optionArg.getValue();
cout.precision(17); cerr.precision(17);
// }}}
// {{{ Set seed for random
unsigned int semilla=seed.getValue();
if (semilla == 0){
Random semilla_uran; semilla=semilla_uran.strong();
}
RNG_reset(semilla);
// }}}
// {{{ Report on the screen
if(!no_general_report.getValue()){
cout << "#linea de comando: ";
for(int i=0;i<argc;i++){
cout <<argv[i]<<" " ;
} cout << endl ;
cout << "#semilla = " << semilla << endl;
error += system("echo \\#hostname: $(hostname)");
error += system("echo \\#comenzando en: $(date)");
error += system("echo \\#uname -a: $(uname -a)");
error += system("echo \\#working dir: $(pwd)");
}
// }}}
if //{{{ option == loquesea
(option == "get_gse_spectrum"){ // {{{
vec eig=eig_sym(RandomGSEDeltaOne(dimension.getValue()));
for (int i=0; i<eig.size(); i++){ cout << eig(i) << endl;}
// cout << eig << endl;
return 0;
} // }}}
else if (option == "get_gse_flat_spectrum"){ // {{{
vec eig=FlatSpectrumGSE(dimension.getValue());
for (int i=0; i<eig.size(); i++){ cout << eig(i) << endl;}
// cout << eig <<endl;
return 0;
} // }}}
else if (option == "get_gse_flat_spectrum"){ // {{{
vec eig=FlatSpectrumGSE(dimension.getValue());
for (int i=0; i<eig.size(); i++){ cout << eig(i) << endl;}
// cout << eig <<endl;
return 0;
} // }}}
//}}}
} // }}}
示例3: test
int test(int argc, char ** argv)
{
NUKLEI_TRACE_BEGIN();
/* Parse command line arguments */
TCLAP::CmdLine cmd(INFOSTRING + "Test App." );
/* Standard arguments */
TCLAP::ValueArg<int> niceArg
("", "nice",
"Proccess priority.",
false, NICEINC, "int", cmd);
/* Custom arguments */
TCLAP::UnlabeledValueArg<std::string> fileArg
("file",
"Nuklei file.",
false, "", "filename", cmd);
cmd.parse( argc, argv );
NUKLEI_ASSERT(setpriority(PRIO_PROCESS, 0, niceArg.getValue()) == 0);
Quaternion q(1, 0, 0, 0);
{
Quaternion r;
r.FromAxisAngle(Vector3::UNIT_Z, M_PI/2);
q = r * q;
std::cout << la::normalized(q) << std::endl;
}
{
Quaternion r;
r.FromAxisAngle(Vector3::UNIT_Z, M_PI);
std::cout << la::normalized(r*q) << std::endl;
}
{
Quaternion r;
r.FromAxisAngle(Vector3::UNIT_Y, 90. / 180*M_PI);
std::cout << la::normalized(r*q) << std::endl;
}
{
Quaternion r;
r.FromAxisAngle(Vector3::UNIT_Y, -90. / 180*M_PI);
std::cout << la::normalized(r*q) << std::endl;
}
return 0;
NUKLEI_TRACE_END();
}
示例4: main
// }}}
int main(int argc, char* argv[]){ // {{{
// {{{ initial definitions
cmd.parse( argc, argv );
int error=0;
string option=optionArg.getValue();
cout.precision(17); cerr.precision(17);
// }}}
// {{{ Set seed for random
unsigned int semilla=seed.getValue();
if (semilla == 0){
Random semilla_uran; semilla=semilla_uran.strong();
}
RNG_reset(semilla);
// }}}
// {{{ Report on the screen
if(!no_general_report.getValue()){
cout << "#linea de comando: ";
for(int i=0;i<argc;i++){
cout <<argv[i]<<" " ;
} cout << endl ;
cout << "#semilla = " << semilla << endl;
error += system("echo \\#hostname: $(hostname)");
error += system("echo \\#comenzando en: $(date)");
error += system("echo \\#uname -a: $(uname -a)");
error += system("echo \\#working dir: $(pwd)");
}
// }}}
if //{{{ option == loquesea
(option == "loquesea"){ // {{{
// }}}
} else if (option == "nichts") { // {{{
// }}}
} else { // {{{
cout << "Error en la opcion. Mira, esto es lo que paso: "
<< optionArg.getValue() << endl;
} // }}}
// }}}
// {{{ Final report
if(!no_general_report.getValue()){
error += system("echo \\#terminando: $(date)");
}
// }}}
return 0;
} // }}}
示例5: runtime_error
// ======================================================================
// See TOutputRawlogCreator declaration
// ======================================================================
TOutputRawlogCreator::TOutputRawlogCreator()
{
if (!arg_output_file.isSet())
throw runtime_error("This operation requires an output file. Use '-o file' or '--output file'.");
out_rawlog_filename = arg_output_file.getValue();
if (fileExists(out_rawlog_filename) && !arg_overwrite.getValue() )
throw runtime_error(string("*ABORTING*: Output file already exists: ") + out_rawlog_filename + string("\n. Select a different output path, remove the file or force overwrite with '-w' or '--overwrite'.") );
if (!out_rawlog.open(out_rawlog_filename))
throw runtime_error(string("*ABORTING*: Cannot open output file: ") + out_rawlog_filename );
}
示例6: main
int main(int argc, char* argv[]) { //{{{
// Random semilla_uran;
// itpp::RNG_reset(semilla_uran.strong());
// cout << PurityRMT::QubitEnvironmentHamiltonian(3,0.) <<endl;
// cout << RMT::FlatSpectrumGUE(5,.1) <<endl;
//
cmd.parse( argc, argv );
cout.precision(16);
string option=optionArg.getValue();
if (option=="test_kick_single_spin"){ // {{{// {{{
int dim=pow_2(qubits.getValue());
cvec state(dim);
double x,y;
ifstream myReadFile;
myReadFile.open("/tmp/estado.dat");
for (int i=0; i<dim; i++){
myReadFile >> x >> y ;
state(i) = complex<double>(x,y) ;
}
myReadFile.close();
vec b(3); b(0)=bx.getValue(); b(1)=by.getValue(); b(2)=bz.getValue();
apply_magnetic_kick(state,b,position.getValue());
for (int i=0; i<dim; i++){
cout << real(state(i)) << " " << real(-Im*state(i)) << endl;
}//}}}
} else if(option=="test_kick") { // {{{
示例7: getArgValue
bool getArgValue(TCLAP::CmdLine &cmdline, const std::string &arg_name, T &out_val)
{
using namespace TCLAP;
std::list<Arg*>& args = cmdline.getArgList();
for (std::list<Arg*>::iterator it=args.begin();it!=args.end();++it)
{
if ( (*it)->getName() == arg_name)
{
// Is it set? Return the default value anyway:
TCLAP::ValueArg<T> *arg = static_cast<TCLAP::ValueArg<T> *>(*it);
out_val = arg->getValue();
return (*it)->isSet();
}
}
return false;
}
示例8: runtime_error
// ======================================================================
// See TOutputRawlogCreator declaration
// ======================================================================
TOutputRawlogCreator::TOutputRawlogCreator()
{
if (!arg_output_file.isSet())
throw runtime_error(
"This operation requires an output file. Use '-o file' or "
"'--output file'.");
out_rawlog_filename = arg_output_file.getValue();
if (fileExists(out_rawlog_filename) && !arg_overwrite.getValue())
throw runtime_error(
string("*ABORTING*: Output file already exists: ") +
out_rawlog_filename +
string("\n. Select a different output path, remove the file or "
"force overwrite with '-w' or '--overwrite'."));
if (!out_rawlog_io.open(out_rawlog_filename))
throw runtime_error(
string("*ABORTING*: Cannot open output file: ") +
out_rawlog_filename);
out_rawlog = std::make_unique<
mrpt::serialization::CArchiveStreamBase<mrpt::io::CFileGZOutputStream>>(
out_rawlog_io);
}
示例9: main
int main(int argc, char* argv[])
{
try
{
// init comandline parser
TCLAP::CmdLine cmd("Command description message", ' ', "1.0");
TCLAP::ValueArg<string> argOutputFile ("o", "output", "Output file", true, "", "string");
TCLAP::ValueArg<string> argFilter ("f", "filter", "Filter files according to pattern", false, ".SIFTComparison.feat.xml.gz","string");
TCLAP::ValueArg<int> argPRECLUSTER ("p", "precluster", "Number of descriptors to select in precluster-preprocessing (0 = no preclustering)",false,0 ,"int");
TCLAP::ValueArg<int> argBOWSIZE ("b", "bowsize", "Size of the BoW Dictionary", false, 1000, "int");
TCLAP::SwitchArg argBinaryInput ("i", "binary", "Read descriptors from binary archives", false);
TCLAP::SwitchArg argVerbose ("v", "verbose", "Provide additional debugging output", false);
TCLAP::UnlabeledValueArg<string> dirArg ( "directory", "Directory containing files with extracted features", true, "directory","string");
cmd.add( argOutputFile );
cmd.add( argFilter );
cmd.add( argPRECLUSTER );
cmd.add( argBOWSIZE );
cmd.add( argBinaryInput );
cmd.add( argVerbose );
cmd.add( dirArg );
// parse arguments
cmd.parse( argc, argv );
// enable/disable verbose output
VerboseOutput::verbose = argVerbose.getValue();
VerboseOutput::println(string("train"), "Create BoW of size %d", argBOWSIZE.getValue());
TermCriteria tcrit;
tcrit.epsilon = 10;
tcrit.maxCount = 10;
tcrit.type = 1;
BOWKMeansTrainer bowtrainer(argBOWSIZE.getValue(),tcrit,1,KMEANS_PP_CENTERS);
VerboseOutput::println(string("train"), "Creating Visual Bag of Words");
string filter = argFilter.getValue();
if (argBinaryInput.getValue())
{
filter = ".SIFTComparison.descriptors.dat";
}
vector<string> files = getdir(dirArg.getValue(), filter);
int i = 1;
VerboseOutput::println(string("train"), "Reading features of directory '%s'", dirArg.getValue().c_str());
for (vector<string>::iterator filename = files.begin(); filename!=files.end(); ++filename)
{
VerboseOutput::println("train", "[%i of %i in directory '%s']", i++, files.size(), dirArg.getValue().c_str());
Mat descriptors;
stringstream filePathss;
filePathss << dirArg.getValue() << "/" << *filename;
string filePath = filePathss.str();
VerboseOutput::println(string("train"), string("processing file '" + filePath + "'"));
if (argBinaryInput.getValue())
{
loadDescriptorsFromBinaryArchives(descriptors, filePath);
}
else
{
loadDescriptorsFromOpenCVFilestorage(descriptors, filePath);
}
if ((descriptors.rows == 0) || (descriptors.cols == 0))
{
throw runtime_error("No Descriptors read for file: ");
}
VerboseOutput::println(string("train"), "%i descriptors loaded", descriptors.rows);
if ((argPRECLUSTER.getValue() > 0) && (argPRECLUSTER.getValue() < descriptors.rows - 100))
{
VerboseOutput::println(string("train"), string("pre-clustering"));
Mat labels;
Mat centers;
kmeans(descriptors,argPRECLUSTER.getValue(),labels,tcrit,1, KMEANS_PP_CENTERS, centers);
VerboseOutput::println(string("train"), "...add cluster centers of pre-clustering to bow");
bowtrainer.add(centers);
}
else
{
VerboseOutput::println(string("train"), "...add descriptors to bow");
bowtrainer.add(descriptors);
}
//.........这里部分代码省略.........
示例10: main
// ======================================================================
// main() of graph-slam
// ======================================================================
int main(int argc, char **argv)
{
vector<TCLAP::Arg*> arg_ops; // to be destroyed on exit.
int ret_val = 0;
try
{
// --------------- List of possible operations ---------------
map<string,TOperationFunctor> ops_functors;
arg_ops.push_back(new TCLAP::SwitchArg("","levmarq",
"Op: Optimizes the graph with sparse Levenberg-Marquartd using global coordinates (via mrpt::graphslam::optimize_graph_spa_levmarq).\n"
" Can be used together with: --view, --output, --max-iters, --no-span, --initial-lambda"
,cmd, false) );
ops_functors["levmarq"] = &op_levmarq;
arg_ops.push_back(new TCLAP::SwitchArg("","dijkstra",
"Op: Executes CNetworkOfPoses::dijkstra_nodes_estimate() to estimate the global pose of nodes from a Dijkstra tree and the edge relative poses.\n"
" Can be used together with: --view, --output"
,cmd, false) );
ops_functors["dijkstra"] = &op_dijkstra;
arg_ops.push_back(new TCLAP::SwitchArg("","info",
"Op: Loads the graph and displays statistics and information on it.\n"
,cmd, false) );
ops_functors["info"] = &op_info;
// --------------- End of list of possible operations --------
// Parse arguments:
if (!cmd.parse( argc, argv ))
throw std::runtime_error(""); // should exit.
// Exactly 1 or --2d & --3d must be specified:
if ( (arg_2d.isSet() && arg_3d.isSet()) || (!arg_2d.isSet() && !arg_3d.isSet()) )
throw std::runtime_error("Exactly one --2d or --3d must be used.");
const bool is3d = arg_3d.isSet();
string input_file = arg_input_file.getValue();
const bool verbose = !arg_quiet.getValue();
// Check the selected operation:
// Only one of the ops should be selected:
string selected_op;
for (size_t i=0;i<arg_ops.size();i++)
if (arg_ops[i]->isSet())
{
if (selected_op.empty())
{
selected_op = arg_ops[i]->getName();
}
else throw std::runtime_error(
"Exactly one operation must be indicated on command line.\n"
"Use --help to see the list of possible operations.");
}
// The "--view" argument needs a bit special treatment:
if (selected_op.empty())
{
if (!arg_view.isSet())
throw std::runtime_error(
"Don't know what to do: No operation was indicated.\n"
"Use --help to see the list of possible operations.");
else
{
VERBOSE_COUT << "Operation to perform: " "view" << endl;
op_view(input_file,is3d,cmd,verbose);
}
}
else
{
VERBOSE_COUT << "Operation to perform: " << selected_op << endl;
// ------------------------------------
// EXECUTE THE REQUESTED OPERATION
// ------------------------------------
ASSERTMSG_(ops_functors.find(selected_op)!=ops_functors.end(), "Internal error: Unknown operation functor!")
// Call the selected functor:
ops_functors[selected_op](input_file,is3d,cmd,verbose);
}
// successful end of program.
ret_val = 0;
}
catch(std::exception &e)
{
if (strlen(e.what())) std::cerr << e.what() << std::endl;
ret_val = -1;
}
// Free mem:
for (size_t i=0;i<arg_ops.size();i++)
delete arg_ops[i];
// end:
return ret_val;
//.........这里部分代码省略.........
示例11: main
int main(int argc, char **argv)
{
try
{
printf(" gps2rawlog - Part of the MRPT\n");
printf(" MRPT C++ Library: %s - Sources timestamp: %s\n", MRPT_getVersion().c_str(), MRPT_getCompilationDate().c_str());
// Parse arguments:
if (!cmd.parse( argc, argv ))
throw std::runtime_error(""); // should exit.
const string input_gps_file = arg_input_file.getValue();
string output_rawlog_file = arg_output_file.getValue();
if (output_rawlog_file.empty())
output_rawlog_file = mrpt::system::fileNameChangeExtension(input_gps_file,"rawlog");
ASSERT_FILE_EXISTS_(input_gps_file)
// Open input rawlog:
CFileGZInputStream fil_input;
cout << "Opening for reading: '" << input_gps_file << "'...\n";
fil_input.open(input_gps_file);
cout << "Open OK.\n";
// Open output:
if (mrpt::system::fileExists(output_rawlog_file) && !arg_overwrite.isSet())
{
cout << "Output file already exists: `"<<output_rawlog_file<<"`, aborting. Use `-w` flag to overwrite.\n";
return 1;
}
CFileGZOutputStream fil_out;
cout << "Opening for writing: '" << output_rawlog_file << "'...\n";
if (!fil_out.open(output_rawlog_file))
throw std::runtime_error("Error writing file!");
// GPS object:
CGPSInterface gps_if;
gps_if.bindStream(&fil_input);
// ------------------------------------
// Parse:
// ------------------------------------
while ( !fil_input.checkEOF() )
{
gps_if.doProcess();
CGenericSensor::TListObservations lst_obs;
gps_if.getObservations(lst_obs);
printf("%u bytes parsed, %u new observations identified...\n",(unsigned)fil_input.getPosition(),(unsigned)lst_obs.size());
for (CGenericSensor::TListObservations::const_iterator it=lst_obs.begin();it!=lst_obs.end();++it) {
fil_out << *it->second;
}
}
// successful end of program.
return 0;
}
catch(std::exception &e)
{
if (strlen(e.what())) std::cerr << e.what() << std::endl;
return 1;
}
} // end of main()
示例12: execGraphSlamEngine
void execGraphSlamEngine(mrpt::system::COutputLogger* logger)
{
// Instance for managing the available graphslam deciders optimizers
TUserOptionsChecker<GRAPH_T> options_checker;
options_checker.createDeciderOptimizerMappings();
options_checker.populateDeciderOptimizerProperties();
// fetch the command line options
// ////////////////////////////////////////////////////////////
// decide whether to display the help messages for the deciders/optimizers
{
bool list_registrars = false;
if (list_all_registrars.getValue())
{
options_checker.dumpRegistrarsToConsole("all");
list_registrars = true;
}
if (list_node_registrars.getValue())
{
options_checker.dumpRegistrarsToConsole("node");
list_registrars = true;
}
if (list_edge_registrars.getValue())
{
options_checker.dumpRegistrarsToConsole("edge");
list_registrars = true;
}
if (list_optimizers.getValue())
{
options_checker.dumpOptimizersToConsole();
}
if (list_registrars || list_optimizers.getValue())
{
logger->logFmt(LVL_INFO, "Exiting.. ");
return;
}
}
// fetch the filenames
// ini file
string ini_fname = arg_ini_file.getValue();
// rawlog file
string rawlog_fname = arg_rawlog_file.getValue();
// ground-truth file
string ground_truth_fname;
if (arg_ground_truth_file.isSet())
{
ground_truth_fname = arg_ground_truth_file.getValue();
}
if (disable_visuals.getValue())
{ // enabling Visualization objects
logger->logFmt(LVL_WARN, "Running on headless mode - Visuals disabled");
}
// fetch which registration deciders / optimizer to use
string node_reg = arg_node_reg.getValue();
string edge_reg = arg_edge_reg.getValue();
string optimizer = arg_optimizer.getValue();
logger->logFmt(LVL_INFO, "Node registration decider: %s", node_reg.c_str());
logger->logFmt(LVL_INFO, "Edge registration decider: %s", edge_reg.c_str());
logger->logFmt(LVL_INFO, "graphSLAM Optimizer: %s", optimizer.c_str());
// CGraphSlamHandler initialization
CGraphSlamHandler<GRAPH_T> graphslam_handler(
logger, &options_checker, !disable_visuals.getValue());
graphslam_handler.setFNames(ini_fname, rawlog_fname, ground_truth_fname);
graphslam_handler.initEngine(node_reg, edge_reg, optimizer);
graphslam_handler.printParams();
graphslam_handler.execute();
}
示例13: main
int main(int argc, char* argv[])
{
cmd.parse( argc, argv );
cout.precision(12);
vec b(3), bpert(3), binhom(3);
b(0)=bx.getValue();
b(1)=by.getValue();
b(2)=bz.getValue();
bpert=b;
binhom=(bepsilon.getValue(),0,0);
bpert(0)=b(0)+deltabx.getValue();
//binhom(0)=b(0)+deltabx.getValue()+bepsilon.getValue();
//Parametros de Ising
//Construccion de estado coherentre
cvec state, staterev, qustate;
qustate=BlochToQubit(theta.getValue(),phi.getValue());
state=TensorPow(qustate,qubits.getValue());
staterev=state;
//Lista de la fidelidad
vec list(steps.getValue());
for(int i=0;i<steps.getValue();i++){
list(i)=pow( abs( dot( conj(staterev),state)),2);
//cout<< pow( abs( dot( conj(staterev),state)),2) <<endl;
cout << list(i) <<endl;
// cout<< i<< " " << list(i) <<endl;
list(i)=sqrt(list(i));
apply_ising_allvsall(state, J.getValue());
//Symmetry Breaking
apply_ising_z(state, Jepsilon.getValue(),0,1);
apply_magnetic_inhom(state, b, b+binhom);
apply_ising_allvsall(staterev, J.getValue()+Jpert.getValue());
//Symmetry breaking for H_1
apply_ising_z(staterev, Jepsilon.getValue(),0,1);
apply_magnetic_inhom(staterev, bpert, bpert+binhom);
}
//fidelity.close();
//cout << staterev;
cout<< sum_positive_derivatives(list)<< endl;
}
示例14: main
// Main
// ////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
// initializign the logger instance
COutputLogger logger("graphslam-engine_app");
logger.logging_enable_keep_record = true;
try {
bool showHelp = argc>1 && !os::_strcmp(argv[1],"--help");
bool showVersion = argc>1 && !os::_strcmp(argv[1],"--version");
// Instance for managing the available graphslam deciders optimizers
TUserOptionsChecker graphslam_opts;
// Input Validation
if (!cmd_line.parse( argc, argv ) || showVersion || showHelp) {
return 0;
}
// fetch the command line graphslam_opts
// ////////////////////////////////////////////////////////////
// decide whether to display the help messages for the deciders/optimizers
{
bool list_registrars = false;
if (list_all_registrars.getValue()) {
graphslam_opts.dumpRegistrarsToConsole("all");
list_registrars = true;
}
if (list_node_registrars.getValue()) {
graphslam_opts.dumpRegistrarsToConsole("node");
list_registrars = true;
}
if (list_edge_registrars.getValue()) {
graphslam_opts.dumpRegistrarsToConsole("edge");
list_registrars = true;
}
if (list_optimizers.getValue()) {
graphslam_opts.dumpOptimizersToConsole();
}
if (list_registrars || list_optimizers.getValue()) {
logger.logFmt(LVL_INFO, "Exiting.. ");
return 0;
}
}
// fetch which registration deciders / optimizer to use
string node_reg = arg_node_reg.getValue();
string edge_reg = arg_edge_reg.getValue();
string optimizer = arg_optimizer.getValue();
ASSERTMSG_(graphslam_opts.checkRegistrationDeciderExists(node_reg, "node"),
format("\nNode Registration Decider %s is not available.\n",
node_reg.c_str()) );
ASSERTMSG_(graphslam_opts.checkRegistrationDeciderExists(edge_reg, "edge"),
format("\nEdge Registration Decider %s is not available.\n",
edge_reg.c_str()) );
ASSERTMSG_(graphslam_opts.checkOptimizerExists(optimizer),
format("\nOptimizer %s is not available\n",
optimizer.c_str()) );
// fetch the filenames
// ini file
string ini_fname = arg_ini_file.getValue();
// rawlog file
string rawlog_fname = arg_rawlog_file.getValue();
// ground-truth file
string ground_truth_fname;
if ( arg_ground_truth_file.isSet() ) {
ground_truth_fname = arg_ground_truth_file.getValue();
}
if (disable_visuals.getValue()) { // enabling Visualization objects
logger.logFmt(LVL_WARN, "Running on headless mode - Visuals disabled");
}
logger.logFmt(LVL_INFO, "Node registration decider: %s", node_reg.c_str());
logger.logFmt(LVL_INFO, "Edge registration decider: %s", edge_reg.c_str());
logger.logFmt(LVL_INFO, "graphSLAM Optimizer: %s", optimizer.c_str());
// CGraphSlamHandler initialization
CGraphSlamHandler graphslam_handler;
graphslam_handler.setOutputLoggerPtr(&logger);
graphslam_handler.readConfigFname(ini_fname);
graphslam_handler.setRawlogFname(rawlog_fname);
// Visuals initialization
if (!disable_visuals.getValue()) {
graphslam_handler.initVisualization();
}
// CGraphSlamEngine initialization
CGraphSlamEngine<CNetworkOfPoses2DInf> graphslam_engine(
ini_fname,
rawlog_fname,
ground_truth_fname,
//.........这里部分代码省略.........
示例15: PrepareSimplePipeline
std::string outFilename = outFilenameArg.getValue();
std::cout << "Loading file '" << inFilename << "' ..."; std::cout.flush();
M4D::Imaging::AImage::Ptr image =
M4D::Imaging::ImageFactory::LoadDumpedImage( inFilename );
std::cout << "Done\n";
std::cout << "Initializing..."; std::cout.flush();
M4D::Imaging::PipelineContainer *container = NULL;
FinishHook *hook = new FinishHook;
M4D::Imaging::ConnectionInterfaceTyped< M4D::Imaging::AImage > *inConnection = NULL;
M4D::Imaging::ConnectionInterfaceTyped< M4D::Imaging::AImage > *outConnection = NULL;
M4D::Imaging::APipeFilter *filter = NULL;
/*---------------------------------------------------------------------*/
double bottom = bottomArg.getValue();
double top = topArg.getValue();
IMAGE_NUMERIC_TYPE_PTR_SWITCH_MACRO( image,
M4D::Imaging::ClampFilter<IMAGE_TYPE> *tfilter = new M4D::Imaging::ClampFilter<IMAGE_TYPE>();
tfilter->SetBottom( static_cast<TTYPE>( bottom ) );
tfilter->SetTop( static_cast<TTYPE>( top ) );
filter = tfilter;
);
/*---------------------------------------------------------------------*/
container = PrepareSimplePipeline( *filter, M4D::Imaging::MessageReceiverInterface::Ptr( hook ), inConnection, outConnection );
//container = PreparePipeline<ImageType>( *filter, M4D::Imaging::MessageReceiverInterface::Ptr( hook ), inConnection, outConnection );
inConnection->PutDataset( image );
std::cout << "Done\n";