Skip to content

Commit

Permalink
add icp computation to evaluate_dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
pomerlef committed Apr 13, 2012
1 parent b02a708 commit b5dcc92
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions examples/evaluate_dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,28 @@ int main(int argc, char *argv[])
typedef PM::DataPoints DP;

// Process arguments
PM::FileInfoVector list(argv[1]);
string outputFileName(argv[2]);

PM::FileInfoVector list(argv[2]);
string outputFileName(argv[3]);
std::fstream resultFile;
resultFile.open(outputFileName, fstream::out);
if (!resultFile.good())
{
cerr << "Error, invalid file " << outputFileName << endl;
abort();
}

PM pm;

//setLogger(pm.LoggerRegistrar.create("FileLogger"));

PM::DataPoints refCloud, readCloud;
TP T = TP::Identity(4,4);

//TODO: handle 2D
TP Tinit = TP::Identity(4,4);
TP Ttruth = TP::Identity(4,4);
TP Tout = TP::Identity(4,4);
PM::ICP icp;
//icp.inspector->dumpStatsHeader(resultFile);

for(unsigned i=0; i < list.size(); i++)
{
Expand All @@ -81,19 +93,33 @@ int main(int argc, char *argv[])
refCloud = PM::loadCSV(list[i].referenceFileName);
cout << "Reference cloud " << list[i].referenceFileName << " loaded" << endl;

ifstream ifs(list[i].configFileName);
icp.loadFromYaml(ifs);

if(list[i].initialTransformation.rows() != 0)
T = list[i].initialTransformation;

Tinit = list[i].initialTransformation;
if(list[i].groundTruthTransformation.rows() != 0)
Ttruth = list[i].groundTruthTransformation;

Tout = icp(refCloud, readCloud, Tinit);

// define errors

// Output results
icp.inspector->dumpStatsHeader(resultFile);
icp.inspector->dumpStats(resultFile);
}

resultFile.close();

return 0;
}

void validateArgs(int argc, char *argv[])
{
if (!(argc == 3))
if (!(argc == 4))
{
cerr << "Error in command line, usage " << argv[0] << " experimentFileName.csv resultFileName.csv" << endl;
cerr << "Error in command line, usage " << argv[0] << " /path/To/Data/ experimentFileName.csv resultFileName.csv" << endl;
abort();
}
}
Expand Down

0 comments on commit b5dcc92

Please sign in to comment.